[Math] Create a private key from two public keys that share primes

cryptographyprime factorizationprime numbers

Given two public keys, n1 and n2 (and e the exponent)–how would one generate a private key for n1? In this scenario, n1 and n2 share primes.

I know I need to use $$d = e^{-1} \space mod \space (p-1)(q-1)$$–but we don't know p or q. How would you go about this?

Best Answer

Assuming that $n_1$ and $n_2$ are RSA moduli: the common prime $p$ is $\gcd(n_1, n_2)$, easily computable by Euclid's algorithm. We then know $q = \frac{n_1}{p}$ and now you're good to go.

Related Question