I'm learning about common modulus attack and learned that public modulus attacks can find out the private key. Assume there are 2 users with public and private keys $(e_1, d_1)$ and $(e_2, d_2)$. Scenario is attacker has his public and private keys $(e_2, d_2)$ and victim's public key $e_1$ Here are the steps to get the secret key:
- $t= e_2\cdot d_2-1$
- Attacker uses the extended Euclidean algorithm to find $f=\gcd(t,e_1)$ whose pairs of numbers $(r,s)$ satisfy the equation $r\cdot t + s\cdot e_1 = f$
- If $f=1$ set $d_1' = s$ and return private key $d_1'$
- If $f\neq 1$ set $t=\frac t s$ and return step 2
I have a example with $d_1=17, M = 25$ is two value we should find. n = 253 (common modulus) $e_1 = 13$ (victim's public key) $e_2 = 23$ (attacker's public key ) $d_2 = 67$ (attacker's private key) $C = 27$ (Ciphertext). Attacker will find $d_1'$ according there steps:
- $t= e_2\cdot d_2-1 = 23\cdot 67 = 1540$
- $\gcd(t,e_1) = 1 \implies r = -2, s = 237$
- So $d_1' = s = 237$
- Verify $M = C^{d_1} \bmod n = 27^{237} \bmod 253 = 25$
Problem is I don't understand why with such steps we will find the secret key. Can someone explain me pls ?