Public-Key Encryption Schemes

Public-key encryption from definitions to concrete schemes. The setting (receivers publish pk, any number of senders, authenticated key distribution assumed, a 2–3 orders of magnitude cost), syntax, eavesdropping security, which is automatically CPA security once the adversary holds pk; no perfect secrecy; no deterministic scheme; multiple encryptions via a hybrid argument; bit-by-bit extension. Hybrid (KEM/DEM-style) encryption with the cost calculation and a three-step security proof. RSA: textbook RSA and why it fails, practical issues (encoding, small e, never small d, CRT decryption), attacks (cube roots, Håstad broadcast, √L meet-in-the-middle, two common-modulus attacks), padded RSA (security for one-bit messages from RSA), PKCS #1 v1.5. ElGamal from a 'pseudorandom pad' in a group, its DDH proof, encoding into QR_p, shared parameters. CCA security: realistic scenarios, malleability, attacks on textbook RSA, PKCS #1 v1.5 (Bleichenbacher) and ElGamal. Trapdoor permutations, hard-core bits and a generic CPA scheme. Chapter 11: quadratic residues mod p and N, Jacobi symbols, the quadratic residuosity assumption, Goldwasser–Micali; modular square roots, square roots ⟺ factoring, Blum integers, the Rabin trapdoor permutation and encryption; the structure of Z*_{N²}, decisional composite residuosity, Paillier, and homomorphic encryption with voting. Worked examples verified; OAEP/random-oracle material pending (Ch. 13).

· 32 min read · 6,302 words

Corresponds to Katz & Lindell, Introduction to Modern Cryptography, Chapters 10–11. (The random-oracle model and OAEP are Chapter 13; see the pending section at the end.)

Motivation: secrecy without a shared secret

IntuitionThe asymmetric setting

The receiver generates (pk,sk)(pk, sk) and makes pkpk available. Any sender can encrypt to it, and only sksk decrypts. The receiver can either send pkpk when a sender appears (over a public but authenticated channel) or publish it in advance: on a webpage, a business card, or a directory, before even knowing who will write. Either way the adversary knows pkpk, so all security rests on sksk.

Private-keyPublic-key
Secrecy neededthe whole keyonly sksk
Key distributionneeds a secret channelan authenticated public channel suffices
Directionsymmetric (either party encrypts)one-way: many senders to one receiver
Receiver’s storage with UU sendersUU keysone sksk; senders needn’t be known in advance
Speedfast2–3 orders of magnitude slower (hard on smartcards and RFID tags)

Rule: if a secret key can be shared, use private-key encryption. Even in the public-key setting, long messages are encrypted with private-key cryptography (hybrid encryption).

WarningActive attacks on key distribution are out of scope here

If an adversary can substitute pk′pk' for Alice’s pkpk (in transit, or in a directory), it decrypts everything sent to “Alice”, and without prior shared information or a trusted third party nobody can detect it. (In the shouting-across-a-room scenario, voices and faces serve as that prior shared information.) These chapters assume senders hold the legitimate pkpk. That separates encryption from key distribution, which is solved by certificates and PKI (digital-signatures-and-pki, §12.7). Same root cause as DH’s man-in-the-middle.


Definitions

DefinitionPublic-key encryption scheme (Def. 10.1)

Ppt algorithms:

  • (pk,sk)←Gen(1n)(pk,sk)\leftarrow\mathrm{Gen}(1^n), each of length at least nn, with nn recoverable from them;
  • c←Encpk(m)c\leftarrow\mathrm{Enc}_{pk}(m), for mm in a plaintext space that may depend on pkpk;
  • m:=Decsk(c)m := \mathrm{Dec}_{sk}(c), deterministic, possibly outputting ⊥\perp.

Correctness: Decsk(Encpk(m))=m\mathrm{Dec}_{sk}(\mathrm{Enc}_{pk}(m)) = m. Unlike private-key keys, pkpk isn’t just a random string. When the plaintext space is something like ZN\mathbb Z_N, specify an efficient, reversible encoding of bit strings (for example, (n−1)(n-1)-bit strings as integers below NN).

Eavesdropping security is CPA security

DefinitionPubKeav\mathrm{PubK}^{\mathrm{eav}} and PubKcpa\mathrm{PubK}^{\mathrm{cpa}} (Defs. 10.3–10.4)

Eavesdropping: (pk,sk)←Gen(pk,sk)\leftarrow\mathrm{Gen}; A(pk)\mathcal A(pk) outputs equal-length m0,m1m_0, m_1; it receives c←Encpk(mb)c\leftarrow\mathrm{Enc}_{pk}(m_b) and guesses bb. Secure if Pr⁡[success]≤12+negl\Pr[\text{success}]\le\frac12 + \mathrm{negl}. The only change from Definition 3.9 is that A\mathcal A gets pkpk.

CPA: additionally give A\mathcal A an Encpk(⋅)\mathrm{Enc}_{pk}(\cdot) oracle.

TheoremProposition 10.5 — In the public-key setting, eavesdropping security = CPA security

Knowing pkpk, A\mathcal A can encrypt anything itself: the encryption oracle comes for free. (In the private-key world, EAV security does not imply CPA security: Claim 3.20.)

WarningTwo impossibilities

  • No perfect secrecy (Exercise 10.1), however long the keys or short the messages. By correctness, the supports of Encpk(0)\mathrm{Enc}_{pk}(0) and Encpk(1)\mathrm{Enc}_{pk}(1) are disjoint. An unbounded adversary with pkpk simply checks which support contains cc.
  • No deterministic scheme is secure (Theorem 10.6). Compute Encpk(m0)\mathrm{Enc}_{pk}(m_0) and compare with cc. Worse, a small message space is fully recoverable (Exercise 10.2): a professor encrypting a grade from {A,B,C,D,F}\{A,B,C,D,F\} leaks it in five trial encryptions. Many early systems used deterministic public-key encryption; Goldwasser–Micali’s insistence on probabilistic encryption (and the definition above) was a turning point.

Multiple encryptions, and arbitrary lengths

TheoremTheorem 10.10 — single-message security ⇒ multi-message security

If Π\Pi is EAV-secure, then for vectors M⃗0,M⃗1\vec M_0, \vec M_1 of t=poly(n)t = \mathrm{poly}(n) messages, Encpk(M⃗0)\mathrm{Enc}_{pk}(\vec M_0) and Encpk(M⃗1)\mathrm{Enc}_{pk}(\vec M_1) are indistinguishable. (Assume without loss of generality exactly t(n)t(n) messages: Exercise 10.4.)

ProofHybrid over positions

Let C⃗(i)\vec C^{(i)} encrypt the first ii messages of M⃗0\vec M_0 and the rest of M⃗1\vec M_1, so C⃗(t)\vec C^{(t)} is all M⃗0\vec M_0 and C⃗(0)\vec C^{(0)} is all M⃗1\vec M_1. A′\mathcal A' picks a random i∈[t]i\in[t], submits (m0i,m1i)(m_0^i, m_1^i), places the challenge at position ii, and encrypts the other positions itself using pkpk (possible only because the key is public). If b=0b = 0 it simulates C⃗(i)\vec C^{(i)}; if b=1b = 1, C⃗(i−1)\vec C^{(i-1)}. Telescoping gives

12+negl≥Pr⁡[A′ wins]=t−12t+1tPr⁡[PubKmult=1]\tfrac12 + \mathrm{negl}\ge\Pr[\mathcal A'\text{ wins}] = \frac{t-1}{2t} + \frac1t\Pr[\mathrm{PubK}^{\mathrm{mult}} = 1]

so Pr⁡[PubKmult=1]≤12+t⋅negl\Pr[\mathrm{PubK}^{\mathrm{mult}} = 1]\le\frac12 + t\cdot\mathrm{negl}. (The multi-sample hybrid again.)

∎

TheoremProposition 10.11 — Bit-by-bit encryption

Any EAV/CPA-secure scheme for 1-bit messages gives one for {0,1}∗\{0,1\}^*: Encpk′(m)=Encpk(m1),…,Encpk(mt)\mathrm{Enc}'_{pk}(m) = \mathrm{Enc}_{pk}(m_1),\ldots,\mathrm{Enc}_{pk}(m_t). Terminology: “CPA-secure” from now on, though proofs use the EAV experiment.


Hybrid encryption

AlgorithmHybrid encryption (Construction 10.12)

With public-key scheme Π\Pi and private-key scheme Π′\Pi':

  • Encpkhy(m)\mathrm{Enc}^{hy}_{pk}(m): k←{0,1}nk\leftarrow\{0,1\}^n, c1←Encpk(k)c_1\leftarrow\mathrm{Enc}_{pk}(k), c2←Enck′(m)c_2\leftarrow\mathrm{Enc}'_k(m); output ⟨c1,c2⟩\langle c_1,c_2\rangle.
  • Dechy\mathrm{Dec}^{hy}: k:=Decsk(c1)k := \mathrm{Dec}_{sk}(c_1), then m:=Deck′(c2)m := \mathrm{Dec}'_k(c_2).

Public-key encryption transports a fresh key; private-key encryption carries the data. It is still a public-key scheme: nothing is shared in advance. (The modern KEM/DEM pattern.)

FormulaEfficiency

With α\alpha the cost to encrypt an nn-bit key and β\beta the per-bit private-key cost, the per-bit cost for a tt-bit message is

α+βtt=αt+β ⟶ β\frac{\alpha + \beta t}t = \frac\alpha t + \beta\ \longrightarrow\ \beta

and the ciphertext length is ℓ+n+∣m∣\ell + n + \lvert m\rvert. Public-key functionality at private-key speed for long messages, and only useful when ∣m∣>n\lvert m\rvert > n. Rough numbers for a 1 Mb email with β≈α/106\beta\approx\alpha/10^6: hybrid costs about α/(5⋅105)\alpha/(5\cdot10^5) per bit, versus about α/103\alpha/10^3 per bit for 1000-bit public-key blocks. That is a roughly 500× speedup and about half the ciphertext length.

TheoremTheorem 10.13 — Hybrid encryption is CPA-secure

If Π\Pi is CPA-secure and Π′\Pi' is merely EAV-secure (one message per key), then Πhy\Pi^{hy} is CPA-secure. One-time security suffices because every message gets a fresh kk.

ProofThree hybrids

Show (pk,Encpk(k),Enck′(m0))≡c(pk,Encpk(k),Enck′(m1))(pk,\mathrm{Enc}_{pk}(k),\mathrm{Enc}'_k(m_0))\overset c\equiv(pk,\mathrm{Enc}_{pk}(k),\mathrm{Enc}'_k(m_1)) via

(Enc(k),Enck′(m0))≈Π(Enc(0n),Enck′(m0))≈Π′(Enc(0n),Enck′(m1))≈Π(Enc(k),Enck′(m1))(\mathrm{Enc}(k),\mathrm{Enc}'_k(m_0))\overset{\Pi}{\approx}(\mathrm{Enc}(0^n),\mathrm{Enc}'_k(m_0))\overset{\Pi'}{\approx}(\mathrm{Enc}(0^n),\mathrm{Enc}'_k(m_1))\overset{\Pi}{\approx}(\mathrm{Enc}(k),\mathrm{Enc}'_k(m_1))

  • Steps 1 and 3 (reduce to Π\Pi): A1\mathcal A_1 picks kk itself, submits (k,0n)(k,0^n), and builds Enck′(m0)\mathrm{Enc}'_k(m_0) with the kk it knows. The Π\Pi reduction can know kk.
  • Step 2 (reduce to Π′\Pi'): A′\mathcal A' generates (pk,sk)(pk,sk) itself and sets c1=Encpk(0n)c_1 = \mathrm{Enc}_{pk}(0^n), which carries no information about kk. That is exactly what Π′\Pi'‘s security needs.

Summing the three inequalities, the middle terms cancel to 1, which gives the bound. (Trying to apply Π′\Pi' directly fails: Encpk(k)\mathrm{Enc}_{pk}(k) leaks information about kk to an unbounded analysis.)

∎


RSA encryption

Textbook RSA

AlgorithmTextbook RSA (Construction 10.14)

GenRSA gives (N,e,d)(N,e,d) with ed≡1 mod φ(N)ed\equiv1\bmod\varphi(N). Public key ⟨N,e⟩\langle N,e\rangle, private key ⟨N,d⟩\langle N,d\rangle:

c:=me mod N,m:=cd mod Nc := m^e\bmod N,\qquad m := c^d\bmod N

Deterministic ⇒ insecure (Theorem 10.6). All it guarantees, under RSA, is that a uniform m∈ZN∗m\in\mathbb Z_N^* can’t be recovered entirely: partial information may leak, and real messages aren’t uniform. Recovering dd is as hard as factoring, but that says nothing about other ways to invert.

NoteRSA in practice

  • Encoding: (∥N∥−1)(\lVert N\rVert - 1)-bit strings become integers below NN (pad on the left, with a length indication). m∉ZN∗m\notin\mathbb Z_N^* is negligibly likely, decryption still works (Exercise 7.8), and finding such an mm would factor NN (gcd⁡(m,N)\gcd(m,N)).
  • Small ee (for example e=3e = 3, needing p,q≢1 mod 3p, q\not\equiv1\bmod3) makes encryption take two multiplications. Its weaknesses below are failings of textbook RSA, not of e=3e = 3.
  • Never small dd: d<216d < 2^{16} falls to brute force, and even d≈N1/4d\approx N^{1/4} is vulnerable (Wiener-type attacks).
  • CRT decryption: mp=cd mod (p−1) mod pm_p = c^{d\bmod(p-1)}\bmod p and mq=cd mod (q−1) mod qm_q = c^{d\bmod(q-1)}\bmod q, then recombine.

ExampleExample 10.15 (p=11p = 11, q=23q = 23, e=3e = 3)

N=253N = 253, φ=220\varphi = 220, d=147d = 147 (since 3⋅147=441=2⋅220+13\cdot147 = 441 = 2\cdot220 + 1). m=01110012=57m = 0111001_2 = 57 and c=573 mod 253=250c = 57^3\bmod253 = 250. Decryption via CRT: 8147 mod 10=87≡2(mod11)8^{147\bmod10} = 8^7\equiv2\pmod{11} and 20147 mod 22=2015≡11(mod23)20^{147\bmod22} = 20^{15}\equiv11\pmod{23}, and indeed 57↔(2,11)57\leftrightarrow(2,11). (Checked by hand.)

Attacks on textbook RSA

WarningSmall ee, short messages

If e=3e = 3 and m<N1/3m < N^{1/3}, then m3<Nm^3 < N and no reduction happens, so m=c3m = \sqrt[3]c over the integers. A short message (under a third of ∥N∥\lVert N\rVert bits) leaks immediately.

WarningHåstad’s broadcast attack

The same mm sent with e=3e = 3 to three receivers N1,N2,N3N_1, N_2, N_3 (pairwise coprime, otherwise just factor them). CRT gives c^≡m3 mod N1N2N3\hat c\equiv m^3\bmod N_1N_2N_3, and since m<min⁡Nim < \min N_i, m3<N1N2N3m^3 < N_1N_2N_3. So m=c^3m = \sqrt[3]{\hat c} over the integers.

AlgorithmMeet in the middle: L\sqrt L instead of LL

For a random m<2ℓm < 2^\ell (say, a hybrid encryption key), with high probability m=r⋅sm = r\cdot s with r,s≤2αℓr, s\le2^{\alpha\ell} (12<α<1\frac12 < \alpha < 1). Compute and sort xr=c/re mod Nx_r = c/r^e\bmod N for r≤T=2αℓr\le T = 2^{\alpha\ell}, then look up ses^e for each ss. A match means c=(rs)ec = (rs)^e, giving m=rsm = rs. Time is about ℓ⋅2αℓ\ell\cdot2^{\alpha\ell}: an 80-bit key costs about 2402^{40} instead of 2802^{80}.

WarningCommon-modulus attacks

  • Insiders: a company giving every employee the same NN with different (ei,di)(e_i,d_i) lets any employee factor NN from its own (ei,di)(e_i,d_i) and compute everyone’s djd_j.
  • Outsiders: even with trusted insiders, the same mm sent under (N,e1)(N,e_1) and (N,e2)(N,e_2) with gcd⁡(e1,e2)=1\gcd(e_1,e_2) = 1 falls to an eavesdropper. Bézout gives Xe1+Ye2=1Xe_1 + Ye_2 = 1, so c1Xc2Y=mXe1+Ye2=mc_1^Xc_2^Y = m^{Xe_1+Ye_2} = m.

Padded RSA and PKCS #1 v1.5

AlgorithmPadded RSA (Construction 10.16)

For m∈{0,1}ℓ(n)m\in\{0,1\}^{\ell(n)}, choose random r∈{0,1}∥N∥−ℓ−1r\in\{0,1\}^{\lVert N\rVert-\ell-1} and set c=(r∥m)e mod Nc = (r\Vert m)^e\bmod N. Decrypt and keep the low ℓ\ell bits.

PaddingSecurity
ℓ=2n−O(log⁡n)\ell = 2n - O(\log n) (tiny padding)broken: brute-force the poly(n)\mathrm{poly}(n) paddings
ℓ=cn\ell = cn, c<2c < 2conjectured secure; proof only from an “ℓ\ell-padded RSA” assumption (Exercise 10.5)
ℓ=1\ell = 1CPA-secure under RSA (Theorem 10.17), because msb∥lsb\mathrm{msb}\Vert\mathrm{lsb} is hard-core for RSA and msb(r∥m)=0\mathrm{msb}(r\Vert m) = 0 (Exercise 10.6)

DefinitionPKCS #1 v1.5 encryption

With kk the byte length of NN, a DD-byte message (D≤k−11D\le k - 11) is encrypted as

(00 ∥ 02 ∥ r ∥ 00 ∥ m)e mod N\big(\texttt{00}\ \Vert\ \texttt{02}\ \Vert\ r\ \Vert\ \texttt{00}\ \Vert\ m\big)^e\bmod N

with rr consisting of k−D−3k - D - 3 random nonzero bytes (so the 00\texttt{00} separator is unambiguous). Believed CPA-secure with no proof. Broken under chosen-ciphertext attack (below), hence PKCS #1 v2 (RSA-OAEP).


ElGamal encryption

LemmaLemma 10.18 — Multiplying by a random element hides everything

For any fixed mm in a finite group G\mathbb G, m⋅gm\cdot g with uniform gg is uniform: Pr⁡[m⋅g=g^]=Pr⁡[g=m−1g^]=1/∣G∣\Pr[m\cdot g = \hat g] = \Pr[g = m^{-1}\hat g] = 1/\lvert\mathbb G\rvert. With a shared random gg this is a perfectly secret one-time pad over G\mathbb G (the OTP is the case G=({0,1}ℓ,⊕)\mathbb G = (\{0,1\}^\ell,\oplus)). ElGamal’s idea: replace the shared random pad with a pseudorandom one, hy=gxyh^y = g^{xy}, that the receiver can compute but which looks random to everyone else (DDH).

AlgorithmElGamal (Construction 10.19)

G(1n)\mathcal G(1^n) gives (G,q,g)(\mathbb G,q,g). Then x←Zqx\leftarrow\mathbb Z_q, pk=⟨G,q,g,h=gx⟩pk = \langle\mathbb G,q,g,h = g^x\rangle, sk=xsk = x.

Enc(m)=⟨gy, hy⋅m⟩ (y←Zq),Dec(c1,c2)=c2/c1x\mathrm{Enc}(m) = \langle g^y,\ h^y\cdot m\rangle\ (y\leftarrow\mathbb Z_q),\qquad\mathrm{Dec}(c_1,c_2) = c_2/c_1^x

Correctness: hym(gy)x=gxymgxy=m\frac{h^ym}{(g^y)^x} = \frac{g^{xy}m}{g^{xy}} = m. It is the Diffie–Hellman exchange with the receiver’s message published ahead of time as pkpk, and the DH key used as a one-time pad (Exercise 10.3 generalises: any 2-round key exchange gives CPA-secure PKE).

TheoremTheorem 10.20 — DDH ⇒ ElGamal is CPA-secure

ProofThe DH pad versus a random pad

In Π~\tilde\Pi, the ciphertext is ⟨gy,gz⋅m⟩\langle g^y, g^z\cdot m\rangle for random zz. By Lemma 10.18 it is independent of mm, so success is exactly 12\frac12. Distinguisher D(G,q,g,g1,g2,g3)D(\mathbb G,q,g,g_1,g_2,g_3): set pk=(…,g1)pk = (\ldots,g_1), get m0,m1m_0, m_1, give ⟨g2, g3mb⟩\langle g_2,\ g_3m_b\rangle, and output 1 iff A\mathcal A guesses bb.

  • On (gx,gy,gz)(g^x,g^y,g^z): A\mathcal A is in Π~\tilde\Pi, so DD outputs 1 with probability 12\frac12.
  • On (gx,gy,gxy)(g^x,g^y,g^{xy}): real ElGamal, so DD outputs 1 with probability ε\varepsilon.

DDH hardness gives ∣ε−12∣≤negl\lvert\varepsilon - \frac12\rvert\le\mathrm{negl}.

∎

ExampleEncoding into QRp\mathcal{QR}_p, worked (Example 10.21)

Encoding for a safe prime p=2q+1p = 2q + 1: an (n−1)(n-1)-bit string m^\hat m becomes mˉ=m^+1∈{1,…,q}\bar m = \hat m + 1\in\{1,\ldots,q\}, then m=mˉ2 mod pm = \bar m^2\bmod p. This is one-to-one, since of the two roots ±mˉ\pm\bar m exactly one lies in {1,…,q}\{1,\ldots,q\}. It inverts via modular square roots.

q=83q = 83, p=167p = 167, g=4g = 4, x=37x = 37, h=437 mod 167=76h = 4^{37}\bmod167 = 76. m^=011101=29\hat m = 011101 = 29, so mˉ=30\bar m = 30 and m=900 mod 167=65m = 900\bmod167 = 65. With y=71y = 71: c=(471,7671⋅65)=(132,44)c = (4^{71}, 76^{71}\cdot65) = (132, 44). Decrypt: 13237=124132^{37} = 124, 124−1=66124^{-1} = 66 (as 124⋅66=8184=49⋅167+1124\cdot66 = 8184 = 49\cdot167 + 1), and 44⋅66=2904≡6544\cdot66 = 2904\equiv65. The roots of 65 are 30 and 137, keep 30≤q30\le q, giving m^=29\hat m = 29. (Inverse and product checked by hand.)

NoteElGamal in practice

Widely used over elliptic-curve groups. Shared parameters (G,q,g)(\mathbb G,q,g) are fine: DDH is believed hard even for whoever generated them, so each user just picks its own xx. With RSA, by contrast, whoever generates NN knows its factorisation, so moduli can’t be shared.


Chosen-ciphertext attacks

IntuitionMore realistic here than in the private-key setting

A public-key receiver expects ciphertexts from many, possibly unknown senders. An adversary can:

  1. send c′c' while claiming to be the honest sender SS (forged email “From”), then infer something from the receiver’s behaviour;
  2. send c′c' in its own name, a possibility unique to public-key encryption, and perhaps get the decryption back directly.

ExampleCCA scenarios

  • Password oracle: a bank replies “invalid password” (non-alphanumeric) versus “password incorrect”. Submitting modified ciphertexts of a user’s encrypted password and watching the errors may reveal it. Replaying cc itself teaches nothing (and timestamps add yet another error type).
  • Quoting reply: an encrypted email c′c' gets answered with “you wrote: …”. Even an answer encrypted to the adversary hands back Dec(c′)\mathrm{Dec}(c'), so the receiver is a decryption oracle.
  • Malleable auction: if Enc(m)\mathrm{Enc}(m) can be turned into Enc(2m)\mathrm{Enc}(2m), the adversary always outbids SS without learning either bid. That is consistent with CPA security, and shows why non-malleability matters.

DefinitionCCA security (Def. 10.22)

PubKcca\mathrm{PubK}^{\mathrm{cca}}: A\mathcal A gets pkpk and a decryption oracle before and after the challenge, but may not query the challenge cc itself. CCA-secure if success is at most 12+negl\frac12 + \mathrm{negl}. (No encryption oracle is needed: pkpk provides it.) Constructions are more involved: Cramer–Shoup (DDH, about twice ElGamal’s cost) and RSA-OAEP (Chapter 13). This is the public-key counterpart of encrypt-then-MAC.

WarningEvery scheme so far falls to CCA

  • Textbook RSA: blinding. With random rr, query c′=re⋅c mod Nc' = r^e\cdot c\bmod N, get m′=rmm' = rm, output m=m′r−1m = m'r^{-1}. This destroys even “can’t recover a random mm”. Malleable: 2ec2^ec decrypts to 2m2m.
  • PKCS #1 v1.5: Bleichenbacher (1998). A server revealing only “padding valid / invalid” is enough to recover mm from many adaptively chosen ciphertexts. Such oracles are easy to get in practice (TLS error messages). This drove the move to OAEP, and descendants (ROBOT, 2017) keep turning up.
  • ElGamal: ⟨c1, c2⋅m′⟩\langle c_1,\ c_2\cdot m'\rangle encrypts m⋅m′m\cdot m'. To avoid a suspicious repeated c1c_1, re-randomise: ⟨c1gy′′, c2hy′′m′⟩\langle c_1g^{y''},\ c_2h^{y''}m'\rangle. CPA-secure, yet fully malleable.

Trapdoor permutations and generic public-key encryption

DefinitionTrapdoor permutation family (Def. 10.23)

(Gen,Samp,f,Inv)(\mathrm{Gen},\mathrm{Samp},f,\mathrm{Inv}): Gen(1n)\mathrm{Gen}(1^n) outputs an index II and a trapdoor tdtd. Forgetting tdtd leaves a one-way permutation family, while Invtd(fI(x))=x\mathrm{Inv}_{td}(f_I(x)) = x always. Example: RSA with td=dtd = d. Another: Rabin squaring over QRN\mathcal{QR}_N for Blum integers (below).

DefinitionHard-core predicate for a family (Def. 10.24)

hcI(x)hc_I(x) is hard-core if every ppt A\mathcal A predicts it from (I,fI(x))(I, f_I(x)) with probability at most 12+negl\frac12 + \mathrm{negl}. Every trapdoor permutation family can be modified to have one (Theorem 10.27, via Goldreich–Levin); RSA’s least-significant bit is hard-core.

AlgorithmPKE from any trapdoor permutation (Construction 10.25)

pk=Ipk = I, sk=(I,td)sk = (I,td). For one bit mm: x←DIx\leftarrow D_I, ciphertext ⟨fI(x), hcI(x)⊕m⟩\langle f_I(x),\ hc_I(x)\oplus m\rangle. Decrypt: x=fI−1(y)x = f_I^{-1}(y), output hcI(x)⊕m′hc_I(x)\oplus m'. The hard-core bit is a one-bit pseudorandom pad.

TheoremTheorem 10.26 — Construction 10.25 is CPA-secure

(The book’s statement says “chosen-ciphertext”, but the proof, and the truth, is chosen-plaintext. The scheme is clearly malleable: flip the second component.)

ProofEncryption adversary ⇒ hard-core-bit predictor

Assume without loss of generality m0≠m1m_0\ne m_1. Ah(I,y)\mathcal A_h(I,y): run A\mathcal A to get m0,m1m_0, m_1; pick random bits zz (a guess for hc(x)hc(x)) and bb; give ⟨y, mb⊕z⟩\langle y,\ m_b\oplus z\rangle. Output zz if A\mathcal A guesses bb, else zˉ\bar z.

  • If z=hc(x)z = hc(x), A\mathcal A sees a real encryption of mbm_b, so it is right with probability ε\varepsilon.
  • If z≠hc(x)z\ne hc(x), it sees an encryption of mbˉm_{\bar b}, so it is wrong with probability ε\varepsilon.

Then Pr⁡[Ah=hc(x)]=12(ε+ε)=ε\Pr[\mathcal A_h = hc(x)] = \frac12(\varepsilon + \varepsilon) = \varepsilon, which must be at most 12+negl\frac12 + \mathrm{negl}.

∎

NoteShorter ciphertexts for long messages

Bit-by-bit costs one fIf_I evaluation and one image per bit. Instead, iterate xi+1=fI(xi)x_{i+1} = f_I(x_i) and send ⟨xℓ+1, hc(x1)⊕m1,…,hc(xℓ)⊕mℓ⟩\langle x_{\ell+1},\ hc(x_1)\oplus m_1,\ldots,hc(x_\ell)\oplus m_\ell\rangle: one domain element plus ℓ\ell bits. The receiver inverts backwards using tdtd. Security follows from Blum–Micali PRG ideas (Blum–Goldwasser).


Chapter 11 — Additional schemes

Quadratic residues

DefinitionQuadratic residues modulo a prime

yy is a quadratic residue (QR) if y=x2y = x^2 for some xx, and a non-residue (QNR) otherwise. For an odd prime pp, every QR has exactly two roots ±x\pm x (Proposition 11.1: (x−x′)(x+x′)≡0(x - x')(x + x')\equiv0), so squaring is 2-to-1 and ∣QRp∣=∣QNRp∣=p−12\lvert\mathcal{QR}_p\rvert = \lvert\mathcal{QNR}_p\rvert = \frac{p-1}2. With a generator gg, the QRs are exactly the even powers g2ig^{2i}.

TheoremProposition 11.2 — Euler’s criterion

The Legendre/Jacobi symbol satisfies Jp(x)=x(p−1)/2 mod p∈{±1}\mathcal J_p(x) = x^{(p-1)/2}\bmod p\in\{\pm1\} (QR gives +1+1). Even powers give g(p−1)j=1g^{(p-1)j} = 1; odd powers give g(p−1)/2=−1g^{(p-1)/2} = -1, the only square root of 1 other than 1. So residuosity mod a prime is decidable by one exponentiation. It is multiplicative, Jp(xy)=Jp(x)Jp(y)\mathcal J_p(xy) = \mathcal J_p(x)\mathcal J_p(y): QR·QR and QNR·QNR are QRs, and QR·QNR is a QNR.

TheoremQuadratic residues modulo N=pqN = pq (Propositions 11.6, 11.8)

By CRT, y↔(yp,yq)y\leftrightarrow(y_p,y_q) is a QR mod NN iff both components are QRs. Each QR has four roots (±xp,±xq)(\pm x_p,\pm x_q), so ∣QRN∣=φ(N)/4\lvert\mathcal{QR}_N\rvert = \varphi(N)/4. With JN(x)=Jp(x)Jq(x)\mathcal J_N(x) = \mathcal J_p(x)\mathcal J_q(x):

  • half of ZN∗\mathbb Z_N^* is in JN+1\mathcal J_N^{+1};
  • QRN⊆JN+1\mathcal{QR}_N\subseteq\mathcal J_N^{+1};
  • half of JN+1\mathcal J_N^{+1} is QRN\mathcal{QR}_N, and the other half is QNRN+1\mathcal{QNR}_N^{+1} (both component symbols −1-1).

JN\mathcal J_N is multiplicative. QR·QNR+1^{+1} is in QNR+1^{+1} and QNR+1^{+1}·QNR+1^{+1} is a QR, but two arbitrary QNRs needn’t multiply to a QR.

ExampleThe four square roots of 4 mod 15 (Example 11.7)

2↔(2,2)2\leftrightarrow(2,2), so the roots are (2,2)↔2(2,2)\leftrightarrow2, (2,1)↔7(2,1)\leftrightarrow7, (3,2)↔8(3,2)\leftrightarrow8, (3,1)↔13(3,1)\leftrightarrow13. Check: 72=49≡47^2 = 49\equiv4, 82=64≡48^2 = 64\equiv4, 132=169≡413^2 = 169\equiv4.

DefinitionQuadratic residuosity assumption (Def. 11.11)

JN(x)\mathcal J_N(x) is computable without the factorisation (reciprocity-based algorithm), so JN=−1\mathcal J_N = -1 certifies a non-residue. But within JN+1\mathcal J_N^{+1} nobody efficiently tells QR from QNR+1^{+1}: ∣Pr⁡[A(N,qr)=1]−Pr⁡[A(N,qnr)=1]∣≤negl\lvert\Pr[\mathcal A(N,qr) = 1] - \Pr[\mathcal A(N,qnr) = 1]\rvert\le\mathrm{negl}. Knowing the factors makes it easy (check Jp\mathcal J_p and Jq\mathcal J_q). QR hardness implies factoring hardness. (A Gauss-era problem.)

Goldwasser–Micali encryption

AlgorithmGoldwasser–Micali (Construction 11.12)

pk=⟨N,z⟩pk = \langle N, z\rangle with z←QNRN+1z\leftarrow\mathcal{QNR}_N^{+1} (the receiver samples it by testing symbols: Exercise 11.3); sk=(p,q)sk = (p,q). For a bit mm:

c=zm⋅x2 mod N(x←ZN∗)c = z^m\cdot x^2\bmod N\quad(x\leftarrow\mathbb Z_N^*)

A random QR encrypts 0 and a random QNR+1^{+1} encrypts 1 (zx2zx^2 is uniform in QNRN+1\mathcal{QNR}_N^{+1}: Exercise 11.5). Decrypt by deciding residuosity with p,qp, q. The first provably secure (probabilistic) public-key scheme. Inefficient: one modular element per bit.

TheoremTheorem 11.13 — QR assumption ⇒ GM is CPA-secure

ProofReplace zz with a residue

D(N,z)D(N,z) runs A\mathcal A with pk=⟨N,z⟩pk = \langle N,z\rangle and outputs 1 iff A\mathcal A guesses bb.

  • z∈QNR+1z\in\mathcal{QNR}^{+1}: the real scheme, success ε\varepsilon.
  • z∈QRz\in\mathcal{QR}: both x2x^2 and zx2zx^2 are uniform in QRN\mathcal{QR}_N (Lemma 10.18 in the group QRN\mathcal{QR}_N), so the view is independent of bb and success is 12\frac12.

QR hardness gives ∣ε−12∣≤negl\lvert\varepsilon - \frac12\rvert\le\mathrm{negl}.

∎

ExampleVariants (Exercises 11.6–11.8, 11.12)

  • Blum integers (p≡q≡3 mod 4p\equiv q\equiv3\bmod4): −1∈QNRN+1-1\in\mathcal{QNR}_N^{+1}, since (−1)(p−1)/2=−1(-1)^{(p-1)/2} = -1 for p≡3 mod 4p\equiv3\bmod4. So c=(−1)mx2c = (-1)^mx^2 needs no zz in the key.
  • Repetition: encrypt 0 as nn random QRs and 1 as nn random JN+1\mathcal J_N^{+1} elements (sample x←ZN∗x\leftarrow\mathbb Z_N^* until JN(x)=1\mathcal J_N(x) = 1). Decrypt: “0” iff all are QRs. Error 2−n2^{-n}.
  • DDH fails in Zp∗\mathbb Z_p^*: Legendre symbols reveal the parities of xx and yy, hence of xyxy. Compare with the symbol of the third element: advantage about 14\frac14. That is why prime-order subgroups are needed.
  • XOR-homomorphic: c1c2=zm1+m2(x1x2)2c_1c_2 = z^{m_1+m_2}(x_1x_2)^2 encrypts m1⊕m2m_1\oplus m_2 (since z2z^2 is a QR).

(Worked here.)


Rabin: square roots and factoring

Computing square roots with the factorisation

AlgorithmSquare roots modulo a prime (Algorithm 11.16)

  • p≡3 mod 4p\equiv3\bmod4: x=a(p+1)/4 mod px = a^{(p+1)/4}\bmod p, since x2=a(p+1)/2=a⋅a(p−1)/2=ax^2 = a^{(p+1)/2} = a\cdot a^{(p-1)/2} = a.
  • p≡1 mod 4p\equiv1\bmod4 (Tonelli–Shanks style): write p−12=2ℓm\frac{p-1}2 = 2^\ell m with mm odd, and keep the invariant arbr′≡1a^rb^{r'}\equiv1 (rr odd-bound, r′r' even) using a non-residue bb (found by random sampling: half of all elements; no deterministic polynomial method is known). Repeatedly halve both exponents. Whenever the result is −1-1, multiply by b(p−1)/2=−1b^{(p-1)/2} = -1 to restore +1+1. At the end, with rr odd, a(r+1)/2br′/2a^{(r+1)/2}b^{r'/2} is a root.

ExampleWorked roots

  • p=29p = 29, a=22a = 22: 227⋅214≡122^7\cdot2^{14}\equiv1, so the root is 224⋅27=23⋅12=276≡1522^4\cdot2^7 = 23\cdot12 = 276\equiv15. Check: 152=225≡2215^2 = 225\equiv22.
  • p=29p = 29, a=7a = 7: 77≡17^7\equiv1 directly (exponent odd), so the root is 74=2401≡237^4 = 2401\equiv23. Check: 232=529≡723^2 = 529\equiv7.
  • p=17p = 17, a=4a = 4, b=3b = 3: 44=14^4 = 1, 42=−14^2 = -1 so multiply by 38=−13^8 = -1; then 4⋅34≡14\cdot3^4\equiv1, so the root is 4⋅32=36≡24\cdot3^2 = 36\equiv2.

(All checked by hand.)

NoteSquare roots modulo NN

Find roots of a mod pa\bmod p and a mod qa\bmod q and combine by CRT: all four roots come from the sign choices.

Square roots ⟺ factoring

LemmaLemma 11.20 — Unrelated roots factor NN

If x12≡x22x_1^2\equiv x_2^2 but x1≠±x2 mod Nx_1\ne\pm x_2\bmod N, then gcd⁡(N,x1+x2)\gcd(N,x_1 + x_2) (or gcd⁡(N,x1−x2)\gcd(N,x_1 - x_2)) is a prime factor of NN. In CRT form, x2↔(−x1,p,x1,q)x_2\leftrightarrow(-x_{1,p},x_{1,q}), so x1+x2↔(0,2x1,q)x_1 + x_2\leftrightarrow(0,2x_{1,q}): divisible by pp but not by qq. (The congruence-of-squares idea behind the quadratic sieve.)

TheoremTheorem 11.21 — Computing square roots is as hard as factoring

A square-root finder with success ε\varepsilon gives a factoring algorithm with success ε/2\varepsilon/2.

ProofChoose a root, ask for a root, hope for a different one

Afact(N)\mathcal A_{\mathrm{fact}}(N): pick x1←ZN∗x_1\leftarrow\mathbb Z_N^*, set y=x12y = x_1^2, and get x2←A(N,y)x_2\leftarrow\mathcal A(N,y). Since yy is a uniform QR, A\mathcal A succeeds with probability ε\varepsilon. Key point: x1x_1 is uniform among yy‘s four roots from A\mathcal A‘s point of view, so whichever root A\mathcal A outputs, it differs from ±x1\pm x_1 with probability exactly 12\frac12. That gives ε/2\varepsilon/2 by Lemma 11.20. No assumption on how A\mathcal A chooses among roots is needed.

∎

DefinitionBlum integers and the Rabin trapdoor permutation

N=pqN = pq with p≡q≡3 mod 4p\equiv q\equiv3\bmod4. Proposition 11.22: every QR has exactly one square root that is itself a QR. (−1-1 is a non-residue mod pp and mod qq, so exactly one sign pattern makes both components residues.) Hence

fN(x)=x2 mod Nf_N(x) = x^2\bmod N

is a permutation of QRN\mathcal{QR}_N: one-way if factoring is hard, with trapdoor (p,q)(p,q). Theorem 11.23: factoring hard ⇒ trapdoor permutations exist. (Exercise 11.10 gives a variant permuting {x<N/2:JN(x)=1}\{x < N/2 : \mathcal J_N(x) = 1\}.)

AlgorithmRabin encryption

  • Generic: Construction 10.25 with lsb\mathrm{lsb}, which is hard-core for Rabin.
  • Padded Rabin (Construction 11.24, one bit): pick r∈{0,1}∥N∥−2r\in\{0,1\}^{\lVert N\rVert-2} until r∥m∈QRNr\Vert m\in\mathcal{QR}_N, then c=(r∥m)2 mod Nc = (r\Vert m)^2\bmod N. Decrypt: the unique QR root, keep its lowest bit. CPA-secure if factoring is hard (Theorem 11.25). Exercise 11.11 extends to nn-bit messages, using the extra bits JN(x)\mathcal J_N(x) and "x<N/2x < N/2" to make x↦(x2,JN,half)x\mapsto(x^2,\mathcal J_N,\mathrm{half}) injective, with no proof.

ImportantRabin versus RSA

RabinRSA
Hardnessequivalent to factoringnot known to be; RSA may be easier
Forward costone squaringee-th power, slightly slower for large ee
Domaina permutation of QRN\mathcal{QR}_N only (more care)all of ZN∗\mathbb Z_N^*
Textbook-version CCAreveals the private keyblinding attack, but no key recovery
Adoptionraredominant, largely historical accident

Textbook Rabin’s key-recovery CCA (Exercise 11.9): pick xx with JN(x)=−1\mathcal J_N(x) = -1 (so x∉QRNx\notin\mathcal{QR}_N) and submit c=x2c = x^2. The decryptor returns the QR root yy, necessarily y≠±xy\ne\pm x (since −x-x also has symbol −1-1 for Blum NN). Then gcd⁡(x−y,N)\gcd(x - y,N) factors NN.


Paillier encryption

TheoremProposition 11.26 — The structure of ZN2∗\mathbb Z_{N^2}^*

For N=pqN = pq with p,qp, q distinct primes of equal length:

  1. gcd⁡(N,φ(N))=1\gcd(N,\varphi(N)) = 1 (equal length means q∤p−1q\nmid p - 1);
  2. (1+N)a≡1+aN(modN2)(1+N)^a\equiv1 + aN\pmod{N^2} (binomial theorem; terms with N≥2N^{\ge2} vanish), so 1+N1 + N has order NN;
  3. ZN×ZN∗≃ZN2∗\mathbb Z_N\times\mathbb Z_N^*\simeq\mathbb Z_{N^2}^* via f(a,b)=(1+N)a⋅bN mod N2f(a,b) = (1+N)^a\cdot b^N\bmod N^2.
ProofWhy ff is an isomorphism (Claims 11.27–11.29)

Sizes match: φ(N2)=Nφ(N)\varphi(N^2) = N\varphi(N).

Injective: f(a1,b1)=f(a2,b2)f(a_1,b_1) = f(a_2,b_2) gives (1+N)a1−a2(b1/b2)N≡1(1+N)^{a_1-a_2}(b_1/b_2)^N\equiv1. Raising to φ(N)\varphi(N) kills the second factor (the group order is Nφ(N)N\varphi(N)). So N∣(a1−a2)φ(N)N\mid(a_1 - a_2)\varphi(N), hence a1=a2a_1 = a_2. Then b1N≡b2N mod Nb_1^N\equiv b_2^N\bmod N, and since x↦xNx\mapsto x^N is a permutation of ZN∗\mathbb Z_N^* (gcd⁡(N,φ(N))=1\gcd(N,\varphi(N)) = 1), b1=b2b_1 = b_2.

Homomorphism: exponents of 1+N1 + N live mod NN, and (b1b2)N mod N2(b_1b_2)^N\bmod N^2 depends only on b1b2 mod Nb_1b_2\bmod N (binomial expansion of (r+γN)N(r + \gamma N)^N).

∎

DefinitionNN-th residues and the DCR assumption (Def. 11.30)

x↔(a,b)x\leftrightarrow(a,b) gives xN↔(0,bN)x^N\leftrightarrow(0,b^N), so the NN-th residues are exactly Res(N2)↔{(0,b)}\mathrm{Res}(N^2)\leftrightarrow\{(0,b)\}. Decisional composite residuosity: a random NN-th residue (0,r)(0,r) is indistinguishable from a random element (r′,r)(r',r): ∣Pr⁡[A(N,rN mod N2)=1]−Pr⁡[A(N,r)=1]∣≤negl\lvert\Pr[\mathcal A(N, r^N\bmod N^2) = 1] - \Pr[\mathcal A(N,r) = 1]\rvert\le\mathrm{negl}. A generalisation of quadratic residuosity.

AlgorithmPaillier (Construction 11.32)

pk=Npk = N, sk=φ(N)sk = \varphi(N). For m∈ZNm\in\mathbb Z_N, r←ZN∗r\leftarrow\mathbb Z_N^*:

c=(1+N)m⋅rN mod N2 ↔ (m,r)c = (1+N)^m\cdot r^N\bmod N^2\ \leftrightarrow\ (m,r)

Dec(c)=[cφ(N) mod N2]−1N⋅φ(N)−1 mod N\mathrm{Dec}(c) = \frac{[c^{\varphi(N)}\bmod N^2] - 1}N\cdot\varphi(N)^{-1}\bmod N

Why decryption works: cφ(N)↔(mφ(N),rφ(N)=1)c^{\varphi(N)}\leftrightarrow(m\varphi(N), r^{\varphi(N)} = 1), i.e. (1+N)mφ(N)=1+mφ(N)N(1+N)^{m\varphi(N)} = 1 + m\varphi(N)N. Subtract 1, divide by NN, multiply by φ(N)−1\varphi(N)^{-1}. Intuition: the ciphertext is (m,1)⋅(0,r)(m,1)\cdot(0,r); DCR lets you swap the residue (0,r)(0,r) for a random (r′,r)(r',r), which pads mm perfectly in ZN\mathbb Z_N.

ExampleExample 11.31 (N=11⋅17=187N = 11\cdot17 = 187, N2=34969N^2 = 34969)

m=175m = 175, r=83r = 83: c=188175⋅83187 mod 34969=23911c = 188^{175}\cdot83^{187}\bmod34969 = 23911. With φ=160\varphi = 160: c^=23911160 mod N2=25620\hat c = 23911^{160}\bmod N^2 = 25620, so m^=(25620−1)/187=137\hat m = (25620 - 1)/187 = 137. Then 160−1≡90(mod187)160^{-1}\equiv90\pmod{187} (as 160⋅90=14400=77⋅187+1160\cdot90 = 14400 = 77\cdot187 + 1), and 137⋅90=12330≡175137\cdot90 = 12330\equiv175. (Final steps checked by hand.)

TheoremTheorem 11.33 — DCR ⇒ Paillier is CPA-secure

D(N,y)D(N,y) gives A\mathcal A the ciphertext (1+N)mb⋅y(1+N)^{m_b}\cdot y. If y=rNy = r^N, this is real Paillier (success ε\varepsilon; rr uniform in ZN2∗\mathbb Z_{N^2}^* or ZN∗\mathbb Z_N^* gives the same rNr^N distribution). If yy is uniform in ZN2∗\mathbb Z_{N^2}^*, the ciphertext is uniform (Lemma 10.18), so success is 12\frac12. DCR gives ∣ε−12∣≤negl\lvert\varepsilon - \frac12\rvert\le\mathrm{negl}.

Homomorphic encryption

DefinitionHomomorphic encryption (Def. 11.34)

Plaintexts in a group M\mathcal M, ciphertexts in a group C\mathcal C, and Dec(c1⋅c2)=Dec(c1)⋅Dec(c2)\mathrm{Dec}(c_1\cdot c_2) = \mathrm{Dec}(c_1)\cdot\mathrm{Dec}(c_2).

SchemeC\mathcal CM\mathcal MOperation on plaintexts
PaillierZN2∗\mathbb Z_{N^2}^*(ZN,+)(\mathbb Z_N,+)addition mod NN (and ckc^k gives kmkm)
ElGamalG×G\mathbb G\times\mathbb GG\mathbb Gmultiplication
Goldwasser–MicaliZN∗\mathbb Z_N^*Z2\mathbb Z_2XOR

Homomorphism is malleability by design: these schemes cannot be CCA-secure.

ExampleEncrypted voting with Paillier

  1. The authority publishes NN.
  2. Voter ii casts ci=(1+N)viriNc_i = (1+N)^{v_i}r_i^N with vi∈{0,1}v_i\in\{0,1\} (no/yes).
  3. Everyone multiplies the ballots: c∗=∏ci mod N2c^* = \prod c_i\bmod N^2, which encrypts ∑vi\sum v_i.
  4. The authority decrypts only c∗c^*: the tally without any individual vote.

This assumes honest behaviour. Cheaters (for example a ballot encrypting v=5v = 5) need zero-knowledge validity proofs, threshold decryption, and the like, which belong to the field of secure protocols.


The random oracle model, CPA/CCA RSA encryption, and OAEP

NoteModel

Proofs here treat a hash HH as a public random function; see the random oracle model for the methodology, its proof techniques (lazy sampling, programming, observing queries) and its caveats. All constructions work with any trapdoor permutation; RSA is the usual instance.

AlgorithmCPA-secure RSA in the ROM (Construction 13.1)

c=⟨re mod N, H(r)⊕m⟩c = \langle r^e\bmod N,\ H(r)\oplus m\rangle for random r∈ZN∗r\in\mathbb Z_N^*; decrypt r=c1dr = c_1^d, then m=H(r)⊕c2m = H(r)\oplus c_2. As efficient as textbook RSA plus one hash. Why the ROM matters: RSA only says rr can’t be recovered entirely; a partial leak could ruin G(r)G(r) for a PRG GG, but H(r)H(r) stays uniform until rr itself is queried.

TheoremTheorem 13.2 — RSA ⇒ Construction 13.1 is CPA-secure (ROM)

Let Query\mathsf{Query} be the event that A\mathcal A queries H(r)H(r).

  • Without it, H(r)H(r) is a one-time pad: Pr⁡[Succ∧¬Query]≤12\Pr[\mathsf{Succ}\wedge\neg\mathsf{Query}]\le\frac12.
  • Pr⁡[Query]\Pr[\mathsf{Query}] is negligible: given an RSA instance (N,e,c1)(N,e,c_1), run A\mathcal A with c2c_2 random, simulate HH lazily, and watch the queries for xx with xe=c1x^e = c_1. The view is perfect, so RSA is solved with probability exactly Pr⁡[Query]\Pr[\mathsf{Query}].

AlgorithmCCA-secure RSA in the ROM (Construction 13.5)

c=⟨re mod N, EncH(r)′(m)⟩c = \langle r^e\bmod N,\ \mathrm{Enc}'_{H(r)}(m)\rangle with Π′\Pi' a CCA-secure private-key scheme (encrypt-then-MAC). Construction 13.1 is this with the one-time pad, and works with any CPA-secure Π′\Pi' (Exercise 13.3).

TheoremTheorem 13.6 — RSA + CCA-secure Π′\Pi' ⇒ Construction 13.5 is CCA-secure (ROM)

  • Without Query\mathsf{Query}: reduce to Π′\Pi'‘s CCA game, implicitly setting H(r)=kH(r) = k (the Π′\Pi' challenger’s key). Decryption queries with first component c1c_1 go to the Π′\Pi' oracle; others are decrypted with dd, which the reduction knows. The views agree until Query\mathsf{Query}.
  • Pr⁡[Query]\Pr[\mathsf{Query}] negligible: now there is no dd, so program the oracle with a table of triples (r^ or ?, c^1, k^)(\hat r\ \text{or}\ ?,\ \hat c_1,\ \hat k). Answer a decryption query ⟨cˉ1,cˉ2⟩\langle\bar c_1,\bar c_2\rangle with Deckˉ′(cˉ2)\mathrm{Dec}'_{\bar k}(\bar c_2), where kˉ\bar k is the key stored for cˉ1\bar c_1 (fresh if none: entry (?,cˉ1,kˉ)(?,\bar c_1,\bar k), implicitly H(cˉ11/e)=kˉH(\bar c_1^{1/e}) = \bar k). Answer a hash query rˉ\bar r by looking up rˉe\bar r^e in the second column, keeping the two consistent. The challenge gets entry (?,c1,k)(?,c_1,k); if A\mathcal A ever hashes rr with re=c1r^e = c_1, output rr.

AlgorithmRSA-OAEP (Construction 13.9; Bellare–Rogaway)

Two oracles G,H:{0,1}n→{0,1}nG, H : \{0,1\}^n\to\{0,1\}^n, ∥N∥>2n\lVert N\rVert > 2n, message m∈{0,1}n/2m\in\{0,1\}^{n/2}, random r∈{0,1}nr\in\{0,1\}^n:

m^1=G(r)⊕(m∥0n/2),m^=m^1 ∥ (r⊕H(m^1)),c=m^e mod N\hat m_1 = G(r)\oplus(m\Vert0^{n/2}),\qquad\hat m = \hat m_1\ \Vert\ \big(r\oplus H(\hat m_1)\big),\qquad c = \hat m^e\bmod N

(The book’s prose says m^d\hat m^d; the construction box correctly has ee.) Decrypt m^=cd\hat m = c^d, split it, recover r=H(m^1)⊕m^2r = H(\hat m_1)\oplus\hat m_2, then m′=m^1⊕G(r)m' = \hat m_1\oplus G(r); output ⊥\perp unless the last n/2n/2 bits are zero (this redundancy check is what rejects mauled ciphertexts). A two-round Feistel-like padding: the ciphertext is one element of ZN∗\mathbb Z_N^* (Construction 13.5 also carries a private-key ciphertext), so it is ideal for short messages and key transport in hybrid encryption.

Security: CCA-secure under RSA with G,HG, H random oracles, for suitable ee including e=3e = 3; the original proof was flawed (Shoup) and later repaired for RSA (Fujisaki–Okamoto–Pointcheval–Stern), and OAEP+ variants handle general trapdoor permutations. Standardised as PKCS #1 v2.1, the replacement for the Bleichenbacher-broken v1.5 padding. (Implementations must not leak which check failed: Manger’s attack, my addition.)


Quick reference

ObjectStatementNote
Settingpublish pkpk; authenticated distribution assumedabout 100–1000× slower than private-key
EAV ⇒ CPAadversary holds pkpkunlike private-key
Impossibilitiesno perfect secrecy; no deterministic schemegrade example
Multi-messagehybrid over positions, loss factor ttbit-by-bit extension
Hybrid encryption⟨Encpk(k),Enck′(m)⟩\langle\mathrm{Enc}_{pk}(k),\mathrm{Enc}'_k(m)\rangleneeds only EAV-secure Π′\Pi'
Textbook RSAme mod Nm^e\bmod Ndeterministic, malleable, blindable
RSA attackscube root; Håstad; L\sqrt L; common modulus
Padded RSArandom r∥mr\Vert mℓ=1\ell = 1 provable; PKCS #1 v1.5 heuristic
ElGamal⟨gy,hym⟩\langle g^y,h^ym\rangleDDH ⇒ CPA; multiplicatively malleable
CCAdecryption oracle except on the challengeall schemes above fail
Bleichenbacherv1.5 padding oracle recovers mmled to OAEP
Trapdoor permutation PKE⟨f(x),hc(x)⊕m⟩\langle f(x),hc(x)\oplus m\rangleCPA (book says CCA, a typo)
Euler criterionJp(x)=x(p−1)/2\mathcal J_p(x) = x^{(p-1)/2}QR mod pp is easy
QR mod NN14\frac14 of ZN∗\mathbb Z_N^*; 12\frac12 of J+1\mathcal J^{+1}4 roots
QR assumptionQR versus QNR+1^{+1} hard without factors
Goldwasser–Micalizmx2z^mx^2first provably secure scheme
Square rootsa(p+1)/4a^{(p+1)/4} (p≡3p\equiv3); Tonelli–ShanksCRT for NN
Roots ⟺ factoringunrelated roots give gcd⁡\gcd; success ε/2\varepsilon/2
Rabinsquaring on QRN\mathcal{QR}_N, Blum NNas hard as factoring; textbook CCA leaks key
Paillier(1+N)mrN mod N2(1+N)^mr^N\bmod N^2DCR; additively homomorphic
Votingmultiply ballots, decrypt the tallyhonest-but-curious only

Facts to keep to hand

  • Public keys make the encryption oracle free. Eavesdropping security is CPA security, deterministic schemes are hopeless, perfect secrecy is impossible, and single-message security extends to many messages by a hybrid argument.
  • Real systems are hybrid. Public-key encryption moves a fresh key, private-key encryption moves the data, and the proof swaps the encrypted key for zeros so the one-time private-key scheme sees an independent key.
  • Textbook schemes are insecure; randomisation and structure fix CPA, not CCA. Textbook RSA leaks via small exponents, shared moduli and malleability. Padded RSA, ElGamal (DDH), Goldwasser–Micali (QR), Rabin (factoring) and Paillier (DCR) are CPA-secure, yet all are malleable. CCA needs more (Cramer–Shoup, OAEP), and padding oracles (Bleichenbacher) show the threat is practical.
  • Number-theoretic trapdoors drive everything. Trapdoor permutations plus hard-core bits give generic encryption. Square roots are equivalent to factoring (the Rabin advantage). ZN2∗≃ZN×ZN∗\mathbb Z_{N^2}^*\simeq\mathbb Z_N\times\mathbb Z_N^* yields Paillier’s additive homomorphism, useful for privacy-preserving computation such as voting.

References

  • Katz & Lindell, Introduction to Modern Cryptography — Chapters 10–11
  • Goldwasser & Micali, “Probabilistic Encryption” (1984)
  • ElGamal, “A Public Key Cryptosystem and a Signature Scheme Based on Discrete Logarithms” (1985)
  • Bleichenbacher, “Chosen Ciphertext Attacks Against Protocols Based on the RSA Encryption Standard PKCS #1” (1998)
  • Paillier, “Public-Key Cryptosystems Based on Composite Degree Residuosity Classes” (1999)

← All notes