我在使用pyelliptic
時收到上述錯誤)。pyelliptic.ECC()上的「OpenSSL:EC_KEY_generate_key失敗...錯誤:00000000:lib(0):func(0):reason(0)」
觸發它的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: ..."
的消息,該錯誤是在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())
錯誤(S)我得到的是(注:第二個可能會或可能不相關):
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)extern "Python": function Cryptography_rand_bytes() called, but @ffi.def_extern() was not called in the current subinterpreter. Returning 0.
Requirements.txt(部分):
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' object has no attribute 'resolve' when using Google Compute Engine後續的討論有可能是使用的)
好的,我們走吧。你說你得到一個異常,但代碼不會停止?是否執行了下列代碼行('print(「Server_key:<...>'))?如果」error「實際上是一個Django錯誤日誌條目,[這裏是如何包含一個堆棧跟蹤到它](http://stackoverflow.com/questions/) 5886275/print-a-stack-trace-to-stdout-on-errors-in-django-while-using-manage-py-runserve) –
代碼停在Line2本身,Line3根本不被執行(實際上有時候,可能是10次中的1次,這段代碼執行得非常好,沒有任何錯誤) – Naveen
這意味着第二個錯誤是由一些不相關的代碼塊產生的(它可能會或可能不是第一個的結果),所以堆棧跟蹤在這裏最有幫助 –