System.Net.Security.SslStream.AuthenticateAsServer C# (CSharp) Method

AuthenticateAsServer() public method

public AuthenticateAsServer ( System serverCertificate ) : void
serverCertificate System
return void
        public virtual void AuthenticateAsServer(System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate) { }
        public virtual void AuthenticateAsServer(System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, bool clientCertificateRequired, System.Security.Authentication.SslProtocols enabledSslProtocols, bool checkCertificateRevocation) { }

Same methods

SslStream::AuthenticateAsServer ( System serverCertificate, bool clientCertificateRequired, System enabledSslProtocols, bool checkCertificateRevocation ) : void
SslStream::AuthenticateAsServer ( System serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation ) : void
SslStream::AuthenticateAsServer ( X509Certificate serverCertificate ) : void
SslStream::AuthenticateAsServer ( X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation ) : void
SslStream::AuthenticateAsServer ( X509Certificate serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation ) : void

Usage Example

        public HttpConnection(ILogger logger, Socket sock, EndPointListener epl, bool secure, X509Certificate cert, string connectionId)
        {
            _connectionId = connectionId;
            _logger = logger;
            this.sock = sock;
            this.epl = epl;
            this.secure = secure;
            this.cert = cert;
            this.SetSocketTimeout(sock);
            if (secure == false)
            {
                stream = new NetworkStream(sock, false);
            }
            else
            {
                //ssl_stream = epl.Listener.CreateSslStream(new NetworkStream(sock, false), false, (t, c, ch, e) =>
                //{
                //    if (c == null)
                //        return true;
                //    var c2 = c as X509Certificate2;
                //    if (c2 == null)
                //        c2 = new X509Certificate2(c.GetRawCertData());
                //    client_cert = c2;
                //    client_cert_errors = new int[] { (int)e };
                //    return true;
                //});
                //stream = ssl_stream.AuthenticatedStream;

                ssl_stream = new SslStream(new NetworkStream(sock, false), false);
                ssl_stream.AuthenticateAsServer(cert);
                stream = ssl_stream;
            }
            timer = new ResumableTimer(OnTimeout);
            Init();
        }
All Usage Examples Of System.Net.Security.SslStream::AuthenticateAsServer