Wiener's Attack
Using Continued Fractions to attack large e values
Last updated
Using Continued Fractions to attack large e values
Last updated
Wiener's Attack utilises the convergents of the continued fraction expansion of to attempt to guess the decryption exponent when is large, as is necessarily small as a result.
We can say that
We can also say that since , we can rearrange this to say that .
Now since is likely to be huge, we can say is almost zero, and also use the approximation from before to say that
Once we list the convergents, we iterate through and there are a few checks we can make to determine whether or not it's the correct convergent:
Note that is composed of entirely public information, meaning we have access to an approximation to , which is entirely private information.
We can represent as a continued fraction. If we go through the convergents of this fraction, we may come across since ( is a good approximation). This is more likely to work whendis smaller due to Legendre’s Theorem in Diophantine Approximations (TODO prove this), specifically when .
As and is even, must be odd, so we can discard convergences with even denominators.
Since must be a whole number, we can compute and see if it returns an integer or not - if not, we can discard the convergent.
Once we find a convergent we don't discard, we can assume it's and attempt to calculate with that, seeing if the resultant private key yields a valid result or not. This can take a lot of decryption attempts to work successfully however - we can speed up the "checking" process using a quadratic equation.
If we say , it follows that:
If we now consider a quadratic equation , with the roots and being the prime factors of , we can expand this and substitute:
If our value of is correct, we can substitute this into the equation and solve it for two integer values and . If the values are not integer, the result can be discarded.