Ejemplo n.º 1
0
		public RecordLayer(SocketController controller, HandshakeLayer handshakeLayer) {
			m_IsDisposed = false;
			m_Controller = controller;
			m_HandshakeLayer = handshakeLayer;
			m_IncompleteMessage = new byte[0];
			ChangeLocalState(null, null, null);
			ChangeRemoteState(null, null, null);
/*			if (options.Entity == ConnectionEnd.Server) {
				if (options.Protocol == SecureProtocol.Tls1) {
					m_HandshakeLayer = new Tls1ServerHandshakeLayer(this, options);
				} else if (options.Protocol == SecureProtocol.Ssl3) {
					m_HandshakeLayer = new Ssl3ServerHandshakeLayer(this, options);
				} else {
					throw new NotSupportedException();
				}
			} else {
				if (options.Protocol == SecureProtocol.Tls1) {
					m_HandshakeLayer = new Tls1ClientHandshakeLayer(this, options);
				} else if (options.Protocol == SecureProtocol.Ssl3) {
					m_HandshakeLayer = new Ssl3ClientHandshakeLayer(this, options);
				} else {
					throw new NotSupportedException();
				}
			}*/
		}
Ejemplo n.º 2
0
        public RecordLayer(SocketController controller, HandshakeLayer handshakeLayer)
        {
            m_IsDisposed        = false;
            m_Controller        = controller;
            m_HandshakeLayer    = handshakeLayer;
            m_IncompleteMessage = new byte[0];
            ChangeLocalState(null, null, null);
            ChangeRemoteState(null, null, null);

/*			if (options.Entity == ConnectionEnd.Server) {
 *                              if (options.Protocol == SecureProtocol.Tls1) {
 *                                      m_HandshakeLayer = new Tls1ServerHandshakeLayer(this, options);
 *                              } else if (options.Protocol == SecureProtocol.Ssl3) {
 *                                      m_HandshakeLayer = new Ssl3ServerHandshakeLayer(this, options);
 *                              } else {
 *                                      throw new NotSupportedException();
 *                              }
 *                      } else {
 *                              if (options.Protocol == SecureProtocol.Tls1) {
 *                                      m_HandshakeLayer = new Tls1ClientHandshakeLayer(this, options);
 *                              } else if (options.Protocol == SecureProtocol.Ssl3) {
 *                                      m_HandshakeLayer = new Ssl3ClientHandshakeLayer(this, options);
 *                              } else {
 *                                      throw new NotSupportedException();
 *                              }
 *                      }*/
        }
Ejemplo n.º 3
0
        internal void Attach(SecureSocket socket, ServerHandshakeLayer layer)
        {
            this.Socket = socket;
            this.Layer = layer;

            layer.OnHandshakeFinished += this.Socket.HandshakeFinishedHandler;
        }
Ejemplo n.º 4
0
 public RecordLayer(SocketController controller, HandshakeLayer handshakeLayer)
 {
     m_IsDisposed        = false;
     m_Controller        = controller;
     m_HandshakeLayer    = handshakeLayer;
     m_IncompleteMessage = new byte[0];
     ChangeLocalState(null, null, null);
     ChangeRemoteState(null, null, null);
 }
Ejemplo n.º 5
0
        public CompatibilityLayer(SocketController controller, SecurityOptions options)
        {
            m_Buffer     = new byte[0];
            m_MinVersion = GetMinProtocol(options.Protocol);
            m_MaxVersion = GetMaxProtocol(options.Protocol);

            this.handshakeMonitor = new SslTlsHandshakeMonitor();

            HandshakeLayer layer = null;

            if (m_MinVersion.GetVersionInt() == 30)
            { // SSL 3.0
                if (options.Entity == ConnectionEnd.Client)
                {
                    layer      = new Ssl3ClientHandshakeLayer(null, options);
                    m_MinLayer = new RecordLayer(controller, layer as ClientHandshakeLayer);

                    this.handshakeMonitor.Attach(controller.Parent, layer as ClientHandshakeLayer);
                }
                else
                {
                    layer      = new Ssl3ServerHandshakeLayer(null, options);
                    m_MinLayer = new RecordLayer(controller, layer as ServerHandshakeLayer);

                    this.handshakeMonitor.Attach(controller.Parent, layer as ServerHandshakeLayer);
                }
            }
            else
            { // TLS 1.0
                if (options.Entity == ConnectionEnd.Client)
                {
                    layer      = new Tls1ClientHandshakeLayer(null, options);
                    m_MinLayer = new RecordLayer(controller, layer as ClientHandshakeLayer);

                    this.handshakeMonitor.Attach(controller.Parent, layer as ClientHandshakeLayer);
                }
                else
                {
                    layer      = new Tls1ServerHandshakeLayer(null, options);
                    m_MinLayer = new RecordLayer(controller, layer as ServerHandshakeLayer);

                    this.handshakeMonitor.Attach(controller.Parent, layer as ServerHandshakeLayer);
                }
            }

            m_MinLayer.HandshakeLayer.RecordLayer = m_MinLayer;
            m_Options = options;
        }
Ejemplo n.º 6
0
		public HandshakeLayer(HandshakeLayer handshakeLayer) {
			m_Disposed = false;
			m_RecordLayer = handshakeLayer.m_RecordLayer;
			m_Options = handshakeLayer.m_Options;
			m_IsNegotiating = handshakeLayer.m_IsNegotiating;
			m_RNG = handshakeLayer.m_RNG;
			m_State = handshakeLayer.m_State;
			m_IncompleteMessage = handshakeLayer.m_IncompleteMessage;
			m_LocalMD5Hash = handshakeLayer.m_LocalMD5Hash;
			m_LocalSHA1Hash = handshakeLayer.m_LocalSHA1Hash;
			m_RemoteMD5Hash = handshakeLayer.m_RemoteMD5Hash;
			m_RemoteSHA1Hash = handshakeLayer.m_RemoteSHA1Hash;
			m_CertSignHash = handshakeLayer.m_CertSignHash;
			m_CertSignHash.Protocol = this.GetProtocol();
			m_MutualAuthentication = handshakeLayer.m_MutualAuthentication;
			m_ClientTime = handshakeLayer.m_ClientTime;
			m_ClientRandom = handshakeLayer.m_ClientRandom;
			handshakeLayer.Dispose(false);
		}
Ejemplo n.º 7
0
 public HandshakeLayer(HandshakeLayer handshakeLayer)
 {
     m_Disposed              = false;
     m_RecordLayer           = handshakeLayer.m_RecordLayer;
     m_Options               = handshakeLayer.m_Options;
     m_IsNegotiating         = handshakeLayer.m_IsNegotiating;
     m_RNG                   = handshakeLayer.m_RNG;
     m_State                 = handshakeLayer.m_State;
     m_IncompleteMessage     = handshakeLayer.m_IncompleteMessage;
     m_LocalMD5Hash          = handshakeLayer.m_LocalMD5Hash;
     m_LocalSHA1Hash         = handshakeLayer.m_LocalSHA1Hash;
     m_RemoteMD5Hash         = handshakeLayer.m_RemoteMD5Hash;
     m_RemoteSHA1Hash        = handshakeLayer.m_RemoteSHA1Hash;
     m_CertSignHash          = handshakeLayer.m_CertSignHash;
     m_CertSignHash.Protocol = this.GetProtocol();
     m_MutualAuthentication  = handshakeLayer.m_MutualAuthentication;
     m_ClientTime            = handshakeLayer.m_ClientTime;
     m_ClientRandom          = handshakeLayer.m_ClientRandom;
     handshakeLayer.Dispose(false);
 }
 public ServerHandshakeLayer(HandshakeLayer handshakeLayer) : base(handshakeLayer)
 {
     m_MaxClientVersion = ((ServerHandshakeLayer)handshakeLayer).m_MaxClientVersion;
 }
Ejemplo n.º 9
0
 public ClientHandshakeLayer(HandshakeLayer handshakeLayer)
     : base(handshakeLayer)
 {
     this.clientHelloExts = m_Options.ExtensionList;
 }
Ejemplo n.º 10
0
 public Ssl3ServerHandshakeLayer(HandshakeLayer handshakeLayer)
     : base(handshakeLayer)
 {
 }
		public Tls1ServerHandshakeLayer(HandshakeLayer handshakeLayer) : base(handshakeLayer) {}
Ejemplo n.º 12
0
 public Tls1ClientHandshakeLayer(HandshakeLayer handshakeLayer)
     : base(handshakeLayer)
 {
 }
Ejemplo n.º 13
0
		public ServerHandshakeLayer(HandshakeLayer handshakeLayer) : base(handshakeLayer) {
			m_MaxClientVersion = ((ServerHandshakeLayer)handshakeLayer).m_MaxClientVersion;
		}
Ejemplo n.º 14
0
 public ClientHandshakeLayer(HandshakeLayer handshakeLayer)
     : base(handshakeLayer)
 {
     this.clientHelloExts = m_Options.ExtensionList;
 }
Ejemplo n.º 15
0
 public ServerHandshakeLayer(HandshakeLayer handshakeLayer)
     : base(handshakeLayer)
 {
     m_MaxClientVersion = ((ServerHandshakeLayer)handshakeLayer).m_MaxClientVersion;
     this.serverHelloExts = m_Options.ExtensionList;
 }
Ejemplo n.º 16
0
 public RecordLayer(SocketController controller, HandshakeLayer handshakeLayer)
 {
     m_IsDisposed = false;
     m_Controller = controller;
     m_HandshakeLayer = handshakeLayer;
     m_IncompleteMessage = new byte[0];
     ChangeLocalState(null, null, null);
     ChangeRemoteState(null, null, null);
 }
Ejemplo n.º 17
0
 public ServerHandshakeLayer(HandshakeLayer handshakeLayer)
     : base(handshakeLayer)
 {
     m_MaxClientVersion   = ((ServerHandshakeLayer)handshakeLayer).m_MaxClientVersion;
     this.serverHelloExts = m_Options.ExtensionList;
 }
 public ClientHandshakeLayer(HandshakeLayer handshakeLayer) : base(handshakeLayer)
 {
 }
Ejemplo n.º 19
0
 public Ssl3ClientHandshakeLayer(HandshakeLayer handshakeLayer)
     : base(handshakeLayer)
 {
 }