Documentation

CslibFrontier.Crypto.Computational.Commitment.Scheme

Commitment schemes #

A commitment scheme Commitment.Scheme K M C O has typed public keys, messages, commitments and openings ([BS23], Section 8.12, p. 344, and Definition 8.8). Key generation draws the public parameter, commit produces a commitment together with its opening, and verify checks an opening. Correctness is a separate property (Scheme.Correct).

Both security notions are stated as experiments for one fixed scheme:

A scheme is perfectly hiding at a key (Scheme.PerfectlyHidingAt) when the commitment law does not depend on the message. At such a key, every adversary has advantage zero (Scheme.advantage_lrExperiment_eq_zero). In general, the hiding advantage is at most the probability that key generation outputs a key that is not perfectly hiding (Scheme.advantage_hidingExperiment_le). Asymptotic security over a family of schemes and the efficiency of adversaries are stated on top of these experiments.

Main definitions #

Main results #

References #

A commitment scheme ([BS23], Section 8.12, p. 344) with public keys K, messages M, commitments C and openings O.

  • keyGen : ProbComp K

    Key generation: draw the public parameter.

  • commit : K → M → ProbComp (C × O)

    Commit to a message under a key, returning the commitment and its opening.

  • verify : K → M → C → O → Bool

    Verify that an opening opens a commitment to a message under a key.

An attempted double opening: one commitment together with two messages and their openings.

  • commitment : C

    The commitment opened twice.

  • msg₀ : M

    The first message.

  • opening₀ : O

    The opening of commitment to msg₀.

  • msg₁ : M

    The second message.

  • opening₁ : O

    The opening of commitment to msg₁.

A scheme is correct when every honest opening verifies: for every key that key generation can output, every message m and every commitment and opening that commit can output on m, verify accepts ([BS23], Section 8.12).

def Cslib.Crypto.Commitment.Scheme.commitment {K M C O : Type} (S : Scheme K M C O) (k : K) (m : M) :

The commitment to m under k, without its opening. This is the challenge in the hiding experiment.

def Cslib.Crypto.Commitment.Scheme.hidingExperiment {K M C O σ : Type} (S : Scheme K M C O) (A : TwoStage K (MessagePair M) C Bool σ) (b : Bool) :

The hiding experiment of the scheme S ([BS23], Section 8.12, Definition 8.8): draw a key and run the left-or-right experiment on it. The adversary chooses two messages from the key, the challenger commits to the message selected by b and gives the adversary the commitment without its opening, and the adversary's guess is the output. Every pair of messages is admissible.

theorem Cslib.Crypto.Commitment.Scheme.eval_hidingExperiment {K M C O σ : Type} (S : Scheme K M C O) (A : TwoStage K (MessagePair M) C Bool σ) (b : Bool) :
ProbComp.eval (S.hidingExperiment A b) = Game.withSetup S.keyGen.eval (lrExperiment (fun (x : K) (x_1 x_2 : M) => true) S.commitment A b)

The hiding experiment is the left-or-right experiment averaged over key generation.

def Cslib.Crypto.Commitment.Scheme.PerfectlyHidingAt {K M C O : Type} (S : Scheme K M C O) (k : K) :

The scheme is perfectly hiding at the key k when the law of the commitment does not depend on the message.

theorem Cslib.Crypto.Commitment.Scheme.eval_lrExperiment_eq_of_perfectlyHidingAt {K M C O σ : Type} {S : Scheme K M C O} {k : K} (hk : S.PerfectlyHidingAt k) (A : TwoStage K (MessagePair M) C Bool σ) (b₀ b₁ : Bool) :
ProbComp.eval (lrExperiment (fun (x : K) (x_1 x_2 : M) => true) S.commitment A b₀ k) = ProbComp.eval (lrExperiment (fun (x : K) (x_1 x_2 : M) => true) S.commitment A b₁ k)

At a perfectly hiding key, the left-or-right experiment has the same law for both bits.

theorem Cslib.Crypto.Commitment.Scheme.advantage_lrExperiment_eq_zero {K M C O σ : Type} {S : Scheme K M C O} {k : K} (hk : S.PerfectlyHidingAt k) (A : TwoStage K (MessagePair M) C Bool σ) :
(lrExperiment (fun (x : K) (x_1 x_2 : M) => true) S.commitment A false k).advantage (lrExperiment (fun (x : K) (x_1 x_2 : M) => true) S.commitment A true k) = 0

Perfect hiding at a key: at a perfectly hiding key, every adversary, even a computationally unbounded one, has advantage zero in the left-or-right experiment.

theorem Cslib.Crypto.Commitment.Scheme.advantage_hidingExperiment_le {K M C O σ : Type} (S : Scheme K M C O) (bad : K → Bool) (hbad : ∀ (k : K), bad k = false → S.PerfectlyHidingAt k) (A : TwoStage K (MessagePair M) C Bool σ) :

Hiding up to a bad key: if the scheme is perfectly hiding at every key outside bad, then every adversary, even a computationally unbounded one, has hiding advantage at most the probability that key generation outputs a key in bad.

def Cslib.Crypto.Commitment.Scheme.isBindingCollision {K M C O : Type} [DecidableEq M] (S : Scheme K M C O) (k : K) (out : BindingCollision M C O) :

c opens to two different messages under k: the messages differ and both openings verify ([BS23], Section 8.12, Definition 8.8).

The binding experiment of the scheme S ([BS23], Section 8.12, Definition 8.8): draw a key, give it to the adversary, and accept when the adversary opens one commitment to two different messages.