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