简体   繁体   English

pyelliptic.ECC()上的“ OpenSSL:EC_KEY_generate_key失败…错误:00000000:lib(0):func(0):reason(0)”

[英]“OpenSSL: EC_KEY_generate_key FAIL … error:00000000:lib(0):func(0):reason(0)” on pyelliptic.ECC()

I'm getting the above error while using pyelliptic (versions given below). 我在使用pyelliptic (下面给出的版本)时遇到上述错误。

The python code which triggers it: 触发它的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:])

The "Salt: ..." message is displayed okay, the error is in the pyelliptic.ECC() call. 正常显示"Salt: ..."消息,该错误是在pyelliptic.ECC()调用中。

Traceback: 追溯:

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())

The error(s) I get are (the 2nd one may or may not be relevant): 我得到的错误是(第二个可能或可能不相关):

  1. Exception('[OpenSSL] EC_KEY_generate_key FAIL ... error:00000000:lib(0):func(0):reason(0)',) (Ref. File Link: https://github.com/yann2192/pyelliptic/blob/master/pyelliptic/ecc.py#L214 ) 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.

Requirements.txt (partial): Requirements.txt(部分):

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

https://github.com/yann2192/pyelliptic/issues/39 says that pyelliptic v1.5.7 has some issues with old versions (Not sure if this is applicable here). https://github.com/yann2192/pyelliptic/issues/39pyelliptic v1.5.7旧版本存在一些问题(不确定是否适用于此)。

Other Details: 其他详情:

Python Version: 2.7. Python版本:2.7。

Getting this error only on Google Compute Engine VM Instance. 仅在Google Compute Engine VM实例上获取此错误。

Working Fine on Local Development Server. 在本地开发服务器上工作正常。 Working Fine from python shell too Google Compute Engine VM. Google Compute Engine VM也可以从python shell正常工作。

(The question is a follow-up of 'EntryPoint' object has no attribute 'resolve' when using Google Compute Engine , the discussion there might be of use) (问题是使用Google Compute Engine时'EntryPoint'对象没有属性'resolve'的后续操作,讨论可能有用)

Just added the following: WSGIApplicationGroup %{GLOBAL} 刚刚添加了以下内容: WSGIApplicationGroup %{GLOBAL}

in /etc/apache2/sites-available/default-ssl.conf file and all these errors got resolved. /etc/apache2/sites-available/default-ssl.conf文件中,所有这些错误均已解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM