fix deprecation warnings when creating the keypair

git-svn-id: https://kippo.googlecode.com/svn/trunk@115 951d7100-d841-11de-b865-b3884708a8e2
This commit is contained in:
desaster 2010-06-01 05:36:14 +00:00
parent f28a852518
commit 8a34f34062
1 changed files with 4 additions and 3 deletions

View File

@ -386,10 +386,11 @@ def getRSAKeys():
# generate a RSA keypair # generate a RSA keypair
print "Generating RSA keypair..." print "Generating RSA keypair..."
from Crypto.PublicKey import RSA from Crypto.PublicKey import RSA
from twisted.python import randbytes
KEY_LENGTH = 1024 KEY_LENGTH = 1024
rsaKey = RSA.generate(KEY_LENGTH, common.entropy.get_bytes) rsaKey = RSA.generate(KEY_LENGTH, randbytes.secureRandom)
publicKeyString = keys.makePublicKeyString(rsaKey) publicKeyString = keys.Key(rsaKey).public().toString('openssh')
privateKeyString = keys.makePrivateKeyString(rsaKey) privateKeyString = keys.Key(rsaKey).toString('openssh')
# save keys for next time # save keys for next time
file(public_key, 'w+b').write(publicKeyString) file(public_key, 'w+b').write(publicKeyString)
file(private_key, 'w+b').write(privateKeyString) file(private_key, 'w+b').write(privateKeyString)