Разработка распределенных приложений в Microsoft.NET Framework




Пример 1


class EncryptedServerChannelSinkProvider : IServerChannelSinkProvider

{

private IServerChannelSinkProvider next;

private SymmetricEncryptor encryptor;

public IServerChannelSinkProvider Next

{

get { return next; }

set { next = value; }

}

public EncryptedServerChannelSinkProvider(IDictionary properties,

ICollection providerData)

{

string keyFile = (string) properties["key"];

Console.WriteLine("Server key: [{0}]", keyFile);

encryptor = new SymmetricEncryptor(keyFile);

}

// Создание трубы канала

public IServerChannelSink CreateSink(IChannelReceiver channel)

{

IServerChannelSink nextSink = Next.CreateSink(channel);

return new EncryptedServerChannelSink(channel, encryptor, nextSink);

}

// Обязательный метод интерфейса

public void GetChannelData(IChannelDataStore channelData)

{

}

}




Содержание  Назад  Вперед