3

我想实现在GAE Python的谷歌标识工具包(gitkitv3).p12文件。在网站上的用户登录后,我得到了以下错误:PyCrypto错误与谷歌开发者控制台

'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. 

基于a SO reply,我跑我的x.p12文件下列命令,以及用来代替产生privatekey.pem文件:

现在
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 

,我收到以下错误:

'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. 

我已经下载了谷歌从开发者控制台中x.p12。如何解决这个错误?请帮助


任何替代方法?

我是否一定需要这个文件.p12文件或者我可以将其内容复制到一个全局变量和使用它(作为一种变通方法)? 有人可以请解释一下这个文件的实际使用情况吗?


UPDATE
看起来像谷歌提供PyCrypto库是极为有限,缺乏能力来支持X509。

+1

http://stackoverflow.com/questions/17993604/signedjwtassertioncredentials-on-appengine-doesnt-recognize-pem-key – Ryan 2014-08-29 16:40:53

+0

@Bruyere谢谢,但我有已经尝试过,并没有奏效。 – gsinha 2014-08-29 18:39:55

+0

包括删除听众“----- BEGIN PRIVATE KEY -----”? – Ryan 2014-08-29 18:45:10

回答

7

安装pyopenssl固定我的问题:

pip install pyopenssl 
+0

我在哪里运行这个命令?在上传到GAE之前,在我的Mac /本地计算机上,然后在app.yaml中包含pyopenssl包? – 2015-11-26 22:10:13