wiener.tex 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. \chapter{Wiener's Attack \label{chap:wiener}}
  2. Wiener's attack was first published in 1989 as a result of cryptanalysis on the
  3. use of short RSA secret keys ~\cite{wiener}. It exploited the fact that it is
  4. possible to find the private key in \emph{polynomial time} using continued fractions
  5. expansions whenever a good estimate of the fraction $\frac{e}{N}$ is known.
  6. More specifically, given $d < \frac{1}{3} ^{4}\sqrt{N}$ one can efficiently
  7. recover $d$ only knowing $\angular{N, e}$.
  8. The scandalous implication behind Wiener's attack is that, even if there are
  9. situations where having a small private exponent may be
  10. particularly tempting with respect to performance (for example, a smart card
  11. communication with a computer), they represent a threat to the security of the
  12. cipher.
  13. Fortunately, ~\cite{wiener} \S 6 presents a couple of precautions that make a
  14. RSA key-pair immune to this attack, namely
  15. (i) making $e > \sqrt{N}$ and
  16. (ii) $gcd(p-1, q-1)$ large.
  17. \section{Continued Fractions background \label{sec:wiener:cf}}
  18. Let us call ``continued fraction'' any expression of the form:
  19. %% why \cfrac sucks this much. |-------------------------|
  20. $$
  21. a_0 + \frac{1}{a_1
  22. + \frac{1}{a_2
  23. + \frac{1}{a_3
  24. + \frac{1}{a_4 + \ldots}}}}
  25. $$
  26. hereby described as a series for convenience:
  27. $\angular{a_0, a_1, a_2, a_3, \ \ldots, a_n}$.
  28. Any floating point number $x$ can be represented as a continued fraction, and
  29. for each $i < n$ there exists fraction $\rfrac{h_i}{k_i}$ approximating $x$.
  30. By definition, each new approximation is recursively defined as:
  31. $$
  32. a_{-1} = 0 \quad
  33. a_i = h_i // k_i
  34. h_{-1} = 1 \quad h_{-2} = 0 \quad
  35. h_i = a_i h_{i-1} + h_{i-2}
  36. k_{-1} = 0 \quad k_{-2} = 1 \quad
  37. k_i = a_i k_{i-1} + k_{i-2}
  38. $$
  39. \section{The actual attack}
  40. As we saw in ~\ref{sec:preq:rsa}, by construction the two exponents are such that
  41. $ed \equiv 1 \pmod{\varphi(N)}$. This implies that there exists a
  42. $k \in \naturalN \mid ed = k\varphi(N) + 1$. This can be formalized to be
  43. the same problem we formalized in ~\ref{sec:wiener:cf}:
  44. \begin{align*}
  45. ed = k\varphi(N) + 1 \\
  46. \abs{\frac{ed - k\eulerphi{N}}{d\eulerphi{N}}} = \frac{1}{d\eulerphi{N}} \\
  47. \abs{\frac{e}{\eulerphi{N}} - \frac{k}{d}} = \frac{1}{d\eulerphi{N}} \\
  48. \end{align*}
  49. Now we proceed by substituting $\eulerphi{N}$ with $N$, since for large $N$, one
  50. approximates the other. We consider also the difference of the two, limited by
  51. $\abs{\cancel{N} + p + q - 1 - \cancel{N}} < 3\sqrt{N}$.
  52. For the last step, remember that $k < d < \rfrac{1}{3} {}^4\sqrt{N}$:
  53. \begin{align*}
  54. \abs{\frac{e}{N} - \frac{k}{d}} &= \abs{\frac{ed - kN}{Nd}} \\
  55. &= \abs{\frac{\cancel{ed} -kN - \cancel{k\eulerphi{N}} + k\eulerphi{N}}{Nd}} \\
  56. &= \abs{\frac{1-k(N-\eulerphi{N})}{Nd}} \\
  57. &\leq \abs{\frac{3k\sqrt{N}}{Nd}}
  58. = \frac{3k}{d\sqrt{N}}
  59. < \frac{3(\rfrac{1}{3} {}^4\sqrt{N})}{d\sqrt{N}}
  60. = \frac{1}{d{}^4\sqrt{N}}
  61. \end{align*}
  62. \section{Again on the engine™}
  63. %%% Local Variables:
  64. %%% mode: latex
  65. %%% TeX-master: "question_authority"
  66. %%% End: