Example #1
0
def rsa_key_export():
	masterkey   = rsa.generate_key( 2048 )
	print '[+] generate OK!'
	print '[+] exporting keypair to disk...'
	rsa.export_keypair( 'rsa_server', masterkey )

	print '\t[+] attempting to reload keypair from disk... ',
	pubkey = rsa.load_key('rsa_server.pub')
	prvkey = rsa.load_key('rsa_server.prv')

	assert( prvkey.has_private() )
	assert( not pubkey.has_private() )
	print 'OK!'
	assert(pubkey == prvkey.publickey())