I am using WCF client to send request to a government API. They gave 2 certificates, the one for 2 way authentication and encryption of SOAP messages, and the other for encryption of outgoing SOAP messages. The problem is that no matter how I try to add these certificates, I am getting SSL error.
If I try with postman, or directly with browser, I can make a call, since I have installed certificates on local machine, so they are working fine.
I tried this:
_wcfClient = new WcfClient();
_wcfClient.ClientCredentials.ClientCertificate.Certificate =
CertificateManager.GetCertificate("certificate");
var response = await _wcfClient.CheckDataAsync();
Also, I just wanted to test with HttpClient without checking server certificate, but still unsuccesfull
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
var handler = new HttpClientHandler();
handler.ClientCertificateOptions = ClientCertificateOption.Manual;
ServicePointManager.ServerCertificateValidationCallback = (sender, cert, chain, sslPolicyErrors) => true;
using (var httpClient = new HttpClient(handler))
{
httpClient.BaseAddress = new Uri("https:.....");
var respons222e = await httpClient.GetAsync("test");
}