RemoteCertificateValidationCallback with X509Certificate2
<pre><code>    X509Certificate2 certificate = new X509Certificate2();
    FileStream fileStream = File.Open(@"C:\openssl\bin\cert_key.p12", FileMode.Open, FileAccess.Read);
    byte[] buffer = new byte[fileStream.Length];

    ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(certificate.ValidateRemoteCertificate);
    Client.ClientCredentials.ClientCertificate.Certificate = certificate;
</code></pre>

<p>The problem I have with the above code is that the RemoteCertificateValidationCallback only accepts the older X509Certificate not X509Certificate2 type as a parameter.  I need X509Certificate2 because the third-party API that I send SOAP request to requires version 2.</p>
