Documentation

CslibFrontier.Crypto.Computational.Encryption.StronglyUnpredictable

Strongly unpredictable ciphertexts #

A public-key encryption algorithm (possibly fallible, represented as Option (C n) where none models an encryption error) has strongly unpredictable ciphertexts ([BS23], §21.4.1, p. 872) if there is a negligible function ε : ℕ → ℝ≥0 such that at every security parameter n, for every public key pk : PK n (including adversarially chosen or malformed keys), every message m : Msg n, and every non-error ciphertext c : C n, the probability that encrypting m under pk outputs some c is at most ε n.

Fixed-type schemes (PK Msg C : Type) are instances of StronglyUnpredictable by unification with constant type families fun _ => PK, fun _ => Msg, fun _ => C.

Main definitions #

Main results #

References #

def Cslib.Crypto.Encryption.CiphertextHitBound {PK Msg C : Type} (encrypt : PK → Msg → ProbComp (Option C)) (ε : NNReal) :

At one security parameter, a fallible encryption algorithm encrypt : PK → Msg → ProbComp (Option C) (none represents error) has ciphertext hit probability at most ε if for every public key pk, message m, and non-error ciphertext some c, Pr[encrypt pk m = some c] ≤ ε.

theorem Cslib.Crypto.Encryption.ciphertextHitBound_map_some_iff {PK Msg C : Type} (encrypt : PK → Msg → ProbComp C) (ε : NNReal) :
CiphertextHitBound (fun (pk : PK) (m : Msg) => some <$> encrypt pk m) ε ↔ ∀ (pk : PK) (m : Msg) (c : C), ((encrypt pk m).eval c).toNNReal ≤ ε

For an infallible encryption algorithm lifted by some <$> ·, CiphertextHitBound reduces directly to bounding Pr[encrypt pk m = c] ≤ ε.

theorem Cslib.Crypto.Encryption.CiphertextHitBound.collision_le {PK Msg C : Type} [DecidableEq C] {encrypt : PK → Msg → ProbComp (Option C)} {ε : NNReal} (h : CiphertextHitBound encrypt ε) (pk₁ pk₂ : PK) (m₁ m₂ : Msg) :
((do let c₁ ← encrypt pk₁ m₁ let c₂ ← encrypt pk₂ m₂ pure (decide (c₁ = c₂ ∧ c₁.isSome = true))).eval true).toNNReal ≤ ε

If encrypt has ciphertext hit bound ε, then two independent invocations (even under distinct adversarially chosen public keys and messages) output the same non-error ciphertext with probability at most ε ([BS23], §21.9.6, p. 897).

def Cslib.Crypto.Encryption.StronglyUnpredictable {PK Msg C : ℕ → Type} (encrypt : (n : ℕ) → PK n → Msg n → ProbComp (Option (C n))) :

Strongly unpredictable ciphertexts ([BS23], §21.4.1, p. 872) for a family of fallible encryption algorithms encrypt : ∀ n, PK n → Msg n → ProbComp (Option (C n)) (none represents error): there exists a negligible bound ε : ℕ → ℝ≥0 such that at every security parameter n, every public key pk : PK n (including adversarially chosen ones), every message m : Msg n, and every non-error ciphertext some c, Pr[encrypt n pk m = some c] ≤ ε n.

theorem Cslib.Crypto.Encryption.StronglyUnpredictable.of_bound {PK Msg C : ℕ → Type} {encrypt : (n : ℕ) → PK n → Msg n → ProbComp (Option (C n))} {B : ℕ → NNReal} (hB : Negligible B) (hbound : ∀ (n : ℕ), CiphertextHitBound (encrypt n) (B n)) :

Construct StronglyUnpredictable from a negligible hit-bound sequence B.

theorem Cslib.Crypto.Encryption.stronglyUnpredictable_iff_forall {PK Msg C : ℕ → Type} [∀ (n : ℕ), Nonempty (PK n)] [∀ (n : ℕ), Nonempty (Msg n)] [∀ (n : ℕ), Nonempty (C n)] (encrypt : (n : ℕ) → PK n → Msg n → ProbComp (Option (C n))) :
StronglyUnpredictable encrypt ↔ ∀ (pk : (n : ℕ) → PK n) (m : (n : ℕ) → Msg n) (c : (n : ℕ) → C n), Negligible fun (n : ℕ) => ((encrypt n (pk n) (m n)).eval (some (c n))).toNNReal

Under Nonempty public-key, message, and ciphertext types, uniform strong ciphertext unpredictability is equivalent to requiring Pr[encrypt n (pk n) (m n) = some (c n)] to be negligible for every sequence (pk, m, c) ([BS23], §21.4.1, p. 872).

theorem Cslib.Crypto.Encryption.StronglyUnpredictable.negligible_collision {PK Msg C : ℕ → Type} [(n : ℕ) → DecidableEq (C n)] {encrypt : (n : ℕ) → PK n → Msg n → ProbComp (Option (C n))} (h : StronglyUnpredictable encrypt) (pk₁ pk₂ : (n : ℕ) → PK n) (m₁ m₂ : (n : ℕ) → Msg n) :
Negligible fun (n : ℕ) => ((do let c₁ ← encrypt n (pk₁ n) (m₁ n) let c₂ ← encrypt n (pk₂ n) (m₂ n) pure (decide (c₁ = c₂ ∧ c₁.isSome = true))).eval true).toNNReal

If encrypt has strongly unpredictable ciphertexts, then two independent invocations (even under adversarially chosen sequences of keys and messages) collide on a non-error ciphertext with negligible probability ([BS23], §21.9.6, p. 897).