Goldwasser–Micali public-key encryption #
The Goldwasser–Micali probabilistic public-key encryption scheme ([KL20], Section 15.4.4,
Construction 15.28, Theorem 15.29, and Exercises 15.11–15.12) over distinct odd primes p ≠ q with
modulus N = p * q and public nonresidue z ∈ QNR_N^{+1}:
- Keys (
KeyDesc,keyGen,KeyDesc.ofBlum,blumKeyGen):pk = ⟨N, z⟩andsk = ⟨p, q⟩, withz = N - 1(-1 mod N ∈ QNR_N^{+1}) for Blum moduli ([KL20], Exercise 15.12).keyGenwraps an abstract generator of validKeyDescs;blumKeyGendraws only a modulus and computesz = N - 1(isPPTOn_blumKeyGen,decrypt_encrypt_blumKeyGen). - 1-bit scheme (
encrypt,decrypt): encryptm : Boolasz ^ m * r ^ 2 mod NviaProbComp.sampleModNat+unitOrOne, and decrypt via Euler's criterion modulopandq(decrypt_encrypt). - XOR homomorphism (
mulCiphertexts,xorCiphertexts; [KL20], Definition 15.14 and Exercise 15.11): ciphertext multiplication moduloNpreserves plaintext XOR (decrypt_mulCiphertexts), its componentwise list liftxorCiphertextspreserves bitwise XOR on ciphertext lists (decryptBits_xorCiphertexts), and for ideal unit-sampling encryption (idealEncrypt) both independent multiplication (idealEncrypt_mulCiphertexts_eq) and re-randomization (rerandomize_idealEncrypt_eq) match the fresh ciphertext distribution. - IND-CPA security from quadratic residuosity (Blum-modulus variant of the security theorem
in [KL20], Section 15.4.4; locator not verified):
indcpa_blumGoldwasserMicaliproves single-bitEncryption.INDCPAfor(blumKeyGen gen, encrypt)assuming onlyQuadraticResiduosityHardrelative togen, Blum moduli andn-bit primes. Its reductionblumQRDistinguisherencryptsm₀and multiplies the ciphertext by the challenge whenm₀ ≠ m₁; it is certified strict PPT (isPPTOn_blumQRDistinguisher) and loses only a20 / 2 ^ nsampling tail (advantage_blumGame_le_qr). When the prime bit-lengths are also polynomially bounded inn(as forsizeBound = (· + c)or any strict-PPTgen),wordINDCPA_blumGoldwasserMicaliprovides the Blum-modulus multi-bit step toward #5293 (after [KL20], Section 15.4.4 and Exercise 15.12, locator not verified; not the textbookQNR_N^{+1}key-generator endpoint), liftingindcpa_blumGoldwasserMicalithroughEncryption.INDCPA.wordINDCPA_bitwiseEncrypt_of_publicKey_length_letoEncryption.WordINDCPAfor(blumKeyGen gen, encryptWord)with word decryptiondecryptWord(decryptWord_encryptWord_blumKeyGen). - Ideal-key-law reduction steps (after [KL20], Section 15.4.4, Theorem 15.29,
locator not verified; toward #5293): for public keys drawn from the exact uniform
QNR_N^{+1}distributionpublicKeyLawrather than a key-generation algorithm,qrDistinguisherbounds single-bit chosen-plaintext advantage by twice its QR advantage plus a10 / 2 ^ nsampling tail (advantage_idealPublicKeyGame_le_qr), andqrWordDistinguisherextends the lossy-public-key step to bounded equal-length bit words (encryptWord) with factor-2QR loss independent of message length (advantage_idealPublicKeyWordGame_le_qr).CslibFrontier.Crypto.Computational.GoldwasserMicali.TextbookKeyGenconstructs the strict-PPT textbook key generatortextbookKeyGenwithin1 / 2 ^ nstatistical distance ofpublicKeyLawand proves single-bit and multi-bit IND-CPA steps (indcpa_textbookGoldwasserMicali,wordINDCPA_textbookGoldwasserMicali) toward #5293 for a caller-supplied modulus generatorgen : ℕ → ProbComp ModulusDesc. - Necessity of
J_N(z) = +1:jacobiAttackAdversaryis a certified uniform strict-PPT adversary achieving exact IND-CPA advantage1wheneverz ∈ jacobiNegSet p q(advantage_jacobiAttackAdversary_eq_one).
References #
- J. Katz, Y. Lindell, Introduction to Modern Cryptography, Section 15.4.4 (Construction 15.28 and Theorem 15.29, pp. 553–556), Definition 15.14 (p. 537), and Exercises 15.11–15.12 (p. 568).
Key parameters and Blum specialization #
Goldwasser–Micali key parameters: distinct odd primes p and q (ModulusDesc) together with
the canonical residue z < p * q of an element of positiveNonresidues p q.
Composite modulus N = p * q.
Every valid Goldwasser–Micali modulus exceeds 1.
k.zUnit lies in positiveNonresidues k.p k.q (QNR_N^{+1}).
Deterministic Blum-integer Goldwasser–Micali key description ([KL20],
Exercise 15.12): for a Blum modulus N = p * q (p ≡ q ≡ 3 (mod 4)), N - 1 represents -1 in
positiveNonresidues p q.
Arithmetic encryption, Euler-criterion decryption, and homomorphic multiplication #
Quadratic-residuosity test modulo p * q via Euler's criterion modulo p and q.
Goldwasser–Micali decryption ([KL20], Construction 15.28): return false on
quadratic residues and true otherwise.
Homomorphic multiplication of two ciphertexts modulo N ([KL20], Exercise 15.11).
Canonical residue representation of ciphertext N z m r for coprime z and r.
Euler's criterion on (ZMod (d.p * d.q))ˣ: isQuadResidueNat d.p d.q decides IsSquare u.
decryptNat d.p d.q decides non-squareness on (ZMod (d.p * d.q))ˣ.
Arithmetic correctness of Goldwasser–Micali decryption ([KL20],
Construction 15.28): for any non-square unit z and coprime r, decryptNat recovers m.
Specialization of decryptNat_ciphertext to a valid KeyDesc.
Multiplying two ciphertexts modulo N encrypts b₁ ^^ b₂ with explicit combined randomness.
Word-level 1-bit scheme and efficiency certificates #
ciphertext is computable in polynomial time.
isQuadResidueNat is computable in polynomial time.
decryptNat is computable in polynomial time.
keyGen gen is uniformly strict PPT whenever gen is.
encrypt is uniformly strict PPT.
decrypt is computable in polynomial time.
mulCiphertexts is computable in polynomial time.
Support-level correctness and XOR homomorphism #
Decrypting an encNat-encoded ciphertext under sk = ⟨p, q⟩ evaluates decryptNat p q.
Supported ciphertexts under pk = ⟨N, z⟩ have the form encNat (ciphertext N z m r) with
r.Coprime N.
Perfect correctness for the key pair (⟨N, z⟩, ⟨p, q⟩) of a valid KeyDesc.
Perfect correctness of Goldwasser–Micali encryption ([KL20], Construction 15.28).
Preservation of plaintext XOR under ciphertext multiplication ([KL20], Definition 15.14 and Exercise 15.11, first clause).
Ideal unit-sampling encryption, re-randomization, and distributional XOR homomorphism #
Ciphertext re-randomization ([KL20], Exercise 15.11): multiplying any fixed
ciphertext (if m then z else 1) * r₀ ^ 2 by r ^ 2 for a uniform unit r yields
idealEncryptUnit N z m.
Word-level ciphertext re-randomization via mulCiphertexts with a fresh draw from
idealEncrypt N z false.
Distributional XOR homomorphism on (ZMod N)ˣ ([KL20], Exercise 15.11).
Exercise 15.11 ([KL20], p. 568, and Definition 15.14, second clause):
multiplying two independent ideal ciphertexts of b₁ and b₂ with mulCiphertexts produces the
exact fresh ciphertext distribution idealEncrypt N z (b₁ ^^ b₂).
When IsSquare y, idealEncryptUnit N y m is independent of m.
Word-level lossiness on quadratic-residue keys: when IsSquare y, idealEncrypt N y m is
independent of m.
Word-level idealEncryptUnit_map_mul: multiplying an ideal ciphertext by the residue of
z ^ b * s ^ 2 with mulCiphertexts adds b to its plaintext. Only the modulus N of the public
key is read.
Sampling statistical distance between encrypt and idealEncrypt #
For d : ModulusDesc with n-bit primes (n ≤ d.p.size ∧ n ≤ d.q.size), sampling
r ← ProbComp.sampleModNat (n + |N|) N and applying unitOrOne N is within 5 / 2 ^ n
statistical distance of a uniform unit u ← PMF.uniformOfFintype (ZMod N)ˣ.
Replacing encrypt by idealEncrypt inside any continuation k changes game advantage by at
most 5 / 2 ^ n when n ≤ d.p.size ∧ n ≤ d.q.size.
Ideal-key-law single-bit QR reduction step #
Lossy quadratic-residue public-key distribution ([KL20], proof of Theorem 15.29):
sample d ← setup n and y uniformly from quadResidueSet d.p d.q.
Single-bit QR reduction distinguisher ([KL20], proof of Theorem 15.29).
qrDistinguisher adversary is uniformly strict PPT whenever adversary is.
Under qrPublicKeyLaw, the chosen-message advantage is at most 10 / 2 ^ n.
Ideal-key-law step toward indcpa_textbookGoldwasserMicali and #5293 (after
[KL20], Section 15.4.4, Theorem 15.29, locator not verified; not the cited result):
when public keys are drawn from the exact uniform QNR_N^{+1} distribution publicKeyLaw setup n
rather than a key-generation algorithm, single-bit chosen-plaintext advantage is at most twice
qrDistinguisher adversary's QR advantage plus 10 / 2 ^ n.
Blum-modulus Goldwasser–Micali: IND-CPA from quadratic residuosity alone #
Blum-modulus Goldwasser–Micali public key ⟨N, N - 1⟩. Its public nonresidue N - 1
represents -1, which lies in QNR_N^{+1} for every Blum modulus
(neg_one_mem_positiveNonresidues).
blumPublicKey N is ⟨N, z⟩ for the unit z = -1 modulo N = p * q.
Blum-modulus Goldwasser–Micali key generation: draw d ← gen n and output
pk = blumPublicKey N and sk = ⟨p, q⟩ for N = p * q; encryption and decryption are encrypt
and decrypt. Unlike keyGen, nothing beyond the modulus is sampled: the public nonresidue -1
is computed from N, which is valid for Blum moduli (KeyDesc.ofBlum).
blumPublicKey is computable in polynomial time.
blumKeyGen gen is uniformly strict PPT whenever the modulus sampler gen is.
Perfect correctness of Blum-modulus Goldwasser–Micali encryption whenever gen n draws
Blum moduli.
Blum QR reduction distinguisher. On a quadratic residuosity challenge input = (N, y), run
message selection on blumPublicKey N, encrypt m₀ honestly, multiply the ciphertext by y when
m₀ ≠ m₁, and return the adversary's guess. A quadratic residue y leaves a fresh encryption of
m₀. For a Blum modulus, y ∈ QNR_N^{+1} is -1 times a square, so it turns the ciphertext into
a fresh encryption of m₁ (advantage_blumGame_le_qr).
blumQRDistinguisher adversary is uniformly strict PPT whenever adversary is.
Quantitative IND-CPA bound for Blum-modulus Goldwasser–Micali. When gen n draws Blum
moduli with n-bit primes, every adversary's IND-CPA advantage against (blumKeyGen gen, encrypt)
is at most the QR advantage of blumQRDistinguisher adversary relative to gen, plus 20 / 2 ^ n
for approximate unit sampling.
IND-CPA security of Blum-modulus Goldwasser–Micali from quadratic residuosity. Let gen
draw Blum moduli N = p * q (p ≡ q ≡ 3 (mod 4)) with n-bit primes. If quadratic residuosity
is hard relative to gen, then Goldwasser–Micali with public nonresidue -1
(blumKeyGen gen, encrypt) is single-bit Encryption.INDCPA against uniform strict-PPT
adversaries. These are the only premises; nothing is assumed about the key generator beyond its
modulus law. The reduction blumQRDistinguisher is certified strict PPT
(isPPTOn_blumQRDistinguisher), and the concrete bound is advantage_blumGame_le_qr.
This is the Blum-modulus variant of the Goldwasser–Micali security theorem of [KL20],
Section 15.4.4 (locator not verified against the source). The textbook samples the public
nonresidue uniformly from QNR_N^{+1}; here it is -1, which needs Blum moduli and makes key
generation exactly the modulus draw. The modulus sampler gen is an arbitrary probabilistic
program: the theorem does not use its efficiency, which isPPTOn_blumKeyGen transfers to key
generation.
Multi-bit bitwise Goldwasser–Micali encryption and IND-CPA #
Word-valued bitwise encryption for Encryption.gameOn: frame encryptBits via
encList encBits (definitionally Encryption.bitwiseEncrypt encrypt).
encryptWord is uniformly strict PPT.
encryptBits is uniformly strict PPT.
decryptWord sk on a framed list of bit ciphertexts evaluates decryptBits sk.
decryptWord is computable in polynomial time.
Perfect correctness of bitwise Goldwasser–Micali encryption on ciphertext lists.
Componentwise XOR homomorphism of xorCiphertexts on supported encryptBits ciphertext lists:
decrypting xorCiphertexts keys.1 cts₁ cts₂ recovers List.zipWith Bool.xor bits₁ bits₂.
Perfect correctness of word-valued bitwise Goldwasser–Micali encryption (encryptWord /
decryptWord).
Perfect correctness of Blum-modulus bitwise Goldwasser–Micali encryption on ciphertext lists.
Blum-modulus word-level round-trip correctness step (blumKeyGen gen, encryptWord,
decryptWord) whenever gen n draws Blum moduli.
Encoded bit length of blumPublicKey (p * q) in terms of an upper bound B on p.size and
q.size.
Blum-modulus multi-bit IND-CPA step toward #5293 (after [KL20], Section 15.4.4 and
Exercise 15.12, locator not verified; not the textbook QNR_N^{+1} key-generator endpoint). Let
gen draw Blum moduli N = p * q (p ≡ q ≡ 3 (mod 4)) whose prime factors have bit-length at
least n and at most sizeBound n for a polynomially bounded function sizeBound (for example
fun n => n + c, max · 5 for exact n-bit Blum primes at n ≥ 5, or the length cap of any
uniform strict-PPT modulus sampler gen). If quadratic residuosity is hard relative to gen, then
bitwise Goldwasser–Micali encryption with public nonresidue -1 (blumKeyGen gen, encryptWord)
satisfies Encryption.WordINDCPA against all uniform strict-PPT word adversaries.
This combines indcpa_blumGoldwasserMicali with the certified single-bit-to-multi-bit hybrid
reduction step Encryption.INDCPA.wordINDCPA_bitwiseEncrypt_of_publicKey_length_le
(Encryption.bitwiseToSingle, Encryption.isPPT_bitwiseToSingle). The upper bound hupper
keeps public keys polynomially long in n (length_blumPublicKey_le), bounding the length of any
strict-PPT adversary's challenge words; sizeBound and gen need not be computable.
Statistical distance between encryptBits and idealEncryptBits is at most
bits.length * (5 / 2 ^ n) for a modulus with n-bit primes.
Chosen-message experiment for encryptWord under a given public-key PMF law and
Encryption.validBoundedWords maxLen.
Multi-bit QR reduction distinguisher via Goldwasser–Micali lossy public keys: the
public-key replacement distinguisher for encryptWord and validBoundedWords maxLen.
qrWordDistinguisher maxLen adversary is uniformly strict PPT whenever maxLen is unary
polynomial-time computable and adversary is strict PPT.
Ideal-key-law step toward wordINDCPA_textbookGoldwasserMicali and #5293 (after
[KL20], Section 15.4.4, Theorem 15.29, locator not verified; not the cited result):
when public keys are drawn from the exact uniform QNR_N^{+1} distribution publicKeyLaw setup n
rather than a key-generation algorithm, chosen-plaintext advantage against encryptWord on
equal-length words of length at most maxLen n is at most twice
qrWordDistinguisher maxLen adversary's QR advantage (independent of maxLen n) plus
(10 * maxLen n) / 2 ^ n.
Necessity of J_N(z) = +1: polynomial-time Jacobi-symbol attack on jacobiNegSet #
jacobiAttackAdversary is a certified uniform strict-PPT Encryption.Adversary.
Necessity of z ∈ QNR_N^{+1} ([KL20], Section 15.4.4): if z ∈ jacobiNegSet p q
(J_N(z) = -1), jacobiAttackAdversary distinguishes encrypt of false from true with exact
IND-CPA advantage 1 at every n without factoring N.