Search code examples
c#wcfcertificate

Does ServicePointManager.ServerCertificateValidationCallback overwrite existing certificate validation in .Net?


I'm implementing a WCF client that will use certificates for secure communication. The server will also present a certificate and I would like to implement the ServicePointManager.ServerCertificateValidationCallback simply to log the certificate from the server. Here's an example:

using System.Net;

ServicePointManager.ServerCertificateValidationCallback += RemoteCertificateValidate;

private bool RemoteCertificateValidate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error)
{
    // certificate logging goes here
}

My question is this, will the default certificate validation that is done by the .Net framwork still happen? Or will my implementation of the ServerCertificateValidationCallback overwrite the .Net certificate validation?


Solution

  • As I know the default certificate validation is done prior to the ServerCertificateValidationCallback.

    You can follow this link for more information.