Python RSA library?

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

Now, how do I export or import keys? Everything is there, except for these two functions!

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

Preferably in -armor format :)

Any ideas?


Thanks to everyone. It turned out that Ubuntu was installing an old version of PyCrypto, and I had to get 2.3 from their site.

+3
source share
2 answers

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

+2
source

Crypto.PublicKey exportKey rsa, _RSAobj. . "DER" (PKCS # 1) "PEM" (RFC1421).

0

Source: https://habr.com/ru/post/1792150/


All Articles