Preconditions: - p and q are prime - p != q ''' # Compute the product of p and q n = p * q # Choose e such that gcd(e, phi_n) = 1. The second tuple is the public key, containing (n, e). The first tuple is the private key, containing (p, q, d).
The return value is a tuple containing two tuples: 1. \newcommandĭef rsa_generate_key(p: int, q: int) -> \ tuple, tuple]: '''Return an RSA key pair generated using primes p and q.