我正在尝试在 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 文件,或者我可以将其内容复制到全局变量并使用它(作为解决方法)?有人可以解释一下这个文件的实际用途吗?
更新
看起来谷歌提供的 PyCrypto 库非常有限,缺乏支持 X509 的能力。