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;
我有與上面的代碼的問題是,所述RemoteCertificateValidationCallback只接受舊x509證書不X509Certificate2類型作爲參數。我需要X509Certificate2,因爲我發送SOAP請求的第三方API需要版本2.RemoteCertificateValidationCallback與X509Certificate2