Example #1
0
 public void Clear()
 {
     negotiationHandler = null;
     if (handshakeParameters != null)
     {
         handshakeParameters.Dispose();
         handshakeParameters = null;
     }
     if (session != null)
     {
         session.Dispose();
         session = null;
     }
 }
Example #2
0
        internal void FinishHandshake()
        {
            HandshakeParameters.Dispose();
            HandshakeParameters = null;

            if (Session.CurrentCrypto == null || Session.PendingCrypto != null)
            {
                throw new TlsException(AlertDescription.InsuficientSecurity, "No ciper");
            }
            if (Session.CurrentCrypto.Cipher == null)
            {
                throw new TlsException(AlertDescription.InsuficientSecurity, "No ciper");
            }

            if (configuration.UserSettings != null)
            {
                configuration.UserSettings.ConnectionInfo = GetConnectionInfo();
            }
        }
Example #3
0
        internal void FinishHandshake()
        {
            HandshakeParameters.Dispose();
            HandshakeParameters = null;

            if (Session.CurrentCrypto == null || Session.PendingCrypto != null)
            {
                throw new TlsException(AlertDescription.InsuficientSecurity, "No ciper");
            }
            if (Session.CurrentCrypto.Cipher == null)
            {
                throw new TlsException(AlertDescription.InsuficientSecurity, "No ciper");
            }

            TlsProtocols protocol;

            switch (Session.CurrentCrypto.Protocol)
            {
            case TlsProtocolCode.Tls10:
                protocol = TlsProtocols.Tls10;
                break;

            case TlsProtocolCode.Tls11:
                protocol = TlsProtocols.Tls11;
                break;

            case TlsProtocolCode.Tls12:
                protocol = TlsProtocols.Tls12;
                break;

            default:
                throw new TlsException(AlertDescription.ProtocolVersion);
            }

            var cipher = Session.CurrentCrypto.Cipher;

            connectionInfo = new MonoTlsConnectionInfo {
                CipherSuiteCode       = cipher.Code, ProtocolVersion = protocol,
                CipherAlgorithmType   = cipher.CipherAlgorithmType,
                HashAlgorithmType     = cipher.HashAlgorithmType,
                ExchangeAlgorithmType = cipher.ExchangeAlgorithmType
            };
        }