RSA
An early practical public-key construction supporting distinct encryption and signature schemes, with public and private keys.
Try a pair of keys
Toy model — no real security. Choose two different primes between 2 and 97. This is unpadded textbook arithmetic with deliberately tiny numbers, not secure RSA encryption. It does not authenticate the person offering a public key.
Start with the example, then change a prime or the message.
The construction is described in RFC 8017, §3–5; its complete encryption schemes require additional encoding.
Why This Matters
RSA provided an early practical construction for public-key encryption and digital signatures. These are different schemes built from related arithmetic, not merely one encryption operation run backwards. Secure encodings, key separation, authentication and application context are essential. A valid signature establishes a relationship to a key; it does not by itself establish a person's identity or resolve every non-repudiation dispute.
Rivest, Shamir and Adleman developed RSA at MIT in 1977, following the public-key research of Diffie and Hellman. Their construction was publicly described in 1977 and published in Communications of the ACM in 1978. Clifford Cocks had found a related construction at GCHQ in 1973, but that work remained classified until 1997.
Pick two large primes p and q (each ~1024 bits for RSA-2048). Compute n = p·q and φ(n) = (p−1)(q−1). Choose a public exponent e coprime to φ(n) — almost always 65537. Compute the private exponent d ≡ e−1 mod φ(n).
Public key is (n, e); private key is (n, d). To encrypt message m: c = me mod n. To decrypt: m = cd mod n. The math works because of Euler's theorem: med ≡ m mod n for any m coprime to n. Factoring n lets an attacker compute a private exponent. The Chinese remainder theorem extends this correctness argument to all message representatives from 0 to n−1, not only those coprime to n.
Factoring the modulus breaks RSA, but general RSA inversion has not been proved equivalent to factoring. Security claims must also specify the encoding and attack model: textbook RSA is deterministic and malleable. RFC 8017 defines schemes such as RSA-OAEP for encryption and RSA-PSS for signatures and recommends using a key pair for one scheme. A sufficiently capable quantum computer running Shor's algorithm would break RSA. Read a quantum resource estimate with its hardware, retry and timing assumptions. NIST finalized ML-KEM for key establishment and ML-DSA and SLH-DSA for signatures in 2024; these serve different roles rather than providing one universal RSA replacement.
| Where | How RSA is Used |
|---|---|
| TLS / HTTPS certificates | RSA is supported alongside other certificate signature algorithms; key size and policy depend on the deployment |
| Code signing | RSA signatures are supported in several software-signing ecosystems; the selected scheme varies |
| PGP / GPG | RSA remains supported; modern OpenPGP implementations also support other key types |
| SSH host keys | RSA keys can use SHA-256 or SHA-512 signatures. OpenSSH 8.8 disabled the SHA-1-based ssh-rsa signature scheme by default |
| JWT signatures | RS256 is an RSA PKCS#1 v1.5 signature option; applications must restrict accepted algorithms |
| Era | Modern · 1977 |
| Status | In daily use; NIST is preparing a post-quantum migration (RSA breaks under Shor's algorithm on a sufficiently large quantum computer) |
| Origin | Ron Rivest, Adi Shamir, Leonard Adleman (MIT, 1977); Clifford Cocks (GCHQ, 1973, classified) |
| Year | 1977 |
| Type | Public-key encryption & digital signature (asymmetric) |
| Modern Role | TLS certificates, code signing, PGP/GPG, SSH host keys, JWT signatures, document signing |
Primary Sources
RFC 8017 (PKCS #1 v2.2, 2016); OpenSSH 8.8 release notes (2021); NIST FIPS 203, 204 and 205 (2024).