Windows上的OpenSSL是否可以使用系统证书存储区? [英] Can OpenSSL on Windows use the system certificate store?

查看:444
本文介绍了Windows上的OpenSSL是否可以使用系统证书存储区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从Windows移植到Windows的一些工作C ++代码在Windows上失败,因为 SSL_get_verify_result()正在返回 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY

Some working C++ code that I'm porting from Linux to Windows is failing on windows because SSL_get_verify_result() is returning X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY.

代码在Linux上使用 SSL_CTX_set_default_verify_paths()来告诉SSL只查看标准默认位置

The code was using SSL_CTX_set_default_verify_paths() on Linux to tell SSL to just look in the standard default locations for the certificate store.

是否可以让OpenSSL使用系统证书存储?

Is it possible to get OpenSSL to use the system certificate store?

推荐答案

我之前做过。


  1. 加载您的证书(在 PCCERT_CONTEXT 结构)。

  2. 以二进制格式获取加密内容。 PCCERT_CONTEXT-> pbCertEncoded ]。

  3. 将此二进制缓冲区解析为X509证书对象,使用OpenSSL的 d2i_X509 )方法。

  4. 使用 SSL_CTX_get_cert_store()方法获取OpenSSL信任库的处理。
  5. 使用 X509_STORE_add_cert()方法将以上解析的X509证书加载到此信任存储库中。


  1. Load your certificate (in PCCERT_CONTEXT structure) from Windows Cert store using Crypto APIs.
  2. Get encrypted content of it in binary format as it is. [PCCERT_CONTEXT->pbCertEncoded].
  3. Parse this binary buffer into X509 certificate Object using OpenSSL's d2i_X509() method.
  4. Get handle to OpenSSL's trust store using SSL_CTX_get_cert_store() method.
  5. Load above parsed X509 certificate into this trust store using X509_STORE_add_cert() method.
  6. You are done!

这篇关于Windows上的OpenSSL是否可以使用系统证书存储区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆