开发者

Python RSA library?

from Crypto.PublicKey import RSA
private = RSA.generate(1024, os.urandom)

Now how do I export or import keys? Ev开发者_StackOverflowerything is there except these 2 functions!

private.exportKey()
private.publickey.exportKey()

Preferably in --armor format :)

Any ideas?


Thanks all. Turned out that Ubuntu installs an old version of PyCrypto and I had to fetch 2.3 from their website.


If you are using PyCryto, then I see that PyCryto 2.2 has that functionality. Otherwise you will find the patch here useful.


Crypto.PublicKey's exportKey is within module rsa, under _RSAobj class. You can look at the documentation here. You can export the public or private key with 'DER' (PKCS#1) or 'PEM' (RFC1421) format.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜