Documentation

CslibFrontier.Crypto.Computational.Encryption.Unpredictable

Unpredictable public-key encryption #

Definition 12.6 of Boneh and Shoup ([BS23], Section 12.6, printed p. 495) calls a public-key encryption scheme ε-unpredictable "if for every possible output (pk, sk) of G_a and every y ∈ 𝒴, if we choose r ∈ ℛ at random, then we have Pr[E_a(pk, D_a(sk, y); r) = y] ≤ ε", and unpredictable if it is ε-unpredictable for a negligible ε: a fresh re-encryption of a ciphertext's decryption is unlikely to reproduce it.

PKE.EpsilonUnpredictable E ε is this definition for a scheme E : PKE PK SK M C, and Encryption.Unpredictable E is its asymptotic form for a family E n. The book assumes in this section that decryption never rejects, returning a default message instead (pp. 494–495). A PKE may reject, and a rejected ciphertext is unconstrained here. For correct schemes the two readings agree (PKE.epsilonUnpredictable_iff_getD_of_correct), and both agree with bounding a fresh encryption of every message (PKE.epsilonUnpredictable_iff_forall_of_correct).

The library has two other ciphertext-unpredictability notions:

Main definitions #

Main results #

References #

def Cslib.Crypto.PKE.EpsilonUnpredictable {PK SK M C : Type} (E : PKE PK SK M C) (ε : NNReal) :

Definition 12.6 (ε-unpredictable encryption) ([BS23], Section 12.6, p. 495): for every key pair (pk, sk) that E.keyGen can output, every ciphertext y and every message m with E.decrypt sk y = some m, a fresh encryption of m under pk equals y with probability at most ε.

The book's decryption never rejects: it returns a default message instead (pp. 494–495), so the book bounds every y. Here a ciphertext that decryption rejects is unconstrained. The two agree for correct schemes (epsilonUnpredictable_iff_getD_of_correct); for an incorrect scheme this definition can be weaker.

theorem Cslib.Crypto.PKE.epsilonUnpredictable_iff_forall_of_correct {PK SK M C : Type} {E : PKE PK SK M C} (hcorr : E.Correct) (ε : NNReal) :
E.EpsilonUnpredictable ε ↔ ∀ keys ∈ E.keyGen.eval.support, ∀ (m : M) (y : C), ((E.encrypt keys.1 m).eval y).toNNReal ≤ ε

For a correct scheme, ε-unpredictability is equivalent to bounding Pr[E.encrypt pk m = y] ≤ ε for every supported key pair (pk, sk), every message m and every ciphertext y. Without correctness the forward implication fails, since decryption may reject honestly generated ciphertexts.

theorem Cslib.Crypto.PKE.epsilonUnpredictable_iff_getD_of_correct {PK SK M C : Type} {E : PKE PK SK M C} (hcorr : E.Correct) (m₀ : M) (ε : NNReal) :
E.EpsilonUnpredictable ε ↔ ∀ keys ∈ E.keyGen.eval.support, ∀ (y : C), ((E.encrypt keys.1 ((E.decrypt keys.2 y).getD m₀)).eval y).toNNReal ≤ ε

For a correct scheme, EpsilonUnpredictable is equivalent to the book's form, in which decryption returns a default message m₀ instead of rejecting ([BS23], Section 12.6, pp. 494–495). Without correctness, only the backward implication holds.

theorem Cslib.Crypto.PKE.ciphertextHitBound_implies_epsilonUnpredictable {PK SK M C : Type} {E : PKE PK SK M C} {ε : NNReal} (h : Encryption.CiphertextHitBound (fun (pk : PK) (m : M) => some <$> E.encrypt pk m) ε) :

A ciphertext hit bound on every public key (Encryption.CiphertextHitBound) implies ε-unpredictability: the hit bound covers every public key and message, whereas Definition 12.6 covers only supported key pairs and the decryption of the ciphertext.

def Cslib.Crypto.Encryption.Unpredictable {PK SK M C : ℕ → Type} (E : (n : ℕ) → PKE (PK n) (SK n) (M n) (C n)) :

Unpredictable encryption ([BS23], Section 12.6, Definition 12.6, p. 495) for a family of public-key encryption schemes E n: there is a negligible ε : ℕ → ℝ≥0 such that each E n is ε n-unpredictable.

HHK17 γ-spreadness (ExplicitCoinPKE.GammaSpread) implies (2 : ℝ≥0) ^ (-γ)-unpredictability of P.toPKE, with no correctness hypothesis.

For a correct scheme, γ-spreadness of P is equivalent to (2 : ℝ≥0) ^ (-γ)-unpredictability of P.toPKE. Without correctness, the backward implication fails.