【发布时间】:2013-08-01 12:06:51
【问题描述】:
appengine 上的 SignedJwtAssertionCredentials(使用 pycrypto 2.6)不支持 PKCS12 格式,因此我尝试改用 PEM 密钥,正如各处所建议的那样..
这是我的代码:
f = file(os.path.join(os.path.dirname(__file__), KEY_FILE), "r")
key = f.read()
f.close()
credentials = SignedJwtAssertionCredentials(SERVICE_ACCOUNT_EMAIL, key,
scope="https://www.googleapis.com/auth/drive"
http = httplib2.Http()
http = credentials.authorize(http)
KEY_FILE 是 PEM 密钥,使用以下命令转换:
openssl pkcs12 -in privatekey.p12 -nodes -nocerts > privatekey.pem
但我仍然收到此错误,好像它没有识别出这是 PEM 密钥:
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.
如果我只将文件名传递给构造函数(不读取文件内容),则会出现同样的错误
有什么想法吗?
【问题讨论】:
标签: google-app-engine openssl pycrypto pem pkcs#12