Пример #1
0
 public void AddChannel(byte[] cryptoKey, SymmetricAlgorithm algorithm = null, string channelName = null)
 {
     algorithm = algorithm ?? SymmetricAlgorithm.Create();
       var channel = new EncryptionChannel(channelName, cryptoKey, algorithm);
       if(channelName == null)
     _defaultChannel = channel;
       else
     _channels[channelName] = channel;
 }
Пример #2
0
        public void AddChannel(byte[] cryptoKey, SymmetricAlgorithm algorithm = null, string channelName = null)
        {
            algorithm = algorithm ?? SymmetricAlgorithm.Create();
            var channel = new EncryptionChannel(channelName, cryptoKey, algorithm);

            if (channelName == null)
            {
                _defaultChannel = channel;
            }
            else
            {
                _channels[channelName] = channel;
            }
        }
Пример #3
0
        private EncryptionChannel GetChannel(string name)
        {
            if (name == null)
            {
                Util.Check(_defaultChannel != null, "Default encryption channel is not configured.");
                return(_defaultChannel);
            }
            EncryptionChannel ch = null;

            if (_channels.TryGetValue(name, out ch))
            {
                return(ch);
            }
            Util.Throw("Encryption channel {0} not configured.", name);
            return(null);
        }