访问 M2Crypto 中的 CSR 扩展堆栈
我有一个添加了扩展堆栈的证书签名请求。当根据此请求构建证书时,我希望能够访问该堆栈以用于创建最终证书。
然而,虽然 M2Crypto.X509.X509
有许多用于访问扩展的帮助程序(get_ext
、get_ext_at
等),M2Crypto .X509.Request
似乎仅提供用于添加扩展的成员,但无法检查已与给定对象关联的扩展。
我在这里错过了什么吗?
I have a certificate signing request with an extension stack added. When building a certificate based on this request, I would like to be able to access that stack to use in creating the final certificate.
However, while M2Crypto.X509.X509
has a number of helpers for accessing extensions (get_ext
, get_ext_at
and the like), M2Crypto.X509.Request
appears to provide only a member for adding extensions, but no way to inspect the extensions already associated with a given object.
Am I missing something here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你说得对。
当前版本的 M2Crypto 未公开必要的 OpenSSL 接口 -
X509_REQ_get_extensions
。只是为了了解 C 方面涉及的内容:
由于 M2Crypto 使用 SWIG 来包装 C 代码,因此如果您有良好的 C 背景,那么公开新的 API 应该不难。
You're right.
The current version of M2Crypto doesn't expose the necessary OpenSSL interface -
X509_REQ_get_extensions
.Just to give an idea of what's involved in terms of C:
Since M2Crypto uses SWIG to wrap the C code, it shouldn't be difficult to expose a new API if you have a good C background.
对于通过与我来到这里类似的谷歌搜索找到这个问题的其他人。
面对类似的问题,并且没有针对 M2Crypto 缺陷的补丁,我采取了调用 OpenSSL 实用程序并解析输出的方式,它看起来与 YAML 非常相似,我们可以通过一些清理来伪造它。
然后...
等等。
To others finding this question via a similar Google search to what brought me here.
Faced with a similar problem, and no patch to this shortcoming of M2Crypto in sight, I went down the path of calling the OpenSSL utility and parsing the output, which looks similar-enough to YAML that we can fake it with a little cleanup.
Then...
etc.