Textbook Goldwasser–Micali QNR_N^{+1} key generation and IND-CPA security #
Formalizes the strict-PPT textbook Goldwasser–Micali key generator over general distinct odd primes
p ≠ q (ModulusDesc, without restricting to Blum moduli p ≡ q ≡ 3 (mod 4)) and its single-bit
and bitwise multi-bit chosen-plaintext security steps toward #5293 from QuadraticResiduosityHard
alone, parameterized by a modulus generator gen : ℕ → ProbComp ModulusDesc (native prime-pair
modulus generation remains tracked in #5293 §3; after [KL20], Section 15.4.4,
Construction 15.28 and Theorem 15.29, locator not verified, #5578):
- Per-prime rejection sampling (
isNonresidueModPrime,sampleNonresidueModPrime): for an odd primep, Euler's criterion tests non-squareness in(ZMod p)ˣviaa ^ ((p - 1) / 2) mod p == p - 1(isNonresidueModPrime_eq_true_iff). Because(p - 1) / 2of the(p - 1)units are quadratic nonresidues and2 ^ (p.size - 1) ≤ p - 1, a single(encNat p).length-bit fair-coin block accepts with probability at least1 / 4and has zero conditional modular bias. Running3 * (n + 1)blocks (sampleNonresidueModPrime) fails with probability at most(27 / 64) ^ (n + 1) ≤ 1 / 2 ^ (n + 1)(toOuterMeasure_not_isNonresidueModPrime_le) and is uniformly strict PPT (isPPTOn_sampleNonresidueModPrime). - Polynomial-time Chinese remainder recombination (
textbookPublicKey,textbookKeyGen): recombining(z_p % p, z_q)modulo(p, q)viaCslib.crtCombineandBinaryGcd.modInv p qproduces a residue< p * qmatching(ZMod.unitsChineseRemainder _).symminpositiveNonresidues p q(QNR_N^{+1};crtCombine_modInv_eq_unitsChineseRemainder_symm_val,exists_posNonresidue_crtCombine,KeyDesc.ofNonresidues). - Statistical closeness and correctness: for every modulus sampler
gen : ℕ → ProbComp ModulusDesc,(ProbComp.eval (textbookKeyGen gen n)).map Prod.fstis within1 / 2 ^ nstatistical distance (CloseTo) of the exact uniform lawpublicKeyLaw(closeTo_textbookKeyGen_publicKeyLaw), decryption succeeds deterministically whenever both rejection loops accept (decrypt_encrypt_of_isNonresidueModPrime,decryptWord_encryptWord_of_isNonresidueModPrime), and key generation produces a validKeyDescwith probability at least1 - 1 / 2 ^ n(toOuterMeasure_not_exists_keyDesc_textbookKeyGen_le,closeTo_decrypt_encrypt_textbookKeyGen,closeTo_decryptWord_encryptWord_textbookKeyGen). - Single-bit and multi-bit IND-CPA steps from
QuadraticResiduosityHardalone: combiningcloseTo_textbookKeyGen_publicKeyLawwithadvantage_idealPublicKeyGame_le_qrandadvantage_idealPublicKeyWordGame_le_qrproves quantitative bounds with factor-2QR loss independent of message length (advantage_textbookGame_le_qr,advantage_textbookWordGame_le_qr), single-bitEncryption.INDCPA(indcpa_textbookGoldwasserMicali), and multi-bitEncryption.WordINDCPA(wordINDCPA_textbookGoldwasserMicali) without any Blum-modulus or ideal-key hypothesis.
Main definitions #
Cslib.Crypto.GoldwasserMicali.isNonresidueModPrime: Euler-criterion nonresidue test modulo an odd prime.Cslib.Crypto.GoldwasserMicali.sampleNonresidueModPrime:3 * (n + 1)-trial fair-bit block-rejection strict-PPT nonresidue sampler.Cslib.Crypto.GoldwasserMicali.textbookPublicKey,Cslib.Crypto.GoldwasserMicali.textbookKeyGen: CRT public-key encoder (Cslib.crtCombinewithBinaryGcd.modInv) and textbook Goldwasser–Micali key generator.Cslib.Crypto.GoldwasserMicali.KeyDesc.ofNonresidues: validKeyDescconstructed from accepted per-prime nonresidues (@[expose],KeyDesc.ofNonresidues_toModulusDesc,KeyDesc.ofNonresidues_z).
Main results #
Cslib.Crypto.GoldwasserMicali.isNonresidueModPrime_eq_true_iff,Cslib.Crypto.GoldwasserMicali.toOuterMeasure_not_isNonresidueModPrime_le: Euler's criterion characterization and1 / 2 ^ (n + 1)rejection-failure bound forsampleNonresidueModPrime.Cslib.Crypto.GoldwasserMicali.crtCombine_modInv_eq_unitsChineseRemainder_symm_val,Cslib.Crypto.GoldwasserMicali.exists_posNonresidue_crtCombine: unit-CRT andpositiveNonresiduescharacterizations ofCslib.crtCombinewithBinaryGcd.modInv.Cslib.Crypto.GoldwasserMicali.computableInPolyTime_isNonresidueModPrime,Cslib.Crypto.GoldwasserMicali.isPPTOn_sampleNonresidueModPrime,Cslib.Crypto.GoldwasserMicali.isPPTOn_textbookKeyGen: polynomial-time and uniform strict-PPT certificates.Cslib.Crypto.GoldwasserMicali.decrypt_encrypt_of_isNonresidueModPrime,Cslib.Crypto.GoldwasserMicali.decryptWord_encryptWord_of_isNonresidueModPrime,Cslib.Crypto.GoldwasserMicali.toOuterMeasure_not_exists_keyDesc_textbookKeyGen_le,Cslib.Crypto.GoldwasserMicali.closeTo_decrypt_encrypt_textbookKeyGen,Cslib.Crypto.GoldwasserMicali.closeTo_decryptWord_encryptWord_textbookKeyGen: conditional deterministic and statistical round-trip decryption correctness.Cslib.Crypto.GoldwasserMicali.closeTo_textbookKeyGen_publicKeyLaw:1 / 2 ^ nstatistical closeness between(ProbComp.eval (textbookKeyGen gen n)).map Prod.fstandpublicKeyLaw.Cslib.Crypto.GoldwasserMicali.advantage_textbookGame_le_qr,Cslib.Crypto.GoldwasserMicali.indcpa_textbookGoldwasserMicali,Cslib.Crypto.GoldwasserMicali.length_textbookPublicKey_le,Cslib.Crypto.GoldwasserMicali.advantage_textbookWordGame_le_qr,Cslib.Crypto.GoldwasserMicali.wordINDCPA_textbookGoldwasserMicali: quantitative bounds and asymptotic single-bit and multi-bit IND-CPA security fromQuadraticResiduosityHardalone.
References #
- J. Katz, Y. Lindell, Introduction to Modern Cryptography, 3rd ed., Section 15.4.4 (Construction 15.28 and Theorem 15.29; locator not verified).
Euler-criterion nonresidue test and capped fair-bit rejection sampler #
Euler-criterion test for quadratic nonresidues modulo an odd prime p: returns true when
0 < a < p and a ^ ((p - 1) / 2) mod p = p - 1.
Capped strict-PPT sampler for a quadratic nonresidue modulo p at security parameter n:
run 3 * (n + 1) independent (encNat p).length-bit fair-coin rejection blocks testing
isNonresidueModPrime p ∘ BitString.binaryValue, returning 1 if all blocks reject.
For an odd prime p, isNonresidueModPrime p a holds iff a is the canonical natural
representative of a non-square unit in (ZMod p)ˣ.
Polynomial-time Chinese remainder recombination (Cslib.crtCombine + BinaryGcd.modInv) #
Encoded Goldwasser–Micali public key ⟨p * q, crtCombine p q (z_p % p) z_q (modInv p q)⟩ built
from prime factors (p, q) and per-prime residues (z_p, z_q).
Textbook Goldwasser–Micali key generation (after [KL20], Section 15.4.4,
Construction 15.28, locator not verified, #5578): draw d ← gen n, independently sample z_p and
z_q via capped fair-bit rejection sampling (sampleNonresidueModPrime), and output
pk = textbookPublicKey d.p d.q z_p z_q and sk = ⟨d.p, d.q⟩.
Key pairs in the support of textbookKeyGen gen n arise from a supported ModulusDesc and
per-prime residues (z_p, z_q).
On canonical natural representatives of (u_p, u_q) : (ZMod d.p)ˣ × (ZMod d.q)ˣ,
crtCombine d.p d.q (u_p.val.val % d.p) u_q.val.val (BinaryGcd.modInv d.p d.q) computes the
canonical natural representative of (ZMod.unitsChineseRemainder hcop).symm (u_p, u_q).
Combining accepted per-prime nonresidues (z_p, z_q) via Cslib.crtCombine and
BinaryGcd.modInv yields the canonical natural representative of an element of
positiveNonresidues d.p d.q (QNR_N^{+1}).
Construct a valid KeyDesc (z ∈ QNR_N^{+1}) from d : ModulusDesc and any pair (z_p, z_q)
passing isNonresidueModPrime.
Underlying modulus descriptor of KeyDesc.ofNonresidues d hp hq.
Public nonresidue z of KeyDesc.ofNonresidues d hp hq.
Polynomial-time and uniform strict-PPT certificates #
isNonresidueModPrime is computable in polynomial time on binary naturals.
sampleNonresidueModPrime is uniformly strict PPT for a unary security parameter and binary
modulus.
textbookKeyGen gen is uniformly strict PPT whenever the modulus sampler gen is.
Rejection-sampling law, 1 / 2 ^ n closeness to publicKeyLaw, and correctness #
At security parameter n, sampleNonresidueModPrime n p fails to output a quadratic
nonresidue modulo p (isNonresidueModPrime p a = false) with probability at most
1 / 2 ^ (n + 1).
Statistical closeness of textbookKeyGen gen to publicKeyLaw (after [KL20],
Section 15.4.4, Construction 15.28, locator not verified): for any modulus sampler
gen : ℕ → ProbComp ModulusDesc (without any Blum or bit-length hypothesis), the public-key
marginal of textbookKeyGen gen n is within 1 / 2 ^ n statistical distance (CloseTo) of the
exact uniform QNR_N^{+1} law publicKeyLaw (fun k => ProbComp.eval (gen k)) n.
Conditional deterministic and statistical decryption correctness #
Deterministic conditional correctness for 1-bit encryption: whenever z_p and z_q satisfy
isNonresidueModPrime for d : ModulusDesc, every supported ciphertext of encrypt under
textbookPublicKey d.p d.q z_p z_q decrypts to m.
Deterministic conditional correctness for bitwise multi-bit encryption: whenever z_p and
z_q satisfy isNonresidueModPrime for d : ModulusDesc, every supported ciphertext of
encryptWord under textbookPublicKey d.p d.q z_p z_q decrypts to bits.
Over keys ← textbookKeyGen gen n, the probability that keys fails to arise from a valid
KeyDesc (z ∈ QNR_N^{+1}) is at most 1 / 2 ^ n. Outside that 1 / 2 ^ n rejection tail, every
1-bit and multi-bit encryption under keys.1 decrypts deterministically with zero error under
keys.2.
Statistical round-trip decryption correctness for 1-bit Goldwasser–Micali under
textbookKeyGen gen: for every message bit m, generating keys and encrypting m decrypts to
m up to at most 1 / 2 ^ n statistical distance (CloseTo).
Statistical round-trip decryption correctness for bitwise multi-bit Goldwasser–Micali under
textbookKeyGen gen: for every bit word bits, generating keys and encrypting bits with
encryptWord decrypts via decryptWord to bits up to at most 1 / 2 ^ n statistical distance
(CloseTo).
Single-bit and multi-bit IND-CPA security from QuadraticResiduosityHard alone #
Quantitative single-bit IND-CPA step for (textbookKeyGen gen, encrypt) (after
[KL20], Section 15.4.4, Theorem 15.29, locator not verified): when gen n draws
distinct odd primes of at least n bits, every adversary's IND-CPA advantage is at most twice
qrDistinguisher adversary's QR advantage plus 12 / 2 ^ n (10 / 2 ^ n from unit sampling and
2 / 2 ^ n from capped QNR_N^{+1} key generation).
Single-bit IND-CPA step toward #5293 for textbook Goldwasser–Micali encryption
(textbookKeyGen gen, encrypt) from QuadraticResiduosityHard alone, parameterized by a modulus
generator gen : ℕ → ProbComp ModulusDesc (native modulus generation tracked in #5293 §3; after
[KL20], Section 15.4.4, Construction 15.28 and Theorem 15.29, locator not verified,
#5578). Let gen draw distinct odd n-bit primes (ModulusDesc, with no Blum restriction). If
quadratic residuosity is hard relative to gen, then (textbookKeyGen gen, encrypt) satisfies
Encryption.INDCPA against all uniform strict-PPT adversaries. Neither indistinguishability of keys
from an ideal law nor computability of gen is assumed.
Encoded bit length of textbookPublicKey p q z_p z_q in terms of an upper bound B on
p.size and q.size, valid for all z_p, z_q : ℕ whenever 0 < p and 0 < q.
Quantitative multi-bit IND-CPA step for (textbookKeyGen gen, encryptWord) on bounded-length
words (after [KL20], Section 15.4.4, locator not verified, #5578): via lossy
quadratic-residue public keys, bitwise encryption of equal-length words of length at most
maxLen n reduces to QuadraticResiduosityHard with factor-2 loss (independent of
maxLen n) plus (10 * maxLen n + 2) / 2 ^ n.
Multi-bit IND-CPA step toward #5293 for textbook bitwise Goldwasser–Micali encryption
(textbookKeyGen gen, encryptWord) from QuadraticResiduosityHard alone, parameterized by a
modulus generator gen : ℕ → ProbComp ModulusDesc (native modulus generation tracked in #5293 §3;
after [KL20], Section 15.4.4, Construction 15.28 and Theorem 15.29, locator not
verified, #5578). Let gen draw distinct odd primes (ModulusDesc, with no Blum restriction) whose
bit-lengths are at least n and at most sizeBound n for a polynomially bounded function
sizeBound (for example fun n => n + c, or the output cap of any uniform strict-PPT gen). If
quadratic residuosity is hard relative to gen, then (textbookKeyGen gen, encryptWord) satisfies
Encryption.WordINDCPA against all uniform strict-PPT word adversaries, with factor-2 QR
reduction loss independent of message length (advantage_textbookWordGame_le_qr).