Beispiel #1
0
        public override IAsyncResult BeginAccept(AsyncCallback cb, object state)
        {
            lock (m_syncRoot)
            {
                ThreadPool.QueueUserWorkItem(delegate
                {
                    try
                    {
                        m_clientSocket = m_socket.Accept();
                        if (m_config.Security.ResumeSession)
                        {
                            // Setting here a session pool, allow to enable session resume capabilities on the server
                            m_clientSocket.SessionPool = m_sessionPool;
                        }
                        m_clientSocket.OpenSSLSession();
                    }
                    catch (Exception ex)
                    {
                        m_logProvider.LogRuntimeInfo(ZoneFlags.SSL, "Exception during OpenSSLSession : " + ex.Message);
                        // Error during handshaking : closing all sockets
                        m_clientSocket.Dispose();
                        m_clientSocket = null; // setting this to null = error in EndAccept
                    }

                    cb(new SslAsyncResult(this));
                });

                return(null);
            }
        }
Beispiel #2
0
 public override void Create(SocketWrapperBase sock)
 {
     lock (m_syncRoot)
     {
         m_socket = ((HttpsSocket)sock).m_socket;
     }
 }
Beispiel #3
0
 public void Create(ElServerSSLSocket sock)
 {
     lock (m_syncRoot)
     {
         m_socket = sock;
     }
 }
Beispiel #4
0
        public override void Create(System.Net.Sockets.AddressFamily af, System.Net.Sockets.SocketType type, System.Net.Sockets.ProtocolType proto)
        {
            lock (m_syncRoot)
            {
                m_socket          = new ElServerSSLSocket(new Socket(af, type, proto));
                m_socket.Versions = m_protocols;

                // To speed the answer, we're using only the fastest cipher suites (based on experimentation ...)
                for (short i = SBSSLConstants.__Global.SB_SUITE_FIRST; i < SBSSLConstants.__Global.SB_SUITE_LAST; i++)
                {
                    m_socket.set_CipherSuites(i, false);
                }

                // let the user overide cipher suites if they desire
                if (m_config.Security.CipherList != null && m_config.Security.CipherList.Count > 0)
                {
                    foreach (var c in m_config.Security.CipherList)
                    {
                        m_socket.set_CipherSuites(c, true);
                    }
                }
                else
                {
                    m_socket.set_CipherSuites(SBSSLConstants.__Global.SB_SUITE_RSA_3DES_SHA, true);
                    m_socket.set_CipherSuites(SBSSLConstants.__Global.SB_SUITE_RSA_AES128_SHA, true);
                    m_socket.set_CipherSuites(SBSSLConstants.__Global.SB_SUITE_RSA_AES256_SHA, true);
                }

                m_socket.CustomCertStorage = m_certStorage;
                m_socket.OnError          += new SBSSLCommon.TSBErrorEvent(m_socket_OnError);
            }
        }
		}

		private void OnSecureClientCertificateChoose(object Sender, 
			SBX509.TElX509Certificate[] Certificates, ref int CertificateIndex)
		{
			if (OnCertificateChoose != null)
Beispiel #6
0
 public ServerSSLConnection(System.Net.Sockets.Socket aSocket, IServerSSLConnectionSettings aSettings)
 {
     fDataSocket = new ElServerSSLSocket(aSocket);
     InitializeSSLSocket(aSettings);
     ((ElServerSSLSocket)DataSocket).OpenSSLSession();
 }
Beispiel #7
0
 public SslStream(ElServerSSLSocket socket)
 {
     m_socket = socket;
 }
Beispiel #8
0
 public SslNetworkStream(ElServerSSLSocket socket)
 {
     m_stream = new SslStream(socket);
 }