def generate(bits, progress_func=None):
        """
        Generate a new private RSA key.  This factory function can be used to
        generate a new host key or authentication key.

        :param int bits: number of bits the generated key should be.
        :param function progress_func:
            an optional function to call at key points in key generation (used
            by ``pyCrypto.PublicKey``).
        :return: new `.RSAKey` private key
        """
        rsa = RSA.generate(bits, os.urandom, progress_func)
        key = RSAKey(vals=(rsa.e, rsa.n))
        key.d = rsa.d
        key.p = rsa.p
        key.q = rsa.q
        return key
def generate ( bits , progress_func = None ) : rsa = RSA . generate ( bits , os . urandom , progress_func ) key = RSAKey ( vals = ( rsa . e , rsa . n ) ) key . d = rsa . d key . p = rsa . p key . q = rsa . q return key
Generate a new private RSA key.  This factory function can be used to
        generate a new host key or authentication key.

        :param int bits: number of bits the generated key should be.
        :param function progress_func:
            an optional function to call at key points in key generation (used
            by ``pyCrypto.PublicKey``).
        :return: new `.RSAKey` private key