使用Google Developer Console中的.p12文件导致PyCrypto错误

 厉害了 发布于 2022-12-25 10:28

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

'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文件上运行以下命令,并使用生成的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.

我从Google Developer Console下载了x.p12.如何解决这个错误?请帮忙


有什么办法吗?

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


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

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有