"OpenSSL: EC_KEY_generate_key FAIL ... error:00000000:lib(0):func(0):reason(0)" on pyelliptic.ECC()
<p>I'm getting the above error while using <code>pyelliptic</code> (versions given below).</p>

<p>The python code which triggers it: </p>

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

<p>The <code>"Salt: ..."</code> message is displayed okay, the error is in the <code>pyelliptic.ECC()</code> call.</p>

<p>Traceback:</p>

<pre><code>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())
</code></pre>

<p>The error(s) I get are (the 2nd one may or may not be relevant):</p>

<ol>
<li><code>Exception('[OpenSSL] EC_KEY_generate_key FAIL ... error:00000000:lib(0):func(0):reason(0)',)</code>
(Ref. File Link: <a href="https://github.com/yann2192/pyelliptic/blob/master/pyelliptic/ecc.py#L214" rel="nofollow" title="pyelliptic/ecc.py File">https://github.com/yann2192/pyelliptic/blob/master/pyelliptic/ecc.py#L214</a> )</li>
<li><code>extern "Python": function Cryptography_rand_bytes() called, but @ffi.def_extern() was not called in the current subinterpreter.  Returning 0.</code></li>
</ol>

<p>Requirements.txt (partial):</p>

<pre><code>setuptools==27.1.2
cryptography==1.5
pyelliptic==1.5.7
pyOpenSSL==16.1.0
</code></pre>

<p><a href="https://github.com/yann2192/pyelliptic/issues/39" rel="nofollow">https://github.com/yann2192/pyelliptic/issues/39</a> says that <code>pyelliptic</code> <code>v1.5.7</code> has some issues with old versions (Not sure if this is applicable here).</p>

<p><strong>Other Details:</strong></p>

<p>Python Version: 2.7.</p>

<p>Getting this error only on Google Compute Engine VM Instance. </p>

<p>Working Fine on Local Development Server.
Working Fine from python shell too Google Compute Engine VM.</p>

<p><sub>(The question is a follow-up of <a href="http://stackoverflow.com/questions/39413987/entrypoint-object-has-no-attribute-resolve-when-using-google-compute-engine/39499600#39413987">&#39;EntryPoint&#39; object has no attribute &#39;resolve&#39; when using Google Compute Engine</a>, the discussion there might be of use)</sub></p>

<p>Just added the following:<code>WSGIApplicationGroup %{GLOBAL}</code></p>

<p>in <code>/etc/apache2/sites-available/default-ssl.conf</code> file and all these errors got resolved. </p>

python django google-compute-engine