Unable to connect to HTTPS using X509 client certificate

I'm new to cryptography and I'm a bit stuck:

I am trying to connect (from my development environment) to a web service using HTTPS. A web service requires a client certificate, which I think I installed correctly.

They provided me with a .PFX file. In Windows 7, I double-clicked the file to install it in the certificate store of the current user - personal.

Then I exported a file with an X509 Base-64 index encoded with .cer from a certificate entry to the repository. He did not have the private key associated with him.

Then in my application, I try to connect to the service as follows:

var certificate = X509Certificate.CreateFromCertFile("xyz.cer"));
var serviceUrl = "https://xyz";
var request = (HttpWebRequest) WebRequest.Create(serviceUrl);
request.ClientCertificates.Add(certificate);
request.Method = WebRequestMethods.Http.Post;
request.ContentType = "application/x-www-form-urlencoded";

I get connection 502 when connecting fails.

-, ? , , , Windows Server 2003.

!

+3
2

, . .

X509Certificate2 ClientCertificates.Add(). , Import() .pfx ; .cer .

+4

Source: https://habr.com/ru/post/1746931/


All Articles