def newkeys(nbits, accurate=True, poolsize=1):
 if (nbits < 16):
  raise ValueError('Key too small')
 if (poolsize < 1):
  raise ValueError(('Pool size (%i) should be >= 1' % poolsize))
 if (poolsize > 1):
  from rsa import parallel
  import functools
  getprime_func = functools.partial(parallel.getprime, poolsize=poolsize)
 else:
  getprime_func = rsa.prime.getprime
 (p, q, e, d) = gen_keys(nbits, getprime_func)
 n = (p * q)
 return (PublicKey(n, e), PrivateKey(n, e, d, p, q))

def newkeys ( nbits , accurate = True , poolsize = 1 ) : if ( nbits < 16 ) : raise ValueError ( 'Key too small' ) if ( poolsize < 1 ) : raise ValueError ( ( 'Pool size (%i) should be >= 1' % poolsize ) ) if ( poolsize > 1 ) : from rsa import parallel import functools getprime_func = functools . partial ( parallel . getprime , poolsize = poolsize ) else : getprime_func = rsa . prime . getprime ( p , q , e , d ) = gen_keys ( nbits , getprime_func ) n = ( p * q ) return ( PublicKey ( n , e ) , PrivateKey ( n , e , d , p , q ) )
generates public and private keys .