예제 #1
0
 public ConnectResponse(bool opened, string version, bool encrypted, EncryptionData encryptionData)
 {
     Opened = opened;
     Version = version;
     IsEncryted = encrypted;
     EncryptionData = encryptionData;
 }
예제 #2
0
 void IClientConnector.SetEncrypton(EncryptionData encryptionData)
 {
     OnSetEncryption(encryptionData);
 }
예제 #3
0
 protected virtual void OnSetEncryption(EncryptionData encryptionData)
 {
 }
예제 #4
0
 void IClientConnector.SetEncrypton(EncryptionData encryptionData)
 {
     OnSetEncryption(encryptionData);
 }
예제 #5
0
 protected virtual void OnSetEncryption(EncryptionData encryptionData)
 {
 }
예제 #6
0
        public void SetEncrypton(EncryptionData encryptionData)
        {
            lock (channelLock) {
                var key = Encoding.Unicode.GetBytes(encryptionData.Key);
                var iv = Encoding.Unicode.GetBytes(encryptionData.IV);
                var readHash = SelectHashAlgorithm(encryptionData.HashAlgorithm, key, iv, FileAccess.Read);
                var writeHash = SelectHashAlgorithm(encryptionData.HashAlgorithm, key, iv, FileAccess.Write);

                InputStream = new CryptoStream(InputStream, readHash, CryptoStreamMode.Read);
                OutputStream = new CryptoStream(OutputStream, writeHash, CryptoStreamMode.Write);
            }
        }