संपादित करें

इसके माध्यम से साझा किया गया


SslStream.BeginAuthenticateAsServer Method

Definition

Begins an asynchronous operation to handle the server side of authenticating a client-server connection.

Overloads

BeginAuthenticateAsServer(X509Certificate, AsyncCallback, Object)

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

BeginAuthenticateAsServer(X509Certificate, Boolean, Boolean, AsyncCallback, Object)

Called by servers to begin an asynchronous operation to authenticate the server and optionally the client using the specified certificates and requirements, and the system default security protocol.

BeginAuthenticateAsServer(X509Certificate, Boolean, SslProtocols, Boolean, AsyncCallback, Object)

Called by servers to begin an asynchronous operation to authenticate the server and optionally the client using the specified certificates, requirements and security protocol.

Remarks

The overloads of this method do not block while authentication is in progress. To block while waiting for the authentication to complete, use one of the AuthenticateAsServer methods.

BeginAuthenticateAsServer(X509Certificate, AsyncCallback, Object)

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

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

public:
 virtual IAsyncResult ^ BeginAuthenticateAsServer(System::Security::Cryptography::X509Certificates::X509Certificate ^ serverCertificate, AsyncCallback ^ asyncCallback, System::Object ^ asyncState);
public virtual IAsyncResult BeginAuthenticateAsServer (System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, AsyncCallback? asyncCallback, object? asyncState);
public virtual IAsyncResult BeginAuthenticateAsServer (System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, AsyncCallback asyncCallback, object asyncState);
abstract member BeginAuthenticateAsServer : System.Security.Cryptography.X509Certificates.X509Certificate * AsyncCallback * obj -> IAsyncResult
override this.BeginAuthenticateAsServer : System.Security.Cryptography.X509Certificates.X509Certificate * AsyncCallback * obj -> IAsyncResult
Public Overridable Function BeginAuthenticateAsServer (serverCertificate As X509Certificate, asyncCallback As AsyncCallback, asyncState As Object) As IAsyncResult

Parameters

serverCertificate
X509Certificate

The X509Certificate used to authenticate the server.

asyncCallback
AsyncCallback

An AsyncCallback delegate that references the method to invoke when the authentication is complete.

asyncState
Object

A user-defined object that contains information about the operation. This object is passed to the asyncCallback delegate when the operation completes.

Returns

An IAsyncResult object indicating the status of the asynchronous operation.

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 BeginAuthenticateAsServer 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.

The asynchronous authentication operation must be completed by calling the EndAuthenticateAsClient method. Typically, the method is invoked by the asyncCallback delegate.

This method does not block while the operation completes. To block until the operation completes, use one of the AuthenticateAsClient method overloads.

For detailed information about using the asynchronous programming model, see Calling Synchronous Methods Asynchronously

If you receive a AuthenticationException, 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

BeginAuthenticateAsServer(X509Certificate, Boolean, Boolean, AsyncCallback, Object)

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

Called by servers to begin an asynchronous operation to authenticate the server and optionally the client using the specified certificates and requirements, and the system default security protocol.

public:
 virtual IAsyncResult ^ BeginAuthenticateAsServer(System::Security::Cryptography::X509Certificates::X509Certificate ^ serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation, AsyncCallback ^ asyncCallback, System::Object ^ asyncState);
public virtual IAsyncResult BeginAuthenticateAsServer (System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation, AsyncCallback? asyncCallback, object? asyncState);
public virtual IAsyncResult BeginAuthenticateAsServer (System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState);
abstract member BeginAuthenticateAsServer : System.Security.Cryptography.X509Certificates.X509Certificate * bool * bool * AsyncCallback * obj -> IAsyncResult
override this.BeginAuthenticateAsServer : System.Security.Cryptography.X509Certificates.X509Certificate * bool * bool * AsyncCallback * obj -> IAsyncResult
Public Overridable Function BeginAuthenticateAsServer (serverCertificate As X509Certificate, clientCertificateRequired As Boolean, checkCertificateRevocation As Boolean, asyncCallback As AsyncCallback, asyncState As Object) As IAsyncResult

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.

asyncCallback
AsyncCallback

An AsyncCallback delegate that references the method to invoke when the authentication is complete.

asyncState
Object

A user-defined object that contains information about the operation. This object is passed to the asyncCallback delegate when the operation completes.

Returns

An IAsyncResult object that indicates the status of the asynchronous operation.

Exceptions

serverCertificate is null.

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

Authentication has already occurred.

-or-

Server authentication using this SslStream was tried previously.

-or-

Authentication is already in progress.

This object has been closed.

The BeginAuthenticateAsServer 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 asynchronous authentication operation must be completed by calling the EndAuthenticateAsServer method. Typically, the method is invoked by the asyncCallback delegate.

This method does not block while the operation completes. To block until the operation completes, use one of the AuthenticateAsServer method overloads.

For detailed information about using the asynchronous programming model, see Calling Synchronous Methods Asynchronously

If you receive a AuthenticationException, 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

BeginAuthenticateAsServer(X509Certificate, Boolean, SslProtocols, Boolean, AsyncCallback, Object)

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

Called by servers to begin an asynchronous operation to authenticate the server and optionally the client using the specified certificates, requirements and security protocol.

public:
 virtual IAsyncResult ^ BeginAuthenticateAsServer(System::Security::Cryptography::X509Certificates::X509Certificate ^ serverCertificate, bool clientCertificateRequired, System::Security::Authentication::SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback ^ asyncCallback, System::Object ^ asyncState);
public virtual IAsyncResult BeginAuthenticateAsServer (System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, bool clientCertificateRequired, System.Security.Authentication.SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback? asyncCallback, object? asyncState);
public virtual IAsyncResult BeginAuthenticateAsServer (System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, bool clientCertificateRequired, System.Security.Authentication.SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState);
abstract member BeginAuthenticateAsServer : System.Security.Cryptography.X509Certificates.X509Certificate * bool * System.Security.Authentication.SslProtocols * bool * AsyncCallback * obj -> IAsyncResult
override this.BeginAuthenticateAsServer : System.Security.Cryptography.X509Certificates.X509Certificate * bool * System.Security.Authentication.SslProtocols * bool * AsyncCallback * obj -> IAsyncResult
Public Overridable Function BeginAuthenticateAsServer (serverCertificate As X509Certificate, clientCertificateRequired As Boolean, enabledSslProtocols As SslProtocols, checkCertificateRevocation As Boolean, asyncCallback As AsyncCallback, asyncState As Object) As IAsyncResult

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.

asyncCallback
AsyncCallback

An AsyncCallback delegate that references the method to invoke when the authentication is complete.

asyncState
Object

A user-defined object that contains information about the operation. This object is passed to the asyncCallback delegate when the operation completes.

Returns

An IAsyncResult object that indicates the status of the asynchronous operation.

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-

Server authentication using this SslStream was tried previously.

-or-

Authentication is already in progress.

This object has been closed.

The BeginAuthenticateAsServer 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 asynchronous authentication operation must be completed by calling the EndAuthenticateAsServer method. Typically, the method is invoked by the asyncCallback delegate.

This method does not block while the operation completes. To block until the operation completes, use one of the AuthenticateAsServer method overloads.

For detailed information about using the asynchronous programming model, see Calling Synchronous Methods Asynchronously

If you receive a AuthenticationException, 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