Beispiel #1
0
        public ElServerSSLSocket Accept()
        {
            if (transport == null)
            {
                throw new NullReferenceException("Set \"Socket\" property first");
            }

            transport.Blocking = true;
            Socket s = transport.Accept();

            s.Blocking = true;
            ElServerSSLSocket sslsocket = new ElServerSSLSocket();

            sslsocket.Socket = s;
            sslsocket.InitializeAcceptedSSLSocket(SBSSLServer);
            sslsocket.OnCertificateValidate = this.OnCertificateValidate;
            sslsocket.OnCiphersNegotiated   = this.OnCiphersNegotiated;
            sslsocket.OnError              = this.OnError;
            sslsocket.OnCertificateURLs    = this.OnCertificateURLs;
            sslsocket.OnExtensionsReceived = this.OnExtensionsReceived;
            sslsocket.OnKeyNeeded          = this.OnKeyNeeded;
            sslsocket.OnRenegotiationStart = this.OnRenegotiationStart;
            if (!SBSSLServer.Enabled)
            {
                sslsocket.OpenSSLSession();
            }
            return(sslsocket);
        }
Beispiel #2
0
 private void OnSocketAcceptCallback(IAsyncResult asyncResult)
 {
     try
     {
         Socket s = transport.EndAccept(asyncResult);
         s.Blocking = false;
         ElServerSSLSocket sslsocket = new ElServerSSLSocket(beginAcceptAsyncResult);
         sslsocket.Blocking = false;
         sslsocket.Socket   = s;
         sslsocket.InitializeAcceptedSSLSocket(SBSSLServer);
         sslsocket.OnCertificateValidate = this.OnCertificateValidate;
         sslsocket.OnCiphersNegotiated   = this.OnCiphersNegotiated;
         sslsocket.OnError              = this.OnError;
         sslsocket.OnCertificateURLs    = this.OnCertificateURLs;
         sslsocket.OnExtensionsReceived = this.OnExtensionsReceived;
         sslsocket.OnKeyNeeded          = this.OnKeyNeeded;
         sslsocket.OnRenegotiationStart = this.OnRenegotiationStart;
         sslsocket.Open();
         sslsocket.BeginReceive();
     }
     catch (Exception ex)
     {
         ExceptionOccured(ex);
         CompleteAcceptAsyncResult();
     }
 }
Beispiel #3
0
 public SSLSocketAsyncAcceptResult(ElServerSSLSocket parent, AsyncCallback callback, Object asyncState) :
     base(callback, asyncState)
 {
     this.parent = parent;
 }