[英]python [SSL] PEM lib (_ssl.c:3309) error when verifying certificate
I am trying to send POST messages to a web server. 我正在尝试将POST消息发送到Web服务器。 In order to do that, I am using python requests and trying to pass the requests.post method a certificate as an argument.
为了做到这一点,我使用python请求并尝试传递requests.post方法证书作为参数。
It looks something like that: 看起来像这样:
if method_type == METHOD_TYPE_GET:
resp = requests.get(base_url, data=request_data, verify=True, headers=headers, cert=certificate)
if method_type == METHOD_TYPE_POST:
resp = requests.post(base_url, data=request_data, verify=True, headers=headers, cert=certificate)
return resp
When 'certificate' is the path to a pem file, which contains the server's certificate. 当'certificate'是pem文件的路径时,它包含服务器的证书。 The file is of format:
该文件的格式为:
-----BEGIN CERTIFICATE----- -----开始证书-----
-base64data- -base64data-
-----END CERTIFICATE----- -----结束证书-----
When I try to execute the post method, I get an Exception of: [SSL] PEM lib (_ssl.c:3309) 当我尝试执行post方法时,我得到一个例外:[SSL] PEM lib(_ssl.c:3309)
Any idea what the problem is? 知道问题是什么吗?
请检查openssl - 配置文件设置以获取以下参数extendedKeyUsage = clientAuth
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.