问题描述
我已经使用openSSL创建了一个公钥/私钥对,并使用openSSL将其转换为一个 *.pfx
文件.然后,我将此文件导入到 Windows可信证书存储区
.
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
.
我现在想通过c ++代码从此证书访问私钥.这可能吗?如果是的话,您能指出我的方向吗?我还没有找到合适的东西.
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.
推荐答案
是的,可以访问私钥.
CertEnumCertificatesInStore 返回 PCCERT_CONTEXT 包含证书的编码和解码表示的结构.将此结构传递给 CryptAcquireCertificatePrivateKey 从证书中获取私钥
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
这篇关于C ++访问受信任的根证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!