是否可以使用 pyOpenSSL 设置 subjectAltName? [英] Is it possible to set subjectAltName using pyOpenSSL?
问题描述
我需要使用 pyOpenSSL 从 Python 生成 SSL 证书.有谁知道是否可以设置subjectAltName?从文档(https://pythonhosted.org/pyOpenSSL/api/crypto.html#x509-objects) 似乎并非如此.实际上只提供了一个 set_subject 方法.有没有办法将其添加到证书中?
I need to generate SSL certificates from Python using pyOpenSSL. Does anyone know if it's possible to set subjectAltName? From the documentation (https://pythonhosted.org/pyOpenSSL/api/crypto.html#x509-objects) it doesn't seem so. In fact, only a set_subject method is provided. Is there any way to add that to the certificate?
推荐答案
我最终解决了它.我错过了 subjectAltName 被认为是标准扩展.所以可以使用pyOpenSSL的add_extensions方法添加.
I eventually solved it. I'd missed that subjectAltName is considered a standard extension. So it can be added using pyOpenSSL's method add_extensions.
更多信息可以在 https://www.openssl.org/docs/apps/x509v3_config.html#STANDARD_EXTENSIONS
这篇关于是否可以使用 pyOpenSSL 设置 subjectAltName?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!