Deterministic public-key encryption is not semantically secure #
In a public-key encryption scheme, the adversary receives the public key and can encrypt any
message itself. If encryption is deterministic, the adversary of
Boneh and Shoup, Section 11.3.1, pp. 438–439 submits two distinct challenge
messages (m₀, m₁), receives the challenge ciphertext c, computes c₀ ← E(pk, m₀) under the
public key it saved, and outputs false (0) when c = c₀ and true (1) otherwise. In
experiment false it outputs false with probability 1; in experiment true it outputs true
with probability 1, so its semantic-security advantage is 1.
This module formalizes that adversary and its analysis at both layers of the public-key encryption API:
- For one fixed scheme
E : PKE PK SK M C,PKE.detAdversary E m₀ m₁plays the two-stage chosen-plaintext experimentE.cpaExperiment valid(CslibFrontier/Crypto/Computational/Encryption/Scheme.lean). - Over encoded families at a security parameter
n,Encryption.detAdversary encrypt m₀ m₁is the word-levelEncryption.AdversaryOf Msg(CslibFrontier/Crypto/Computational/Encryption/Basic.lean), certified uniform strict PPT byEncryption.isPPT_detAdversaryfrom the PPT certificate ofencryptand polynomial-time certificates ofm₀andm₁.
The hypotheses relate to [BS23], Section 11.3.1, as follows.
CslibFrontierTests.Crypto.DeterministicPKE has checked instances showing that correctness,
admissibility, m₀ ≠ m₁ and determinism are each needed.
- Correctness is a hypothesis. Definition 11.1 (p. 436) requires of every scheme that
decryption undoes encryption, so the scheme of Section 11.3.1 is correct. Here
PKEis a bare triple andPKE.Correcta separate predicate, soEncryption.not_indcpaOn_of_deterministicassumesPKE.Correctof(keyGen n, encrypt n, decrypt n). The argument uses correctness only forb = 1, as disjointness of the ciphertext supports ofm₀andm₁under honest public keys (hne, byPKE.Correct.notMem_support_encrypt);PKE.eval_cpaExperiment_detAdversary_true,PKE.advantage_cpaExperiment_detAdversaryandEncryption.advantage_gameOn_detAdversaryassumehnedirectly. - Only the encryption of
m₀must be deterministic. The book assumes the entire encryption algorithm is deterministic, whereas its argument uses only thatencrypt pk m₀is a point mass (PMF.pure c) under every supported key pair (hdet), so the theorem also applies to schemes that randomize other messages. - Challenge-pair admissibility and an asymptotic threshold
n₀. Admissibility is parameterized byvalid, required to hold on(m₀, m₁)under supported keys (hvalid), and inEncryption.not_indcpaOn_of_deterministicthe hypotheses hold from a threshold parametern₀onward (n₀ ≤ n). - Parameter-indexed challenge messages. In
Encryption.detAdversary, the messagesm₀, m₁ : ℕ → Msgdepend on the security parameternalone rather than the public key.
Main definitions #
Cslib.Crypto.PKE.detAdversary: the two-stage adversary of [BS23], Section 11.3.1, for a fixed schemeE : PKE PK SK M C.Cslib.Crypto.Encryption.detAdversary: the word-level chosen-message adversary of [BS23], Section 11.3.1, for message familiesm₀ m₁ : ℕ → Msg.
Main results #
Cslib.Crypto.PKE.eval_cpaExperiment_detAdversary_false,Cslib.Crypto.PKE.eval_cpaExperiment_detAdversary_true,Cslib.Crypto.PKE.advantage_cpaExperiment_detAdversary: inPKE.cpaExperiment,detAdversaryoutputsfalsein worldfalsewhen encryption ofm₀is deterministic, outputstruein worldtruewhen(m₀, m₁)is admissible and the ciphertext supports ofm₀andm₁are disjoint, and therefore has advantage1([BS23], Section 11.3.1, pp. 438–439).Cslib.Crypto.PKE.Correct.notMem_support_encrypt: in a correct scheme, distinct messages have disjoint ciphertext supports under every supported key pair.Cslib.Crypto.Encryption.isPPT_detAdversary:detAdversaryis uniform strict PPT when encryption is PPT andm₀,m₁are computable in polynomial time.Cslib.Crypto.Encryption.advantage_gameOn_detAdversary: at parametern, the word-leveldetAdversaryachievesgameOnadvantage1.Cslib.Crypto.Encryption.not_indcpaOn_of_deterministic: a public-key encryption scheme that is correct from some parametern₀onward and admits two distinct polynomial-time challenge messages, the first encrypted deterministically, is notINDCPAOn([BS23], Section 11.3.1, pp. 438–439).
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, Section 11.2 (Definition 11.1, Attack Game 11.1, Definition 11.2, pp. 436–437) and Section 11.3.1 (pp. 438–439).
Typed layer #
The adversary of [BS23], Section 11.3.1 (p. 438), against a fixed scheme E:
challenge with (m₀, m₁), save the public key pk, re-encrypt m₀ under pk, and output
false (0) when the challenge equals that ciphertext and true (1) otherwise.
In experiment false, if E.encrypt keys.1 m₀ is deterministic (a point mass) on every
supported key pair keys, then E.detAdversary m₀ m₁ outputs false with probability 1
([BS23], Section 11.3.1, p. 438).
In experiment true, if (m₀, m₁) is admissible and no ciphertext in the support of
E.encrypt keys.1 m₁ belongs to the support of E.encrypt keys.1 m₀ on any supported key pair
keys, then E.detAdversary m₀ m₁ outputs true with probability 1
([BS23], Section 11.3.1, p. 438).
Under the hypotheses of eval_cpaExperiment_detAdversary_false and
eval_cpaExperiment_detAdversary_true, E.detAdversary m₀ m₁ achieves chosen-plaintext advantage
1 ([BS23], Section 11.3.1, pp. 438–439).
A correct scheme never encrypts two distinct messages to the same ciphertext under any supported key pair.
Word level #
The word-level adversary of [BS23], Section 11.3.1 (p. 438): at security parameter
n, challenge with (m₀ n, m₁ n), save the public key pk as the state word, re-encrypt m₀ n
under pk, and output c != c₀.
detAdversary encrypt m₀ m₁ is uniform strict PPT whenever encrypt is PPT on
encKeyedInput encMsg and m₀, m₁ are computable in polynomial time from the unary security
parameter.
At security parameter n, detAdversary encrypt m₀ m₁ achieves gameOn advantage 1 when
(m₀ n, m₁ n) is admissible, encryption of m₀ n is deterministic, and the ciphertext supports of
m₀ n and m₁ n are disjoint under every supported key pair ([BS23], Section 11.3.1,
pp. 438–439).
A deterministic public-key encryption scheme is not semantically secure
([BS23], Section 11.3.1, pp. 438–439): if encrypt is PPT, m₀ and m₁ are computable
in polynomial time, and from some parameter n₀ onward the scheme is correct, m₀ n ≠ m₁ n, the
pair (m₀ n, m₁ n) is admissible under every supported public key, and encrypt n pk (m₀ n) is
deterministic under every supported public key, then the scheme fails INDCPAOn valid encMsg.