System.Net.Security.SslStream.AuthenticateAsServerAsync Method

Called by servers to authenticate the server and optionally the client in a client-server connection using the specified certificates, requirements and security protocol as an asynchronous operation.

Syntax

public virtual System.Threading.Tasks.Task AuthenticateAsServerAsync (System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, bool clientCertificateRequired, System.Security.Authentication.SslProtocols enabledSslProtocols, bool checkCertificateRevocation)

Parameters

serverCertificate
The X509Certificate used to authenticate the server.
clientCertificateRequired
A bool value that specifies whether the client must supply a certificate for authentication.
enabledSslProtocols
The System.Security.Authentication.SslProtocols value that represents the protocol used for authentication.
checkCertificateRevocation
A bool value that specifies whether the certificate revocation list is checked during authentication.

Returns

Returns System.Threading.Tasks.Task

The task object representing the asynchronous operation.

Remarks

If the authentication fails, you receive a System.Security.Authentication.AuthenticationException, and this System.Net.Security.SslStream is no longer useable. You should close this object and remove all references to it so that it can be collected by the garbage collector.

Requirements

Namespace: System.Net.Security
Assembly: System (in System.dll)
Assembly Versions: 4.0.0.0
Since: .NET 2.0