#!/usr/bin/env python

# Generates RSA keys

from Crypto.PublicKey import RSA
from Crypto.Util import randpool
import pickle
import sys

if len(sys.argv) == 1:
    do = "server"
else:
    do = sys.argv[1]

print("Generating key for %s" % do)
pool = randpool.RandomPool()
# In real life, you use a *much* longer key
key = RSA.generate(512, pool.get_bytes)
pickle.dump(key, open("%s-full.key" % do, 'w'))
pickle.dump(key.publickey(), open("%s-public.key" % do, 'w'))



