【发布时间】:2015-10-01 09:50:42
【问题描述】:
我正在尝试使用我的自签名证书在 python 中构建一个简单的服务器。 我使用 makecert 创建了 .cer、.pfx、.pvk 文件。
context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
context.load_cert_chain(certfile="ServerSSL.cer")
Traceback (most recent call last):
File "ssl_server.py", line 4, in <module>
context.load_cert_chain(certfile="ServerSSL.cer")
ssl.SSLError: [SSL] PEM lib (_ssl.c:2580)
我做错了什么? 我还尝试通过更改后缀将我的 cer 文件转换为 pem,但我得到了同样的错误。
【问题讨论】:
-
使用的是什么Python版本?
-
我的python版本是2.7.10 32bit
-
你检查过这个 (docs.python.org/2/library/ssl.html)
-
是的,我从那里获取了我的代码。