How to use a certificate with ssl to connect to webservice through https: //

I am new to this area ... How to use a certificate with ssl to connect to webservice via https: //? What are the next steps. I already have a signed certificate that is already installed on the remote server.

Any idea?

I would like to do this in C #. Should I use OpenSSL.NET?

Yours faithfully,

Eric Cariggio

+3
source share
1 answer

If you use C #, the class HttpWebRequesthas a collection property clientCertificates. In short, before submitting a request, you add your certificate to this collection.

Do you want to make some stream along the lines

  • ( /

#:

  • -
  • cert clientCertificates

(, 100%):

// instanstiate request
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requestUrl);

// access keystore, find your cert
X509Store keystore = new X509Store("My", StoreLocation.CurrentUser);
X509CertificateCollection certs = keystore.Certificates.Find(X509FindType.FindBySubjectName, "Name Of Cert", true);

// add cert to request object
req.ClientCertificates = certs;


// continue with preparing the request and submitting
+4

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


All Articles