PyCrypto errors with .p12 file from the Google Developer Console

I am trying to implement the Google Identity Toolkit (gitkitv3) in Python GAE. After a user logs in to 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 SO's answer , I ran the following commands in 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 get 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 downloaded x.p12 from the google developer console. How to fix this error? Please, help


ANY PROGRAM?

Do I need this .p12 file or can I copy its contents to a global variable and use it (as a workaround)? Can someone explain to me the actual use of this file?


UPDATE
It seems that the PyCrypto library provided by Google is extremely limited and does not have the ability to support the X509.

+3
google-app-engine google-oauth pycrypto oauth2client
source share
1 answer

Installing pyopenssl fixed the problem for me:

 pip install pyopenssl 
+7
source share

All Articles