Verifies the remote Secure Sockets Layer (SSL) certificate used for authentication.
Assembly: System (in System.dll)
type RemoteCertificateValidationCallback = delegate of sender:Object * certificate:X509Certificate * chain:X509Chain * sslPolicyErrors:SslPolicyErrors -> bool
- 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.
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 class. If there are validation errors, this method displays them and returns false, which prevents communication with the unauthenticated server.
The following code example creates the delegate using the method defined in the preceding code example.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)