问题
I am trying to implement Google Identity Toolkit (gitkitv3) in GAE Python. After a user signs in on the website, I get the following errors:
'PKCS12 format is not supported by the PyCrpto library. '
NotImplementedError: PKCS12 format is not supported by the PyCrpto library. Try converting to a "PEM" (openssl pkcs12 -in xxxxx.p12 -nodes -nocerts > privatekey.pem) or using PyOpenSSL if native code is an option.
Based on a SO reply, I ran the following commands on my x.p12 file and used the generated privatekey.pem file instead:
openssl pkcs12 -passin pass:notasecret -in x.p12 -nocerts -passout pass:notasecret -out key.pem
openssl pkcs8 -nocrypt -in key.pem -passin pass:notasecret -topk8 -out privatekey.pem
Now, I am getting the following error:
'X509 certs are not supported by the PyCrypto library. '
NotImplementedError: X509 certs are not supported by the PyCrypto library. Try using PyOpenSSL if native code is an option.
I had downloaded the x.p12 from Google Developer Console. How to fix this error? Please help
ANY WORKAROUND?
Do I necessarily need this file .p12 file or can I copy its contents to a global variable and use it (as a workaround)? Could someone please explain me the actual use of this file?
UPDATE
Looks like PyCrypto library provided by Google is extremely limited and lacks capability to support X509.
回答1:
Installing pyopenssl
fixed the issue for me:
pip install pyopenssl
来源:https://stackoverflow.com/questions/25571504/pycrypto-errors-with-p12-file-from-google-developer-console