I am using IXMLHTTPRequest3 from C++ code to issue a request to a service. This request needs to be accompanied by a client certificate (which is just about the only thing that IXHR3 adds over IXHR2).
The certificate's thumbprint is 8D1CC03002D7872230516B5C5BA1090084D68ED0, and I have verified that it is installed on the computer:
PS> dir cert:\*\*\* | ? { $_.Thumbprint -eq "8D1CC03002D7872230516B5C5BA1090084D68ED0" }
Directory: Microsoft.PowerShell.Security\Certificate::LocalMachine\My
Thumbprint Subject
---------- -------
8D1CC03002D7872230516B5C5BA1090084D68ED0 DC=..., O=..., OU=...
However, when I try to pass that thumbprint to IXHR3->SetClientCertificate
, I get back 0x80092004, CRYPT_E_NOT_FOUND
.
I converted the hash from a hex string to a 20-byte array (through automation to avoid transposition mistakes on my end) and my invocation looks like this:
uint8_t thumbprint[20] = { 0x8d, 0x1c, 0xc0, 0x30, ... };
hr = request->SetClientCertificate(ARRAYSIZE(thumbprint), thumbprint, nullptr);
The question, clearly, is: why can't IXHR3 find my client certificate?
IXHR3 only looks for certificates in CERT_STORE_PROV_SYSTEM
-> CERT_SYSTEM_STORE_CURRENT_USER
, and mine was in CERT_SYSTEM_STORE_LOCAL_MACHINE
instead.
User contributions licensed under CC BY-SA 3.0