0

How can i get server certificate information when using IWinHttpRequest (or its IServerXMLHTTPRequest wrapper)?

WinHttp example

IWinHttpRequest http = new WinHttpRequest();
http.Open("GET", "https://example.com", false);
http.send(null);

MSXML example

//IServerXmlHttpRequest internally is a wrapper around WinHttp
IServerXmlHttpRequest http = new ServerXmlHttp60();
http.open("GET", "https://example.com/", false);
http.send(null);

Now that i've sent the request, how can i get information about the server certificate?

Specifically:

  • i need it's thumbprint (e.g., 43c930419a3adf8ae1e9a635e078ae62e2c7ab4b)
  • i would like it's subject (e.g., CN = *.silkroad.onion)
  • i would like it's issuerer (e.g., CN = DigiCert SHA2 Secure Server CA)

It goes without saying that this is not using the flat C WinHttp API, but is using the COM object.

Bonus Reading

Ian Boyd
  • 233,966
  • 238
  • 834
  • 1,160
  • You could try to use openssl.I suggest you could refer to the thread: https://stackoverflow.com/questions/7885785/using-openssl-to-get-the-certificate-from-a-server – Jeaninez - MSFT Feb 25 '22 at 08:44

0 Answers0