Paillier encryption #
Paillier's public-key encryption scheme ([KL20], Construction 15.11) over a modulus
generator gen that outputs valid descriptions (p, q) of balanced moduli N = p * q:
- key generation draws
(p, q) ← gen nand outputs the public keyNand the secret key⟨N, φ(N)⟩; - encryption of
mdraws a unitrmoduloNand outputsc = (1 + N) ^ m * r ^ N mod N ^ 2; - decryption outputs
((c ^ φ(N) mod N ^ 2) - 1) / N * φ(N)⁻¹ mod N.
Decryption is correct because raising c to the power φ(N) removes the randomness and leaves
1 + m * φ(N) * N modulo N ^ 2. Multiplying two ciphertexts modulo N ^ 2 preserves plaintext
addition under decryption modulo N.
The randomness r is drawn from n + |N| fair coins with ProbComp.sampleModNat; a draw that
is not a unit modulo N is replaced by 1, so decryption is correct on every ciphertext in the
support. Decryption computes φ(N)⁻¹ mod N as φ(N) ^ (φ(N) - 1) mod N, which is the inverse by
Euler's theorem because gcd(N, φ(N)) = 1. Modular exponentiation is square-and-multiply.
The modulus generator is a parameter: validity of its outputs is part of their type, and its efficiency is a hypothesis of the polynomial-time statements. Constructing such a generator is not part of this file.
Main definitions #
Cslib.Crypto.Paillier.keyGen,Cslib.Crypto.Paillier.encrypt,Cslib.Crypto.Paillier.decrypt: the Paillier scheme on binary words.Cslib.Crypto.Paillier.addCiphertexts: multiplication of ciphertexts moduloN ^ 2.
Main results #
Cslib.Crypto.Paillier.isPPTOn_keyGen,Cslib.Crypto.Paillier.isPPTOn_encrypt,Cslib.Crypto.Paillier.computableInPolyTime_decrypt: key generation and encryption are uniform strict PPT, and decryption is polynomial-time.Cslib.Crypto.Paillier.decrypt_encrypt: perfect correctness.Cslib.Crypto.Paillier.decrypt_addCiphertexts: preservation of plaintext addition under decryption (the first condition of [KL20], Definition 15.14).
Scope and limitations #
decrypt_addCiphertextsestablishes preservation of plaintext addition under decryption, corresponding to the first condition of [KL20], Definition 15.14. It does not establish the second condition (equality of the multiplied-encryption distribution with fresh encryptions of the sum), which is generally false for the implemented dyadic sampler plusunitOrOne: atN = 143,n = 0, andm₁ = m₂ = 0, a fresh ciphertextencNat 1has mass44 / 256 = 11 / 64, while multiplying two independent encryptions gives mass2316 / 65536 = 579 / 16384. The scheme at a fixed modulus with exactly uniform randomness, inCslibFrontier.Crypto.Computational.Paillier.Finite, satisfies both conditions.CslibFrontier.Crypto.Computational.Paillier.Statisticalbounds the statistical distance for the implemented word algorithms by10 / 2 ^ nwhen both modulus factors have at leastnbits. The IND-CPA reduction ([KL20], Theorem 15.13) is inCslibFrontier.Crypto.Computational.Paillier.Security.
References #
- J. Katz, Y. Lindell, Introduction to Modern Cryptography, Chapter 15, Construction 15.11 and Example 15.12.
Arithmetic on natural numbers #
The Paillier ciphertext (1 + N) ^ m * r ^ N mod N ^ 2 ([KL20],
Construction 15.11).
Paillier decryption of c with modulus N and totient t ([KL20],
Construction 15.11): ((c ^ t mod N ^ 2) - 1) / N * t⁻¹ mod N, where t⁻¹ mod N is computed as
t ^ (t - 1) mod N.
Correctness of Paillier decryption ([KL20], Construction 15.11): if
c ≡ (1 + N) ^ m * r ^ N (mod N ^ 2) for some r coprime to N, and gcd(N, φ(N)) = 1, then
decryption with the totient φ(N) returns m mod N.
The scheme on binary words #
Paillier key generation ([KL20], Construction 15.11) over a modulus
generator gen: draw (p, q) ← gen n and output the public key N = p * q and the secret key
⟨N, φ(N)⟩, with φ(N) = (p - 1) * (q - 1).
Efficiency #
Squaring is computable in polynomial time.
ciphertext is computable in polynomial time.
decryptNat is computable in polynomial time.
keyGen gen is uniformly strict PPT whenever the modulus generator gen is.
encrypt is uniformly strict PPT.
decrypt is computable in polynomial time.
addCiphertexts is computable in polynomial time.
Correctness and the additive homomorphism #
Ciphertexts in the support of encrypt n (encNat N) m are ciphertext N m r' for some
r' coprime to N.
Perfect correctness of Paillier encryption ([KL20], Construction 15.11): for
every key pair in the support of keyGen gen n, every message m < N, and every ciphertext ct
in the support of encrypt n pk m, decryption returns m.
Preservation of plaintext addition under decryption ([KL20], Definition 15.14
and the discussion of Paillier encryption that follows it): for every key pair in the support of
keyGen gen n and ciphertexts ct₁, ct₂ in the supports of encrypt n pk m₁ and
encrypt n pk m₂, the product addCiphertexts pk ct₁ ct₂ decrypts to (m₁ + m₂) mod N.
Note: [KL20], Definition 15.14 additionally requires equality of the
multiplied-ciphertext distribution with fresh encryptions of the sum. That distribution clause is
not established here (and fails for the dyadic sampler plus unitOrOne: at N = 143, n = 0, and
m₁ = m₂ = 0, fresh encNat 1 has probability mass 44 / 256 = 11 / 64, whereas multiplying two
independent encryptions yields mass 2316 / 65536 = 579 / 16384). The fixed-modulus scheme in
CslibFrontier.Crypto.Computational.Paillier.Finite satisfies it
(Cslib.Crypto.eval_mul_paillierEncrypt). For the word algorithm,
Cslib.Crypto.Paillier.closeTo_addCiphertexts in Paillier.Statistical bounds the statistical
distance by 10 / 2 ^ n when both modulus factors have at least n bits.