对SSL_CTX_use_PrivateKey_file绑定的Python调用挂起

时间:2018-11-06 14:17:40

标签: python openssl python-requests zeep

我正在使用Zeep封装WSDL文件,并尝试挂接到远程Web服务中。它利用SSLv3,正试图加载从Web服务提供商为我创建的PFX文件中提取的私钥。

我已经看到其他人在加载受密码保护的程度的私钥(调用OpenSSL函数SSL_CTX_use_PrivateKey_file)时遇到问题,但这似乎会导致错误。就我而言,私钥的格式似乎正确,没有密码保护,但是对上述绑定的Python调用只是挂起了。到此为止的堆栈跟踪如下:

-> return self._client.service.MarketInfo(Header=header, Request=req)
  c:\users\phennings\venvs\ercot-ews-py-3.6.7-x64\lib\site- packages\zeep\proxy.py(42)__call__()
-> self._op_name, args, kwargs)
  c:\users\phennings\venvs\ercot-ews-py-3.6.7-x64\lib\site- packages\zeep\wsdl\bindings\soap.py(124)send()
-> options['address'], envelope, http_headers)
  c:\users\phennings\venvs\ercot-ews-py-3.6.7-x64\lib\site-packages\zeep\transports.py(95)post_xml()
-> return self.post(address, message, headers)
  c:\users\phennings\venvs\ercot-ews-py-3.6.7-x64\lib\site-packages\zeep\transports.py(67)post()
-> timeout=self.operation_timeout)
  c:\users\phennings\venvs\ercot-ews-py-3.6.7-x64\lib\site-packages\requests\sessions.py(572)post()
-> return self.request('POST', url, data=data, json=json, **kwargs)
  c:\users\phennings\venvs\ercot-ews-py-3.6.7-x64\lib\site-packages\requests\sessions.py(524)request()
-> resp = self.send(prep, **send_kwargs)
  c:\users\phennings\venvs\ercot-ews-py-3.6.7-x64\lib\site-packages\requests\sessions.py(637)send()
-> r = adapter.send(request, **kwargs)
  c:\users\phennings\venvs\ercot-ews-py-3.6.7-x64\lib\site-packages\requests\adapters.py(449)send()
-> timeout=timeout
  c:\users\phennings\venvs\ercot-ews-py-3.6.7-x64\lib\site-packages\urllib3\connectionpool.py(600)urlopen()
-> chunked=chunked)
  c:\users\phennings\venvs\ercot-ews-py-3.6.7-x64\lib\site-packages\urllib3\connectionpool.py(343)_make_request()
-> self._validate_conn(conn)
  c:\users\phennings\venvs\ercot-ews-py-3.6.7-x64\lib\site-packages\urllib3\connectionpool.py(839)_validate_conn()
-> conn.connect()
  c:\users\phennings\venvs\ercot-ews-py-3.6.7-x64\lib\site-packages\urllib3\connection.py(344)connect()
-> ssl_context=context)
> c:\users\phennings\venvs\ercot-ews-py-3.6.7-x64\lib\site-packages\urllib3\util\ssl_.py(333)ssl_wrap_socket()
-> context.load_cert_chain(certfile, keyfile)
  c:\users\phennings\venvs\ercot-ews-py-3.6.7-x64\lib\site-packages\urllib3\contrib\pyopenssl.py(436)load_cert_chain()
-> self._ctx.use_privatekey_file(keyfile or certfile)
  c:\users\phennings\venvs\ercot-ews-py-3.6.7-x64\lib\site-packages\openssl\ssl.py(993)use_privatekey_file()
-> use_result = _lib.SSL_CTX_use_PrivateKey_file(

没有任何错误,我真的不确定如何从此处继续进行故障排除。 Google搜索函数SSL_CTX_use_PrivateKey_file似乎只会产生引发某种错误的问题。

有人对下一步该有什么好的建议吗?

0 个答案:

没有答案