I want to generate a RSA key-pair from a passphrase. How can I do that in Python. I have try PBDFK2 but i works only for symmetric encryption like AES.
Asked
Active
Viewed 302 times
1 Answers
0
You could try using ezPyCrypto:
import ezPyCrypto
mysecret = "Secret"
raw = "String to Encrypt"
# Create a key object
k = ezPyCrypto.key(passphrase=mysecret)
# Export public/private key
publicAndPrivateKey = k.exportKeyPrivate()
# Encrypt against this keypair
enc = k.encString(raw)
# Create a new key object, and import keys (with passphrase)
k1 = ezPyCrypto.key(publicAndPrivateKey, passphrase=mysecret)
# Decrypt text
dec = k.decString(enc)
Or you can use the exec()
function and commandline function "ssh-keygen".

coltonrusch
- 194
- 11