具有 Windows 证书存储的 OpenSSL SSL_CTX_use_PrivateKey_file
我有一个本机 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您只能向客户端提供一个证书(当然,您可以提供整个证书链,但这是另一回事 - 最终仍然只有一个服务器证书)。因此,您必须找到一种方法来仅选择一个 - 也许选择具有最新到期日期的一个是有意义的?
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?