Reputation: 2214
I have created a public/private key pair with openSSL and converted it into a *.pfx
file with openSSL. I then imported this file into the Windows Trusted Certificate Store
.
I now would like to access the private key from this certificate via c++ code. Is this possible? If yes, can you please point me into a direction? I haven't found anything suitable yet.
Upvotes: 0
Views: 1504
Reputation: 31
Yes it is possible to access the private key.
CertEnumCertificatesInStore returns PCCERT_CONTEXT structure which contain the encoded and decoded representations of certificates. Passing this structure to the CryptAcquireCertificatePrivateKey obtains the private key from the certificate
Upvotes: 1