RemoteCertificateValidationCallback Delegate


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Verifies the remote Secure Sockets Layer (SSL) certificate used for authentication.

Namespace:   System.Net.Security
Assembly:  System (in System.dll)

Public Delegate Function RemoteCertificateValidationCallback (
	sender As Object,
	certificate As X509Certificate,
	chain As X509Chain,
	sslPolicyErrors As SslPolicyErrors
) As Boolean


Type: System.Object

An object that contains state information for this validation.

Type: System.Security.Cryptography.X509Certificates.X509Certificate

The certificate used to authenticate the remote party.

Type: System.Security.Cryptography.X509Certificates.X509Chain

The chain of certificate authorities associated with the remote certificate.

Type: System.Net.Security.SslPolicyErrors

One or more errors associated with the remote certificate.

Return Value

Type: System.Boolean

A Boolean value that determines whether the specified certificate is accepted for authentication.

The delegate's sslPolicyErrors argument contains any certificate errors returned by SSPI while authenticating the client or server. The Boolean value returned by the method invoked by this delegate determines whether the authentication is allowed to succeed.

This delegate is used with the SslStream class.

The following code example implements a method that is invoked by an instance of the RemoteCertificateValidationCallback class. If there are validation errors, this method displays them and returns false, which prevents communication with the unauthenticated server.

No code example is currently available or this language may not be supported.

The following code example creates the delegate using the method defined in the preceding code example.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top