SslStream.AuthenticateAsServerAsync SslStream.AuthenticateAsServerAsync SslStream.AuthenticateAsServerAsync SslStream.AuthenticateAsServerAsync Method

Definition

Called by servers to authenticate the server and optionally the client in a client-server connection as an asynchronous operation.

Overloads

AuthenticateAsServerAsync(X509Certificate, Boolean, SslProtocols, Boolean) AuthenticateAsServerAsync(X509Certificate, Boolean, SslProtocols, Boolean) AuthenticateAsServerAsync(X509Certificate, Boolean, SslProtocols, Boolean) AuthenticateAsServerAsync(X509Certificate, Boolean, SslProtocols, Boolean)

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.

AuthenticateAsServerAsync(X509Certificate, Boolean, Boolean) AuthenticateAsServerAsync(X509Certificate, Boolean, Boolean) AuthenticateAsServerAsync(X509Certificate, Boolean, Boolean) AuthenticateAsServerAsync(X509Certificate, Boolean, Boolean)

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.

AuthenticateAsServerAsync(X509Certificate) AuthenticateAsServerAsync(X509Certificate) AuthenticateAsServerAsync(X509Certificate) AuthenticateAsServerAsync(X509Certificate)

Called by servers to authenticate the server and optionally the client in a client-server connection using the specified certificate as an asynchronous operation.

AuthenticateAsServerAsync(SslServerAuthenticationOptions, CancellationToken) AuthenticateAsServerAsync(SslServerAuthenticationOptions, CancellationToken) AuthenticateAsServerAsync(SslServerAuthenticationOptions, CancellationToken)

AuthenticateAsServerAsync(X509Certificate, Boolean, SslProtocols, Boolean) AuthenticateAsServerAsync(X509Certificate, Boolean, SslProtocols, Boolean) AuthenticateAsServerAsync(X509Certificate, Boolean, SslProtocols, Boolean) AuthenticateAsServerAsync(X509Certificate, Boolean, SslProtocols, Boolean)

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.

public:
 virtual System::Threading::Tasks::Task ^ AuthenticateAsServerAsync(System::Security::Cryptography::X509Certificates::X509Certificate ^ serverCertificate, bool clientCertificateRequired, System::Security::Authentication::SslProtocols enabledSslProtocols, bool checkCertificateRevocation);
public virtual System.Threading.Tasks.Task AuthenticateAsServerAsync (System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, bool clientCertificateRequired, System.Security.Authentication.SslProtocols enabledSslProtocols, bool checkCertificateRevocation);
abstract member AuthenticateAsServerAsync : System.Security.Cryptography.X509Certificates.X509Certificate * bool * System.Security.Authentication.SslProtocols * bool -> System.Threading.Tasks.Task
override this.AuthenticateAsServerAsync : System.Security.Cryptography.X509Certificates.X509Certificate * bool * System.Security.Authentication.SslProtocols * bool -> System.Threading.Tasks.Task
Public Overridable Function AuthenticateAsServerAsync (serverCertificate As X509Certificate, clientCertificateRequired As Boolean, enabledSslProtocols As SslProtocols, checkCertificateRevocation As Boolean) As Task

Parameters

serverCertificate
X509Certificate X509Certificate X509Certificate X509Certificate

The X509Certificate used to authenticate the server.

clientCertificateRequired
Boolean Boolean Boolean Boolean

A Boolean value that specifies whether the client is asked for a certificate for authentication. Note that this is only a request -- if no certificate is provided, the server still accepts the connection request.

enabledSslProtocols
SslProtocols SslProtocols SslProtocols SslProtocols

The SslProtocols value that represents the protocol used for authentication.

checkCertificateRevocation
Boolean Boolean Boolean Boolean

A Boolean value that specifies whether the certificate revocation list is checked during authentication.

Returns

The task object representing the asynchronous operation.

Remarks

Starting with .NET Framework 4.7, this method authenticates using None, which allows the operating system to choose the best protocol to use, and to block protocols that are not secure. In .NET Framework 4.6 (and .NET Framework 4.5 with the latest security patches installed), the allowed TLS/SSL protocols versions are 1.2, 1.1, and 1.0 (unless you disable strong cryptography by editing the Windows Registry).

If the authentication fails, you receive a AuthenticationException, and this 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.

AuthenticateAsServerAsync(X509Certificate, Boolean, Boolean) AuthenticateAsServerAsync(X509Certificate, Boolean, Boolean) AuthenticateAsServerAsync(X509Certificate, Boolean, Boolean) AuthenticateAsServerAsync(X509Certificate, Boolean, Boolean)

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.

public:
 virtual System::Threading::Tasks::Task ^ AuthenticateAsServerAsync(System::Security::Cryptography::X509Certificates::X509Certificate ^ serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation);
public virtual System.Threading.Tasks.Task AuthenticateAsServerAsync (System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation);
abstract member AuthenticateAsServerAsync : System.Security.Cryptography.X509Certificates.X509Certificate * bool * bool -> System.Threading.Tasks.Task
override this.AuthenticateAsServerAsync : System.Security.Cryptography.X509Certificates.X509Certificate * bool * bool -> System.Threading.Tasks.Task
Public Overridable Function AuthenticateAsServerAsync (serverCertificate As X509Certificate, clientCertificateRequired As Boolean, checkCertificateRevocation As Boolean) As Task

Parameters

serverCertificate
X509Certificate X509Certificate X509Certificate X509Certificate

The X509Certificate used to authenticate the server.

clientCertificateRequired
Boolean Boolean Boolean Boolean

A Boolean value that specifies whether the client is asked for a certificate for authentication. Note that this is only a request -- if no certificate is provided, the server still accepts the connection request.

checkCertificateRevocation
Boolean Boolean Boolean Boolean

A Boolean value that specifies whether the certificate revocation list is checked during authentication.

Returns

The task object representing the asynchronous operation.

Remarks

Starting with .NET Framework 4.7, this method authenticates using None, which allows the operating system to choose the best protocol to use, and to block protocols that are not secure. In .NET Framework 4.6 (and .NET Framework 4.5 with the latest security patches installed), the allowed TLS/SSL protocols versions are 1.2, 1.1, and 1.0 (unless you disable strong cryptography by editing the Windows Registry).

If the authentication fails, you receive a AuthenticationException, and this 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.

AuthenticateAsServerAsync(X509Certificate) AuthenticateAsServerAsync(X509Certificate) AuthenticateAsServerAsync(X509Certificate) AuthenticateAsServerAsync(X509Certificate)

Called by servers to authenticate the server and optionally the client in a client-server connection using the specified certificate as an asynchronous operation.

public:
 virtual System::Threading::Tasks::Task ^ AuthenticateAsServerAsync(System::Security::Cryptography::X509Certificates::X509Certificate ^ serverCertificate);
public virtual System.Threading.Tasks.Task AuthenticateAsServerAsync (System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate);
abstract member AuthenticateAsServerAsync : System.Security.Cryptography.X509Certificates.X509Certificate -> System.Threading.Tasks.Task
override this.AuthenticateAsServerAsync : System.Security.Cryptography.X509Certificates.X509Certificate -> System.Threading.Tasks.Task
Public Overridable Function AuthenticateAsServerAsync (serverCertificate As X509Certificate) As Task

Parameters

serverCertificate
X509Certificate X509Certificate X509Certificate X509Certificate

The certificate used to authenticate the server.

Returns

The task object representing the asynchronous operation.

Exceptions

The authentication failed and left this object in an unusable state.

Authentication has already occurred.

-or-

Client authentication using this SslStream was tried previously.

-or-

Authentication is already in progress.

Remarks

Starting with .NET Framework 4.7, this method authenticates using None, which allows the operating system to choose the best protocol to use, and to block protocols that are not secure. In .NET Framework 4.6 (and .NET Framework 4.5 with the latest security patches installed), the allowed TLS/SSL protocols versions are 1.2, 1.1, and 1.0 (unless you disable strong cryptography by editing the Windows Registry).

This method authenticates using Default. The certificate revocation list is not checked during authentication. The client is not required to provide a certificate for authentication.

If the authentication fails, you receive a AuthenticationException, and this 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.

AuthenticateAsServerAsync(SslServerAuthenticationOptions, CancellationToken) AuthenticateAsServerAsync(SslServerAuthenticationOptions, CancellationToken) AuthenticateAsServerAsync(SslServerAuthenticationOptions, CancellationToken)

public:
 System::Threading::Tasks::Task ^ AuthenticateAsServerAsync(System::Net::Security::SslServerAuthenticationOptions ^ sslServerAuthenticationOptions, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task AuthenticateAsServerAsync (System.Net.Security.SslServerAuthenticationOptions sslServerAuthenticationOptions, System.Threading.CancellationToken cancellationToken = null);
member this.AuthenticateAsServerAsync : System.Net.Security.SslServerAuthenticationOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task

Parameters

Returns

Applies to