![](/img/trans.png)
[英]Python requests not looking into /etc/ssl/certs for self-signed certificates
[英]Create self signed SSL certificates in Python
您鏈接的腳本不會創建自簽名證書。 它只會創建一個請求。
要創建自簽名證書,可以使用openssl
該證書在所有主要操作系統上都可用。
$ openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095
如果您想使用M2Crypto進行操作,請查看X509TestCase.test_mkcert()
方法 。
您可以使用JF Sebastian在Python中聲明的openssl方法。
導入操作系統庫並按如下所示調用命令:
os.system("openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095")
如果需要用戶交互,則通過子進程管道運行它並允許原始輸入來回答任何提示,則可能會起作用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.