Bewerken

Share via


SslStream.AuthenticateAsServer Method

Definition

Called by servers to authenticate the server and optionally the client in a client-server connection.

Overloads

AuthenticateAsServer(SslServerAuthenticationOptions)

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

AuthenticateAsServer(X509Certificate)

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

AuthenticateAsServer(X509Certificate, Boolean, Boolean)

Called by servers to authenticate the server and optionally the client in a client-server connection using the specified certificates and requirements, and using the system default security protocol.

AuthenticateAsServer(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.

AuthenticateAsServer(SslServerAuthenticationOptions)

Source:
SslStream.cs
Source:
SslStream.cs
Source:
SslStream.cs

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

public:
 void AuthenticateAsServer(System::Net::Security::SslServerAuthenticationOptions ^ sslServerAuthenticationOptions);
public void AuthenticateAsServer (System.Net.Security.SslServerAuthenticationOptions sslServerAuthenticationOptions);
member this.AuthenticateAsServer : System.Net.Security.SslServerAuthenticationOptions -> unit
Public Sub AuthenticateAsServer (sslServerAuthenticationOptions As SslServerAuthenticationOptions)

Parameters

sslServerAuthenticationOptions
SslServerAuthenticationOptions

The property bag for the SSL connection.

Exceptions

serverCertificate is null.

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.

This object has been closed.

The AuthenticateAsServer method is not supported on Windows 95, Windows 98, or Windows Millennium.

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). The certificate revocation list is not checked during authentication. The client is not required to provide a certificate for authentication.

This method blocks until the operation completes. To prevent blocking until the operation completes, use one of the BeginAuthenticateAsServer method overloads.

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.

Applies to

AuthenticateAsServer(X509Certificate)

Source:
SslStream.cs
Source:
SslStream.cs
Source:
SslStream.cs

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

public:
 virtual void AuthenticateAsServer(System::Security::Cryptography::X509Certificates::X509Certificate ^ serverCertificate);
public virtual void AuthenticateAsServer (System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate);
abstract member AuthenticateAsServer : System.Security.Cryptography.X509Certificates.X509Certificate -> unit
override this.AuthenticateAsServer : System.Security.Cryptography.X509Certificates.X509Certificate -> unit
Public Overridable Sub AuthenticateAsServer (serverCertificate As X509Certificate)

Parameters

serverCertificate
X509Certificate

The certificate used to authenticate the server.

Exceptions

serverCertificate is null.

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.

This object has been closed.

The AuthenticateAsServer method is not supported on Windows 95, Windows 98, or Windows Millennium.

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). The certificate revocation list is not checked during authentication. The client is not required to provide a certificate for authentication.

This method blocks until the operation completes. To prevent blocking until the operation completes, use one of the BeginAuthenticateAsServer method overloads.

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.

Applies to

AuthenticateAsServer(X509Certificate, Boolean, Boolean)

Source:
SslStream.cs
Source:
SslStream.cs
Source:
SslStream.cs

Called by servers to authenticate the server and optionally the client in a client-server connection using the specified certificates and requirements, and using the system default security protocol.

public:
 virtual void AuthenticateAsServer(System::Security::Cryptography::X509Certificates::X509Certificate ^ serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation);
public virtual void AuthenticateAsServer (System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation);
abstract member AuthenticateAsServer : System.Security.Cryptography.X509Certificates.X509Certificate * bool * bool -> unit
override this.AuthenticateAsServer : System.Security.Cryptography.X509Certificates.X509Certificate * bool * bool -> unit
Public Overridable Sub AuthenticateAsServer (serverCertificate As X509Certificate, clientCertificateRequired As Boolean, checkCertificateRevocation As Boolean)

Parameters

serverCertificate
X509Certificate

The X509Certificate used to authenticate the server.

clientCertificateRequired
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

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

Exceptions

serverCertificate is null.

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.

This object has been closed.

The AuthenticateAsServer method is not supported on Windows 95, Windows 98, or Windows Millennium.

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 blocks until the operation completes. To prevent blocking until the operation completes, use one of the BeginAuthenticateAsServer method overloads.

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.

Applies to

AuthenticateAsServer(X509Certificate, Boolean, SslProtocols, Boolean)

Source:
SslStream.cs
Source:
SslStream.cs
Source:
SslStream.cs

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

public:
 virtual void AuthenticateAsServer(System::Security::Cryptography::X509Certificates::X509Certificate ^ serverCertificate, bool clientCertificateRequired, System::Security::Authentication::SslProtocols enabledSslProtocols, bool checkCertificateRevocation);
public virtual void AuthenticateAsServer (System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, bool clientCertificateRequired, System.Security.Authentication.SslProtocols enabledSslProtocols, bool checkCertificateRevocation);
abstract member AuthenticateAsServer : System.Security.Cryptography.X509Certificates.X509Certificate * bool * System.Security.Authentication.SslProtocols * bool -> unit
override this.AuthenticateAsServer : System.Security.Cryptography.X509Certificates.X509Certificate * bool * System.Security.Authentication.SslProtocols * bool -> unit
Public Overridable Sub AuthenticateAsServer (serverCertificate As X509Certificate, clientCertificateRequired As Boolean, enabledSslProtocols As SslProtocols, checkCertificateRevocation As Boolean)

Parameters

serverCertificate
X509Certificate

The X509Certificate used to authenticate the server.

clientCertificateRequired
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

The SslProtocols value that represents protocols used for authentication.

checkCertificateRevocation
Boolean

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

Exceptions

serverCertificate is null.

enabledSslProtocols is not a valid SslProtocols value.

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.

This object has been closed.

The AuthenticateAsServer method is not supported on Windows 95, Windows 98, or Windows Millennium.

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 blocks until the operation completes. To prevent blocking until the operation completes, use one of the BeginAuthenticateAsServer method overloads.

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.

Applies to