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

BeginAuthenticateAsServer() public method

public BeginAuthenticateAsServer ( X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState ) : IAsyncResult
serverCertificate System.Security.Cryptography.X509Certificates.X509Certificate
clientCertificateRequired bool
enabledSslProtocols SslProtocols
checkCertificateRevocation bool
asyncCallback AsyncCallback
asyncState object
return IAsyncResult
        public virtual IAsyncResult BeginAuthenticateAsServer(X509Certificate serverCertificate, bool clientCertificateRequired,
                                                            SslProtocols enabledSslProtocols, bool checkCertificateRevocation,
                                                            AsyncCallback asyncCallback,
                                                            object asyncState)
        {
            SecurityProtocol.ThrowOnNotAllowed(enabledSslProtocols);
            _sslState.ValidateCreateContext(true, string.Empty, enabledSslProtocols, serverCertificate, null, clientCertificateRequired, checkCertificateRevocation);
            LazyAsyncResult result = new LazyAsyncResult(_sslState, asyncState, asyncCallback);
            _sslState.ProcessAuthentication(result);
            return result;
        }

Same methods

SslStream::BeginAuthenticateAsServer ( X509Certificate serverCertificate, AsyncCallback asyncCallback, object asyncState ) : IAsyncResult
SslStream::BeginAuthenticateAsServer ( X509Certificate serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState ) : IAsyncResult
SslStream::BeginAuthenticateAsServer ( System serverCertificate, System asyncCallback, object asyncState ) : System.IAsyncResult
SslStream::BeginAuthenticateAsServer ( System serverCertificate, bool clientCertificateRequired, System enabledSslProtocols, bool checkCertificateRevocation, System asyncCallback, object asyncState ) : System.IAsyncResult
SslStream::BeginAuthenticateAsServer ( System serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation, System asyncCallback, object asyncState ) : System.IAsyncResult

Usage Example

        public void assign_without_subscribing_on_MessageReceived_means_that_messages_can_get_lost()
        {
            var slice = new BufferSlice(new byte[65535], 0, 65535);
            var encoder = Substitute.For<IMessageEncoder>();
            var decoder = Substitute.For<IMessageDecoder>();
            var stream = new SslStream(new NetworkStream(_helper.Server));
            stream.BeginAuthenticateAsServer(_certificate, OnAuthenticated, stream);

            var sut = CreateClientChannel(slice, encoder, decoder);
            Action actual = () => sut.Assign(_helper.Client);

            actual.ShouldThrow<InvalidOperationException>();
        }
All Usage Examples Of System.Net.Security.SslStream::BeginAuthenticateAsServer