def gen_keys(nbits):

    while True:
        (p, q) = find_p_q(nbits)
        (e, d) = calculate_keys(p, q, nbits)

        # For some reason, d is sometimes negative. We don't know how
        # to fix it (yet), so we keep trying until everything is shiny
        if d > 0: break

    return (p, q, e, d)
Generate RSA keys of nbits bits. Returns (p, q, e, d).
dataset/ETHPy150Open CouchPotato/CouchPotatoServer/libs/rsa/_version133.py/gen_keys