1

一段时间以来,我在使用 oauth2client 时遇到了这个讨厌的“ctype 'EVP_MD_CTX *' 的初始化程序必须是指向同一类型的指针,而不是 cdata 'EVP_MD_CTX *'”的错误(使用 p12 或 pem 证书文件的服务帐户) .

在 WSGI 下运行 django 项目时会发生这种情况。我从来没有让它发生在外壳上。

package versions:
google-api-python-client==1.3.1
pyOpenSSL==0.14
oauth2client==1.3.2
cryptography==0.6.1

相关的堆栈跟踪(直到那时我已经创建了 SignedJwtAssertionCredentials 并在 http 对象上完成了 authorize() ):

File "gdrive/models.py", line 292, in create_service
  return build("drive", "v2", http=http)
File "oauth2client/util.py", line 129, in positional_wrapper
  return wrapped(*args, **kwargs)
File "googleapiclient/discovery.py", line 198, in build
  resp, content = http.request(requested_url)
File "oauth2client/util.py", line 129, in positional_wrapper
  return wrapped(*args, **kwargs)
File "oauth2client/client.py", line 516, in new_request
  self._refresh(request_orig)
File "oauth2client/client.py", line 728, in _refresh
  self._do_refresh_request(http_request)
File "oauth2client/client.py", line 752, in _do_refresh_request
  body = self._generate_refresh_request_body()
File "oauth2client/client.py", line 1275, in _generate_refresh_request_body
  assertion = self._generate_assertion()
File "oauth2client/client.py", line 1402, in _generate_assertion
  private_key, self.private_key_password), payload)
File "oauth2client/crypt.py", line 312, in make_signed_jwt
  signature = signer.sign(signing_input)
File "oauth2client/crypt.py", line 109, in sign
  return crypto.sign(self._key, message, 'sha256')
File "OpenSSL/crypto.py", line 2091, in sign
  _lib.EVP_SignInit(md_ctx, digest_obj)

在那里引发了异常。

关于为什么会出现此错误的任何想法?

谢谢,马克

4

0 回答 0