How add/change password for RSA priv key using PyCrypto

k2 grzegorz.tezycki at gmail.com
Mon Aug 1 13:22:36 CEST 2011


Hi, maybe somebody be able to help me.
I'm using PyCrypto to generate a pair of RSA keys. The public key and
private key.
I try to add a password to the private key, and I do not know how to
do it.

This is a piece of my code.

#encoding:utf-8
from Crypto.PublicKey import RSA

pass_alice='ala'
private_alice_key = RSA.generate(1024)
public_alice_key  = private_alice_key.publickey()

str_priv = private_alice_key.exportKey()
str_pub  = public_alice_key.exportKey()

print str_priv
print str_pub

# HOW ADD OR CHANGE PASSWORD FOR private_alice_key



More information about the Python-list mailing list