Modern · 1977

RSA

An early practical public-key construction supporting distinct encryption and signature schemes, with public and private keys.

OriginRon Rivest, Adi Shamir, Leonard Adleman (MIT, 1977); Clifford Cocks (GCHQ, 1973, classified)
Year1977
TypePublic-key encryption & digital signature (asymmetric)
StatusIn daily use; NIST is preparing a post-quantum migration (RSA breaks under Shor's algorithm on a sufficiently large quantum computer)
Modern RoleTLS certificates, code signing, PGP/GPG, SSH host keys, JWT signatures, document signing

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.

Use 1 < e < φ(n), coprime to φ(n). The message must be from 0 to n−1. The model computes n = pq, φ(n) = (p−1)(q−1), and the inverse d of e modulo φ(n).

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.

Historical Context

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.

How It Works

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.

Security & Cryptanalysis

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 You Use It Today
WhereHow RSA is Used
TLS / HTTPS certificatesRSA is supported alongside other certificate signature algorithms; key size and policy depend on the deployment
Code signingRSA signatures are supported in several software-signing ecosystems; the selected scheme varies
PGP / GPGRSA remains supported; modern OpenPGP implementations also support other key types
SSH host keysRSA keys can use SHA-256 or SHA-512 signatures. OpenSSH 8.8 disabled the SHA-1-based ssh-rsa signature scheme by default
JWT signaturesRS256 is an RSA PKCS#1 v1.5 signature option; applications must restrict accepted algorithms
Quick Facts
EraModern · 1977
StatusIn daily use; NIST is preparing a post-quantum migration (RSA breaks under Shor's algorithm on a sufficiently large quantum computer)
OriginRon Rivest, Adi Shamir, Leonard Adleman (MIT, 1977); Clifford Cocks (GCHQ, 1973, classified)
Year1977
TypePublic-key encryption & digital signature (asymmetric)
Modern RoleTLS certificates, code signing, PGP/GPG, SSH host keys, JWT signatures, document signing
← Previous Diffie-Hellman Key Exchange