I want to get a private key from windows store and convert it to PEM in order to use it in OpenSSL. I've been looking for a way to do that for a few hours!
- I use CertFindCertificateInStore() to get CERT_CONTEXT (which I know it contains the private key using the search parameter).
- Next, I used CryptAcquireCertificatePrivateKey() to get HCRYPTPROV (just because of the name of the function).
- Now, I use CryptGetUserKey() to get HCRYPTKEY (just because it sounds right...?!)
But now I'm stuck again.
I think this is security by obscurity done by Microsoft to make sure we will never be able to get private keys.