Ejemplo n.º 1
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);
            }

            connectionInfo = new TlsConnectionInfo {
                CipherSuiteCode = Session.CurrentCrypto.Cipher.Code, ProtocolVersion = protocol
            };
        }
Ejemplo n.º 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");

			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);
			}

			connectionInfo = new TlsConnectionInfo {
				CipherCode = Session.CurrentCrypto.Cipher.Code, ProtocolVersion = protocol
			};

			if (configuration.TlsSettings != null)
				configuration.TlsSettings.ConnectionInfo = connectionInfo;
		}
Ejemplo n.º 3
0
		public TlsConnectionInfo GetConnectionInfo ()
		{
			if (connectionInfo != null)
				return connectionInfo;

			connectionInfo = new TlsConnectionInfo {
				CipherCode = (CipherSuiteCode)openssl.CurrentCipher
			};

			return connectionInfo;
		}