具有 Windows 证书存储的 OpenSSL SSL_CTX_use_PrivateKey_file

发布于 2024-09-09 09:30:18 字数 221 浏览 2 评论 0原文

我有一个本机 C++ 库,它使用 OpenSSL 进行 TLS。它使用 SSL_CTX_use_PrivateKey_file 读取私钥,一切都很好,

然后我创建了一个 C# 包装器,它根据某些 OID 和主题名称从 Windows 证书存储中读取证书。 问题是——我可能会获得不止一张证书。我该如何处理呢? 全部尝试一下?

一个 PEM 文件中是否可以保存多个私钥?

非常感谢。

I have a native C++ library which uses OpenSSL for TLS. It reads the private key using SSL_CTX_use_PrivateKey_file and everything is fine,

Then I created a C# wrapper which reads the certificates from Windows certificate store according to certain OIDs and the subject name.
And here is the problem - I might get more than one certificate. How can I deal with that?
Try all of them?

Is it possible to hold more than one private key in a PEM file?

Thank you very much.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

山川志 2024-09-16 09:30:18

您只能向客户端提供一个证书(当然,您可以提供整个证书链,但这是另一回事 - 最终仍然只有一个服务器证书)。因此,您必须找到一种方法来仅选择一个 - 也许选择具有最新到期日期的一个是有意义的?

You can only present one certificate to the client (well, you can present an entire certificate chain, but that's a different thing - there's still only one server certificate in the end). So you'll have to figure out a way to choose just one - perhaps choosing the one with the latest expiry date makes sense?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文