RSA (Rivest, Shamir, Adleman, 1977; published in 1978) bases its security on two facts:

  • It is easy to multiply two large primes and obtain a number nn;
  • It is extremely hard (with current computers, impractical for primes of 300300 digits) to factorise nn recovering pp and qq.

Operating scheme.

  1. Alice chooses two large primes p,qp,q and computes n=pqn=pq and φ(n)=(p1)(q1)\varphi(n) = (p-1)(q-1).
  2. She chooses ee coprime with φ(n)\varphi(n) (public encoding key).
  3. She computes dd such that ed1(modφ(n))ed\equiv 1\pmod{\varphi(n)} (private decoding key). dd is the modular inverse of ee.
  4. She publishes (n,e)(n,e). She keeps secret dd, pp, qq.
  5. Bob, to send the message m{0,,n1}m\in\{0,\ldots,n-1\}, computes c=memodnc = m^e\bmod n and sends cc.
  6. Alice decodes: m=cdmodnm = c^d\bmod n, thanks to Euler cdmedm1+kφ(n)m1m(modn)c^d \equiv m^{ed} \equiv m^{1+k\varphi(n)} \equiv m\cdot 1 \equiv m\pmod n.

Remark — Why it works in practice

All the encoding/decoding operations are done in polynomial time (O(log3n)O(\log^3 n) with fast exponentiation). The only step that would require exponential time is factorising nn: with primes p,qp,q of 10241024 bits each (300\approx 300 decimal digits) no known computer can do it in reasonable time. RSA’s security rests on this asymmetry. The scenario will change if and when quantum computing makes Shor’s algorithm feasible: it is one of the reasons for the development of post-quantum cryptography.

Topics: Distribuzioni probabilita
Concepts: Aritmetica modulare · Crittografia rsa · Funzione di eulero
Skills: Modellizzare
People: Adleman · Rivest · Shamir