Skip to content

RSA by hand, and why textbook RSA is broken

Level: 301 · deep dive

Stub — an outline, not a lesson. There is no runnable example behind this page yet, so nothing on it has been through the check that backs every other claim in this library. The bullets below are the questions the finished page has to answer.

One line: Key generation, encryption and signing with pow() and small primes — then the reasons the version you just built must never be used.

The questions this page has to answer

  • Generate a keypair by hand: two primes, n, φ(n), e, d. Encrypt and decrypt.
  • Why does the same operation serve as both 'encrypt' and 'sign', and why is treating them as the same thing a bug?
  • Textbook RSA is deterministic — so what can an attacker with the public key do to a short message?
  • Malleability: multiply a ciphertext and watch the plaintext multiply.
  • What padding fixes it (OAEP, PSS), and why 'just use a bigger key' fixes none of it.

See also