来自 Google Developer Console 的 .p12 文件的 PyCrypto 错误 [英] PyCrypto Errors with .p12 file from Google Developer Console

查看:21
本文介绍了来自 Google Developer Console 的 .p12 文件的 PyCrypto 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 GAE Python 中实现 Google Identity Toolkit (gitkitv3).用户登录网站后,我收到以下错误:

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.

基于 SO 回复,我在我的 x.p12 文件上运行以下命令并使用生成的私钥.pem 文件:

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.

我从 Google Developer Console 下载了 x.p12.如何修复此错误?请帮忙

I had downloaded the x.p12 from Google Developer Console. How to fix this error? Please help

任何解决方法?

我一定需要这个文件 .p12 文件还是我可以将其内容复制到全局变量并使用它(作为一种解决方法)?有人能解释一下这个文件的实际用途吗?

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?

更新
看起来谷歌提供的 PyCrypto 库非常有限,缺乏支持 X509 的能力.

UPDATE
Looks like PyCrypto library provided by Google is extremely limited and lacks capability to support X509.

推荐答案

安装 pyopenssl 为我解决了这个问题:

Installing pyopenssl fixed the issue for me:

pip install pyopenssl

这篇关于来自 Google Developer Console 的 .p12 文件的 PyCrypto 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆