1

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.

eclipse140790
  • 19
  • 1
  • 5

1 Answers1

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