public SecureConnection(IConnection connection, IAsymmetricCipher asymmetricCipher, ISymmetricCipher symmetricCipher) { this.Connection = connection; this.SymmetricCipher = symmetricCipher; this.AsymmetricCipher = asymmetricCipher; connection.OnDataReceived += OnEncryptedMessageReceived; connection.OnDisconnected += () => OnDisconnected?.Invoke(); }
/// <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; }
/// <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); } }
public SecureClientConnection(IConnection connection, IAsymmetricCipher asymmetricCipher, ISymmetricCipher symmetricCipher) : base(connection, asymmetricCipher, symmetricCipher) { }