"OpenSSL: EC_KEY_generate_key FAIL ... error:00000000:lib(0):func(0):reason(0)"在肾盂上。ECC()



我在使用pyelliptic(版本如下)时得到上述错误。

触发它的python代码:

print("Salt: %s" % salt)
server_key = pyelliptic.ECC(curve="prime256v1")  # ----->> Line2
print("Server_key: %s" % server_key)   # ----->> Line3
server_key_id = base64.urlsafe_b64encode(server_key.get_pubkey()[1:])

"Salt: ..."消息显示ok,错误在pyelliptic.ECC()呼叫。

回溯:

File "/usr/local/lib/python2.7/dist-packages/pyelliptic/ecc.py", line 89, in __init__
self.privkey, self.pubkey_x, self.pubkey_y = self._generate()
File "/usr/local/lib/python2.7/dist-packages/pyelliptic/ecc.py", line 231, in _generate
raise Exception("[OpenSSL] EC_KEY_generate_key FAIL ... " + OpenSSL.get_error())

我得到的错误是(第二个可能相关,也可能不相关):

  1. Exception('[OpenSSL] EC_KEY_generate_key FAIL ... error:00000000:lib(0):func(0):reason(0)',)(参考文件链接:https://github.com/yann2192/pyelliptic/blob/master/pyelliptic/ecc.py#L214)
  2. extern "Python": function Cryptography_rand_bytes() called, but @ffi.def_extern() was not called in the current subinterpreter. Returning 0.

让(部分):

setuptools==27.1.2
cryptography==1.5
pyelliptic==1.5.7
pyOpenSSL==16.1.0

https://github.com/yann2192/pyelliptic/issues/39说pyelliptic v1.5.7与旧版本有一些问题(不确定这是否适用于这里)。

其他细节:

Python版本:2.7.

仅在Google Compute Engine VM实例上出现此错误。

在本地开发服务器上工作良好。

从python shell到Google Compute Engine VM运行良好。

(问题是'EntryPoint'对象没有属性'resolve'当使用谷歌计算引擎时,这里的讨论可能会有用)

刚刚添加了以下内容:WSGIApplicationGroup %{GLOBAL}

/etc/apache2/sites-available/default-ssl.conf文件和所有这些错误得到解决。

最新更新