示例#1
0
 public SecureConnection(IConnection connection, IAsymmetricCipher asymmetricCipher, ISymmetricCipher symmetricCipher)
 {
     this.Connection            = connection;
     this.SymmetricCipher       = symmetricCipher;
     this.AsymmetricCipher      = asymmetricCipher;
     connection.OnDataReceived += OnEncryptedMessageReceived;
     connection.OnDisconnected += () => OnDisconnected?.Invoke();
 }
示例#2
0
 /// <summary>
 /// Returns the cipher engine instance family type
 /// </summary>
 /// 
 /// <param name="Cipher">An instance of an asymmetric cipher</param>
 /// 
 /// <returns>The asymmetric family designator</returns>
 public static AsymmetricEngines GetCipherType(IAsymmetricCipher Cipher)
 {
     if (Cipher.GetType().Equals(typeof(NTRUEncrypt)))
         return AsymmetricEngines.NTRU;
     else if (Cipher.GetType().Equals(typeof(MPKCEncrypt)))
         return AsymmetricEngines.McEliece;
     else
         return AsymmetricEngines.RingLWE;
 }
示例#3
0
 /// <summary>
 /// Returns the cipher engine instance family type
 /// </summary>
 ///
 /// <param name="Cipher">An instance of an asymmetric cipher</param>
 ///
 /// <returns>The asymmetric family designator</returns>
 public static AsymmetricEngines GetCipherType(IAsymmetricCipher Cipher)
 {
     if (Cipher.GetType().Equals(typeof(NTRUEncrypt)))
     {
         return(AsymmetricEngines.NTRU);
     }
     else if (Cipher.GetType().Equals(typeof(MPKCEncrypt)))
     {
         return(AsymmetricEngines.McEliece);
     }
     else
     {
         return(AsymmetricEngines.RingLWE);
     }
 }
示例#4
0
 public SecureClientConnection(IConnection connection, IAsymmetricCipher asymmetricCipher, ISymmetricCipher symmetricCipher)
     : base(connection, asymmetricCipher, symmetricCipher)
 {
 }