예제 #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();
				}
			}*/
		}
예제 #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();
 *                              }
 *                      }*/
        }
예제 #3
0
        internal void Attach(SecureSocket socket, ServerHandshakeLayer layer)
        {
            this.Socket = socket;
            this.Layer = layer;

            layer.OnHandshakeFinished += this.Socket.HandshakeFinishedHandler;
        }
예제 #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);
 }
예제 #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;
        }
예제 #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);
		}
예제 #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;
 }
예제 #9
0
 public ClientHandshakeLayer(HandshakeLayer handshakeLayer)
     : base(handshakeLayer)
 {
     this.clientHelloExts = m_Options.ExtensionList;
 }
 public Ssl3ServerHandshakeLayer(HandshakeLayer handshakeLayer)
     : base(handshakeLayer)
 {
 }
		public Tls1ServerHandshakeLayer(HandshakeLayer handshakeLayer) : base(handshakeLayer) {}
 public Tls1ClientHandshakeLayer(HandshakeLayer handshakeLayer)
     : base(handshakeLayer)
 {
 }
예제 #13
0
		public ServerHandshakeLayer(HandshakeLayer handshakeLayer) : base(handshakeLayer) {
			m_MaxClientVersion = ((ServerHandshakeLayer)handshakeLayer).m_MaxClientVersion;
		}
예제 #14
0
 public ClientHandshakeLayer(HandshakeLayer handshakeLayer)
     : base(handshakeLayer)
 {
     this.clientHelloExts = m_Options.ExtensionList;
 }
예제 #15
0
 public ServerHandshakeLayer(HandshakeLayer handshakeLayer)
     : base(handshakeLayer)
 {
     m_MaxClientVersion = ((ServerHandshakeLayer)handshakeLayer).m_MaxClientVersion;
     this.serverHelloExts = m_Options.ExtensionList;
 }
예제 #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);
 }
예제 #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)
 {
 }
 public Ssl3ClientHandshakeLayer(HandshakeLayer handshakeLayer)
     : base(handshakeLayer)
 {
 }