Documentation

CslibFrontier.Crypto.Computational.FuzzyExtractor.Basic

Computational fuzzy extractors and secure sketches #

A fuzzy extractor (Gen, Rep) over a metric space (M, dis) derives a reproducible key r : Key and public helper value p : Helper from a noisy source reading w : M, and reproduces r from any reading w' within distance t of w using p ([DORS08], Section 8; [FMR20], Section 2.1, Definitions 2.1 and 2.2).

In the computational setting of Fuller, Meng, and Reyzin ([FMR20], Definition 2.2), security is parameterized by a family of source distributions sources : Set (PMF M) and requires that for every W ∈ sources, the joint distribution (R, P) produced by Gen(W) is computationally indistinguishable from (U, P), where U is uniform over Key and independent of P.

This module also formalizes secure sketches ([FMR20], Definition 2.3), average-case extractors (Definition 2.4), and the sketch-and-extract construction (Lemma 2.5), proving that sketch-and-extract preserves both zero-error and δ-error reproduction correctness and transfers average-case extractor security on (W, SS(W)) directly to fuzzy-extractor security.

Main definitions #

Main results #

References #

structure Cslib.Crypto.FuzzyExtractor (M Key Helper : Type) :

A fuzzy extractor (Gen, Rep) over a metric space M with extracted key type Key and public helper type Helper ([FMR20], Definitions 2.1 and 2.2).

  • gen : M → ProbComp (Key × Helper)

    Generation procedure Gen(w), outputting an extracted key r and public helper p.

  • rep : M → Helper → ProbComp Key

    Reproduction procedure Rep(w', p), recovering the key from a close reading w' and helper p.

Reproduction correctness (Definitions 2.1 and 2.2, item 3) #

def Cslib.Crypto.FuzzyExtractor.reproduceCheck {M Key Helper : Type} [DecidableEq Key] (fe : FuzzyExtractor M Key Helper) (w w' : M) :

The reproduction check program on original reading w and noisy reading w': sample (r, p) ← Gen(w), sample r' ← Rep(w', p), and test whether r' = r.

noncomputable def Cslib.Crypto.FuzzyExtractor.reproduceGame {M Key Helper : Type} [DecidableEq Key] (fe : FuzzyExtractor M Key Helper) (w w' : M) :

The reproduction correctness experiment on (w, w') as a Boolean Game.

theorem Cslib.Crypto.FuzzyExtractor.reproduceGame_eq_bind {M Key Helper : Type} [DecidableEq Key] (fe : FuzzyExtractor M Key Helper) (w w' : M) :
fe.reproduceGame w w' = do let __x ← (fe.gen w).eval match __x with | (r, p) => do let r' ← (fe.rep w' p).eval pure (decide (r' = r))

Unfold reproduceGame into PMF bind form over Gen(w) and Rep(w', p).

def Cslib.Crypto.FuzzyExtractor.Correct {M Key Helper : Type} (fe : FuzzyExtractor M Key Helper) (dis : M → M → ℕ) (t : ℕ) :

Zero-error reproduction correctness up to distance t with respect to dis: whenever dis w w' ≤ t, every (r, p) in the support of Gen(w) and r' in the support of Rep(w', p) satisfies r' = r.

def Cslib.Crypto.FuzzyExtractor.CorrectWithError {M Key Helper : Type} [DecidableEq Key] (fe : FuzzyExtractor M Key Helper) (dis : M → M → ℕ) (t : ℕ) (δ : NNReal) :

Reproduction correctness with error δ up to distance t ([FMR20], Definition 2.1, item 3): whenever dis w w' ≤ t, Rep(w', P) fails to equal R with probability at most δ over the coins of Gen and Rep.

@[reducible, inline]
abbrev Cslib.Crypto.FuzzyExtractor.CorrectHamming {Key Helper : Type} {m : ℕ} {α : Type} [DecidableEq α] (fe : FuzzyExtractor (Fin m → α) Key Helper) (t : ℕ) :

Zero-error reproduction correctness for the Hamming metric on Fin m → α.

@[reducible, inline]
abbrev Cslib.Crypto.FuzzyExtractor.CorrectHammingWithError {Key Helper : Type} {m : ℕ} {α : Type} [DecidableEq α] [DecidableEq Key] (fe : FuzzyExtractor (Fin m → α) Key Helper) (t : ℕ) (δ : NNReal) :

Reproduction correctness with error δ for the Hamming metric on Fin m → α.

theorem Cslib.Crypto.FuzzyExtractor.CorrectWithError.one_sub_le_succProbability {M Key Helper : Type} [DecidableEq Key] {fe : FuzzyExtractor M Key Helper} {dis : M → M → ℕ} {t : ℕ} {δ : NNReal} (h : fe.CorrectWithError dis t δ) {w w' : M} (hdis : dis w w' ≤ t) :

Under CorrectWithError, whenever dis w w' ≤ t, Rep(w', P) = R holds with probability at least 1 - δ ([FMR20], Definition 2.1, item 3).

theorem Cslib.Crypto.FuzzyExtractor.CorrectWithError.mono {M Key Helper : Type} [DecidableEq Key] {fe : FuzzyExtractor M Key Helper} {dis : M → M → ℕ} {t₁ t₂ : ℕ} {δ₁ δ₂ : NNReal} (h : fe.CorrectWithError dis t₂ δ₁) (ht : t₁ ≤ t₂) (hδ : δ₁ ≤ δ₂) :
fe.CorrectWithError dis t₁ δ₂

Relaxing the error bound δ or shrinking the distance threshold t preserves CorrectWithError.

theorem Cslib.Crypto.FuzzyExtractor.Correct.reproduceGame_eq_pure_true {M Key Helper : Type} [DecidableEq Key] {fe : FuzzyExtractor M Key Helper} {dis : M → M → ℕ} {t : ℕ} (h : fe.Correct dis t) {w w' : M} (hdis : dis w w' ≤ t) :

Zero-error correctness makes reproduceGame w w' identically PMF.pure true whenever dis w w' ≤ t.

theorem Cslib.Crypto.FuzzyExtractor.Correct.correctWithError_zero {M Key Helper : Type} [DecidableEq Key] {fe : FuzzyExtractor M Key Helper} {dis : M → M → ℕ} {t : ℕ} (h : fe.Correct dis t) :
fe.CorrectWithError dis t 0

Zero-error correctness implies CorrectWithError with error 0.

theorem Cslib.Crypto.FuzzyExtractor.Correct.correctWithError {M Key Helper : Type} [DecidableEq Key] {fe : FuzzyExtractor M Key Helper} {dis : M → M → ℕ} {t : ℕ} (h : fe.Correct dis t) (δ : NNReal) :
fe.CorrectWithError dis t δ

Zero-error correctness implies CorrectWithError for every error bound δ.

Computational security (Definition 2.2, item 4) #

noncomputable def Cslib.Crypto.FuzzyExtractor.realDistribution {M Key Helper : Type} (fe : FuzzyExtractor M Key Helper) (W : PMF M) :
PMF (Key × Helper)

The real joint distribution (R, P) produced by Gen(W) on a source distribution W : PMF M ([FMR20], Definition 2.2).

noncomputable def Cslib.Crypto.FuzzyExtractor.helperDistribution {M Key Helper : Type} (fe : FuzzyExtractor M Key Helper) (W : PMF M) :
PMF Helper

The marginal distribution of the public helper string P produced by Gen(W).

noncomputable def Cslib.Crypto.FuzzyExtractor.idealDistribution {M Key Helper : Type} [Fintype Key] [Nonempty Key] (fe : FuzzyExtractor M Key Helper) (W : PMF M) :
PMF (Key × Helper)

The ideal joint distribution (U, P) for a source W : PMF M, where P is the helper string from Gen(W) and U is uniform over Key and independent of P ([FMR20], Definition 2.2).

The ideal distribution samples p ← helperDistribution W and u ← uniformOfFintype Key independently.

def Cslib.Crypto.FuzzyExtractor.realExperiment {M Key Helper : Type} (fe : FuzzyExtractor M Key Helper) (w : M) (D : Key → Helper → Experiment) :

The real distinguishing experiment on a fixed reading w: sample (r, p) ← Gen(w) and run D r p.

noncomputable def Cslib.Crypto.FuzzyExtractor.idealExperiment {M Key Helper : Type} [Fintype Key] [Nonempty Key] (fe : FuzzyExtractor M Key Helper) (w : M) (D : Key → Helper → Experiment) :

The ideal distinguishing experiment on a fixed reading w: sample (_, p) ← Gen(w) and an independent uniform key u, and run D u p.

noncomputable def Cslib.Crypto.FuzzyExtractor.realGame {M Key Helper : Type} (fe : FuzzyExtractor M Key Helper) (W : PMF M) (D : Key → Helper → Experiment) :

The real distinguishing game for source W and distinguisher D: sample w ← W and run realExperiment w D.

noncomputable def Cslib.Crypto.FuzzyExtractor.idealGame {M Key Helper : Type} [Fintype Key] [Nonempty Key] (fe : FuzzyExtractor M Key Helper) (W : PMF M) (D : Key → Helper → Experiment) :

The ideal distinguishing game for source W and distinguisher D: sample w ← W and run idealExperiment w D.

theorem Cslib.Crypto.FuzzyExtractor.realGame_eq_bind {M Key Helper : Type} (fe : FuzzyExtractor M Key Helper) (W : PMF M) (D : Key → Helper → Experiment) :
fe.realGame W D = (fe.realDistribution W).bind fun (rp : Key × Helper) => ProbComp.eval (D rp.1 rp.2)

The real game runs D on a sample of realDistribution W.

theorem Cslib.Crypto.FuzzyExtractor.idealGame_eq_bind {M Key Helper : Type} [Fintype Key] [Nonempty Key] (fe : FuzzyExtractor M Key Helper) (W : PMF M) (D : Key → Helper → Experiment) :
fe.idealGame W D = (fe.idealDistribution W).bind fun (up : Key × Helper) => ProbComp.eval (D up.1 up.2)

The ideal game runs D on a sample of idealDistribution W.

@[reducible, inline]
noncomputable abbrev Cslib.Crypto.FuzzyExtractor.securityAdvantage {M Key Helper : Type} [Fintype Key] [Nonempty Key] (fe : FuzzyExtractor M Key Helper) (W : PMF M) (D : Key → Helper → Experiment) :

The distinguishing advantage δ^D((R, P), (U, P)) of D on source W ([FMR20], Definition 2.2).

def Cslib.Crypto.FuzzyExtractor.ComputationallySecureFor {M Key Helper : Type} [Fintype Key] [Nonempty Key] (fe : FuzzyExtractor M Key Helper) (sources : Set (PMF M)) (Admissible : (Key → Helper → Experiment) → Prop) (ε : NNReal) :

Concrete computational security of a fuzzy extractor for a source family sources against a distinguisher class Admissible with advantage bound ε ([FMR20], Definition 2.2, item 4, p. 6 of the ePrint revision of June 23, 2020). The caller supplies the distinguisher class, where the source fixes D_{s_sec}, the randomized circuits of size at most s_sec (p. 5), so this is the source's notion only for an instance that supplies that class. Distinguishers are probabilistic programs reading the key and the helper, and the ideal key is uniform on the finite type Key rather than on {0,1}^ℓ.

theorem Cslib.Crypto.FuzzyExtractor.securityAdvantage_eq_zero_of_realDistribution_eq {M Key Helper : Type} [Fintype Key] [Nonempty Key] {fe : FuzzyExtractor M Key Helper} {W : PMF M} (h : fe.realDistribution W = fe.idealDistribution W) (D : Key → Helper → Experiment) :

When the real (R, P) and ideal (U, P) distributions coincide, every distinguisher (regardless of computational resources) has advantage 0.

theorem Cslib.Crypto.FuzzyExtractor.computationallySecureFor_zero_of_realDistribution_eq {M Key Helper : Type} [Fintype Key] [Nonempty Key] {fe : FuzzyExtractor M Key Helper} {sources : Set (PMF M)} (h : ∀ W ∈ sources, fe.realDistribution W = fe.idealDistribution W) (Admissible : (Key → Helper → Experiment) → Prop) :
fe.ComputationallySecureFor sources Admissible 0

Exact equality of real and ideal distributions on every source in sources implies ComputationallySecureFor with error 0 against any class of distinguishers.

theorem Cslib.Crypto.FuzzyExtractor.ComputationallySecureFor.mono {M Key Helper : Type} [Fintype Key] [Nonempty Key] {fe : FuzzyExtractor M Key Helper} {sources₁ sources₂ : Set (PMF M)} {Admissible₁ Admissible₂ : (Key → Helper → Experiment) → Prop} {ε₁ ε₂ : NNReal} (h : fe.ComputationallySecureFor sources₂ Admissible₂ ε₁) (hs : sources₁ ⊆ sources₂) (ha : ∀ (D : Key → Helper → Experiment), Admissible₁ D → Admissible₂ D) (hε : ε₁ ≤ ε₂) :
fe.ComputationallySecureFor sources₁ Admissible₁ ε₂

Enlarging the error budget ε, shrinking the source family, or restricting the admissible distinguishers preserves ComputationallySecureFor.

Asymptotic computational security #

def Cslib.Crypto.FuzzyExtractor.ComputationallySecure {M Key Helper : ℕ → Type} [(κ : ℕ) → Fintype (Key κ)] [∀ (κ : ℕ), Nonempty (Key κ)] (fe : (κ : ℕ) → FuzzyExtractor (M κ) (Key κ) (Helper κ)) (sources : Set ((κ : ℕ) → PMF (M κ))) (Admissible : ((κ : ℕ) → Key κ → Helper κ → Experiment) → Prop) :

Asymptotic computational security of a family of fuzzy extractors fe κ, indexed by the security parameter κ, for a set sources of source ensembles and a class Admissible of distinguisher families ([FMR20], Definition 2.2, item 4, in asymptotic form): for every ensemble source ∈ sources, the real and ideal games of fe κ on source κ are indistinguishable to admissible distinguishers. Equivalently, every admissible D has negligible advantage (fe κ).securityAdvantage (source κ) (D κ) (computationallySecure_iff). This is the asymptotic form of ComputationallySecureFor, with the concrete bound ε replaced by negligibility in κ; each construction fixes its distinguisher class, typically uniform strict PPT on an encoding of the key and helper.

theorem Cslib.Crypto.FuzzyExtractor.computationallySecure_iff {M Key Helper : ℕ → Type} [(κ : ℕ) → Fintype (Key κ)] [∀ (κ : ℕ), Nonempty (Key κ)] {fe : (κ : ℕ) → FuzzyExtractor (M κ) (Key κ) (Helper κ)} {sources : Set ((κ : ℕ) → PMF (M κ))} {Admissible : ((κ : ℕ) → Key κ → Helper κ → Experiment) → Prop} :
ComputationallySecure fe sources Admissible ↔ ∀ source ∈ sources, ∀ (D : (κ : ℕ) → Key κ → Helper κ → Experiment), Admissible D → Negligible fun (κ : ℕ) => (fe κ).securityAdvantage (source κ) (D κ)

ComputationallySecure states that every admissible distinguisher family has negligible advantage on every source ensemble.

theorem Cslib.Crypto.FuzzyExtractor.ComputationallySecure.of_computationallySecureFor {M Key Helper : ℕ → Type} [(κ : ℕ) → Fintype (Key κ)] [∀ (κ : ℕ), Nonempty (Key κ)] {fe : (κ : ℕ) → FuzzyExtractor (M κ) (Key κ) (Helper κ)} {sources : Set ((κ : ℕ) → PMF (M κ))} {Admissible : ((κ : ℕ) → Key κ → Helper κ → Experiment) → Prop} {ε : ℕ → NNReal} (hε : Negligible ε) (h : ∀ source ∈ sources, ∀ (κ : ℕ), (fe κ).ComputationallySecureFor {source κ} (fun (D' : Key κ → Helper κ → Experiment) => ∃ (D : (κ : ℕ) → Key κ → Helper κ → Experiment), Admissible D ∧ D κ = D') (ε κ)) :
ComputationallySecure fe sources Admissible

A negligible concrete bound gives asymptotic security: if at every parameter κ each fe κ is ε κ-secure (ComputationallySecureFor) for the source source κ against the κ-th members of the admissible families, and ε is negligible, then the family is ComputationallySecure.

Secure sketches and the sketch-and-extract construction (Section 2.2) #

structure Cslib.Crypto.SecureSketch (M Sketch : Type) :

A secure sketch (SS, Rec) over M with sketch type Sketch ([FMR20], Definition 2.3).

  • sketch : M → ProbComp Sketch

    Sketching procedure SS(w), producing a public sketch s.

  • recover : M → Sketch → ProbComp M

    Recovery procedure Rec(w', s), recovering w from a close reading w' and sketch s.

structure Cslib.Crypto.SketchHelper (Sketch Seed : Type) :

The public helper value p = (s, x) of the sketch-and-extract construction ([FMR20], Lemma 2.5), pairing a sketch s with an extractor seed x.

  • sketch : Sketch

    The public sketch s ← SS(w).

  • seed : Seed

    The public uniform extractor seed x.

Instances For
    @[instance_reducible]
    instance Cslib.Crypto.instDecidableEqSketchHelper {Sketch✝ Seed✝ : Type} [DecidableEq Sketch✝] [DecidableEq Seed✝] :
    DecidableEq (SketchHelper Sketch✝ Seed✝)
    def Cslib.Crypto.instDecidableEqSketchHelper.decEq {Sketch✝ Seed✝ : Type} [DecidableEq Sketch✝] [DecidableEq Seed✝] (x✝ x✝¹ : SketchHelper Sketch✝ Seed✝) :
    Decidable (x✝ = x✝¹)
    def Cslib.Crypto.instReprSketchHelper.repr {Sketch✝ Seed✝ : Type} [Repr Sketch✝] [Repr Seed✝] :
    SketchHelper Sketch✝ Seed✝ → ℕ → Std.Format
    @[instance_reducible]
    instance Cslib.Crypto.instReprSketchHelper {Sketch✝ Seed✝ : Type} [Repr Sketch✝] [Repr Seed✝] :
    Repr (SketchHelper Sketch✝ Seed✝)
    def Cslib.Crypto.SecureSketch.recoverCheck {M Sketch : Type} [DecidableEq M] (ss : SecureSketch M Sketch) (w w' : M) :

    The recovery check program on original reading w and noisy reading w': sample s ← SS(w), sample wHat ← Rec(w', s), and test whether wHat = w.

    noncomputable def Cslib.Crypto.SecureSketch.recoverGame {M Sketch : Type} [DecidableEq M] (ss : SecureSketch M Sketch) (w w' : M) :

    The recovery correctness experiment on (w, w') as a Boolean Game.

    def Cslib.Crypto.SecureSketch.Correct {M Sketch : Type} (ss : SecureSketch M Sketch) (dis : M → M → ℕ) (t : ℕ) :

    Zero-error recovery correctness up to distance t with respect to dis.

    def Cslib.Crypto.SecureSketch.CorrectWithError {M Sketch : Type} [DecidableEq M] (ss : SecureSketch M Sketch) (dis : M → M → ℕ) (t : ℕ) (δ : NNReal) :

    Recovery correctness with error δ up to distance t ([FMR20], Definition 2.3, item 3).

    noncomputable def Cslib.Crypto.SecureSketch.sketchAndExtract {M Sketch Seed Key : Type} [Fintype Seed] [Nonempty Seed] (ss : SecureSketch M Sketch) (ext : M → Seed → Key) :
    FuzzyExtractor M Key (SketchHelper Sketch Seed)

    The sketch-and-extract fuzzy extractor of [FMR20], Lemma 2.5:

    • Gen(w) samples s ← SS(w) and uniform seed x ← Seed, and outputs (ext w x, ⟨s, x⟩);
    • Rep(w', ⟨s, x⟩) recovers wHat ← Rec(w', s) and outputs ext wHat x.
    theorem Cslib.Crypto.SecureSketch.Correct.sketchAndExtract {M Sketch Seed Key : Type} [Fintype Seed] [Nonempty Seed] {ss : SecureSketch M Sketch} {dis : M → M → ℕ} {t : ℕ} (h : ss.Correct dis t) (ext : M → Seed → Key) :
    (ss.sketchAndExtract ext).Correct dis t

    Zero-error correctness of sketchAndExtract ([FMR20], Lemma 2.5): if ss recovers w without error within distance t, then ss.sketchAndExtract ext reproduces r = ext w x without error within distance t.

    theorem Cslib.Crypto.SecureSketch.failProbability_reproduceGame_sketchAndExtract_le {M Sketch Seed Key : Type} [DecidableEq M] [DecidableEq Key] [Fintype Seed] [Nonempty Seed] (ss : SecureSketch M Sketch) (ext : M → Seed → Key) (w w' : M) :

    For every pair (w, w'), the reproduction failure probability of ss.sketchAndExtract ext is at most the recovery failure probability of ss: whenever Rec(w', s) = w, ext (Rec(w', s)) x = ext w x holds for every seed x.

    theorem Cslib.Crypto.SecureSketch.CorrectWithError.sketchAndExtract {M Sketch Seed Key : Type} [DecidableEq M] [DecidableEq Key] [Fintype Seed] [Nonempty Seed] {ss : SecureSketch M Sketch} {dis : M → M → ℕ} {t : ℕ} {δ : NNReal} (h : ss.CorrectWithError dis t δ) (ext : M → Seed → Key) :

    δ-error correctness of sketchAndExtract ([FMR20], Lemma 2.5): if ss recovers w with error at most δ within distance t, then ss.sketchAndExtract ext reproduces r with error at most δ within distance t.

    noncomputable def Cslib.Crypto.SecureSketch.jointSketch {M Sketch : Type} (ss : SecureSketch M Sketch) (W : PMF M) :
    PMF (M × Sketch)

    The joint distribution (W, SS(W)) of a source reading and its sketch.

    noncomputable def Cslib.Crypto.SecureSketch.extractorRealLaw {M Sketch Seed Key : Type} [Fintype Seed] [Nonempty Seed] (ext : M → Seed → Key) (XY : PMF (M × Sketch)) :
    PMF (Key × SketchHelper Sketch Seed)

    The real average-case extractor distribution (ext(X, U_d), ⟨Y, U_d⟩) on a joint source (X, Y) : PMF (M × Sketch) ([FMR20], Definition 2.4).

    noncomputable def Cslib.Crypto.SecureSketch.extractorIdealLaw {M Sketch Seed Key : Type} [Fintype Seed] [Nonempty Seed] [Fintype Key] [Nonempty Key] (XY : PMF (M × Sketch)) :
    PMF (Key × SketchHelper Sketch Seed)

    The ideal average-case extractor distribution (U_Key, ⟨Y, U_d⟩) on a joint source (X, Y) : PMF (M × Sketch) ([FMR20], Definition 2.4).

    theorem Cslib.Crypto.SecureSketch.realDistribution_sketchAndExtract {M Sketch Seed Key : Type} [Fintype Seed] [Nonempty Seed] (ss : SecureSketch M Sketch) (ext : M → Seed → Key) (W : PMF M) :

    The real distribution of ss.sketchAndExtract ext on W is the average-case extractor real law on (W, SS(W)).

    theorem Cslib.Crypto.SecureSketch.idealDistribution_sketchAndExtract {M Sketch Seed Key : Type} [Fintype Seed] [Nonempty Seed] [Fintype Key] [Nonempty Key] (ss : SecureSketch M Sketch) (ext : M → Seed → Key) (W : PMF M) :

    The ideal distribution of ss.sketchAndExtract ext on W is the average-case extractor ideal law on (W, SS(W)).

    theorem Cslib.Crypto.SecureSketch.securityAdvantage_sketchAndExtract_eq {M Sketch Seed Key : Type} [Fintype Seed] [Nonempty Seed] [Fintype Key] [Nonempty Key] (ss : SecureSketch M Sketch) (ext : M → Seed → Key) (W : PMF M) (D : Key → SketchHelper Sketch Seed → Experiment) :
    (ss.sketchAndExtract ext).securityAdvantage W D = Game.advantage ((extractorRealLaw ext (ss.jointSketch W)).bind fun (rp : Key × SketchHelper Sketch Seed) => ProbComp.eval (D rp.1 rp.2)) ((extractorIdealLaw (ss.jointSketch W)).bind fun (up : Key × SketchHelper Sketch Seed) => ProbComp.eval (D up.1 up.2))

    Security of sketchAndExtract ([FMR20], Lemma 2.5): the fuzzy-extractor distinguishing advantage of D on source W equals the average-case extractor advantage of D on the joint distribution (W, SS(W)).