Documentation

CslibFrontier.Crypto.Computational.Signature.Scheme

Signature schemes #

A signature scheme Signature.Scheme PK SK M Sig has typed public keys, secret keys, messages and signatures. Key generation and signing are probabilistic programs and verification is a Boolean test ([BS23], Section 13.1). Correctness is a separate property (Scheme.Correct).

The security experiments are instances of the forgery experiment forgeExperiment: the forger receives the public key, queries a signing oracle and outputs a candidate (m, σ). In eufCmaExperiment the oracle signs every query and m must never have been signed ([BS23], Attack Game 13.1). sufCmaExperiment only asks that (m, σ) was never an answer ([BS23], Section 13.1.1). oneTimeEufCmaExperiment is the one-time variant of Attack Game 13.1, whose oracle answers the first query only. Asymptotic security over a family of schemes and the efficiency of the forger are stated on top of these experiments.

An indexed scheme Signature.IndexedScheme signs a message at an index below its capacity ([BS23], Definition 14.6). In IndexedScheme.eufCmaExperiment the forger picks the index of each query and a used index is refused; in IndexedScheme.counterEufCmaExperiment the signer uses its own counter as the index ([BS23], Section 14.6.4).

Main definitions #

Main results #

References #

structure Cslib.Crypto.Signature.Scheme (PK SK M Sig : Type) :

A signature scheme ([BS23], Section 13.1) with public keys PK, secret keys SK, messages M and signatures Sig.

  • keyGen : ProbComp (PK × SK)

    Key generation: draw a public key and its secret key.

  • sign : SK → M → ProbComp Sig

    Sign a message with the secret key.

  • verify : PK → M → Sig → Bool

    Verify a candidate signature on a message under the public key.

@[reducible, inline]

A forger receives the public key, queries a signing oracle on messages and outputs a candidate message and signature.

def Cslib.Crypto.Signature.Scheme.Correct {PK SK M Sig : Type} (S : Scheme PK SK M Sig) :

A scheme is correct when every signature that signing can output verifies, for every key pair that key generation can output and every message.

def Cslib.Crypto.Signature.Scheme.restrict {PK SK M Sig : Type} [Inhabited Sig] (S : Scheme PK SK M Sig) (adm : M → Bool) :
Scheme PK SK M Sig

The scheme S on the message space adm: signing an admissible message is unchanged, signing any other message returns default, and a signature verifies only on an admissible message. A signing query outside adm thus reveals nothing; in the many-query experiments it has the effect of a refused query (Signer.restrict).

@[simp]
theorem Cslib.Crypto.Signature.Scheme.restrict_keyGen {PK SK M Sig : Type} [Inhabited Sig] (S : Scheme PK SK M Sig) (adm : M → Bool) :
@[simp]
theorem Cslib.Crypto.Signature.Scheme.restrict_sign {PK SK M Sig : Type} [Inhabited Sig] (S : Scheme PK SK M Sig) (adm : M → Bool) (sk : SK) (m : M) :
(S.restrict adm).sign sk m = if adm m = true then S.sign sk m else pure default
@[simp]
theorem Cslib.Crypto.Signature.Scheme.restrict_verify {PK SK M Sig : Type} [Inhabited Sig] (S : Scheme PK SK M Sig) (adm : M → Bool) (pk : PK) (m : M) (σ : Sig) :
(S.restrict adm).verify pk m σ = (adm m && S.verify pk m σ)
@[reducible, inline]
abbrev Cslib.Crypto.Signature.Scheme.eufCmaExperiment {PK SK M Sig : Type} [Inhabited Sig] [DecidableEq M] (S : Scheme PK SK M Sig) (A : Forger PK M Sig) :

The existential forgery experiment under adaptive chosen-message attack ([BS23], Attack Game 13.1): draw a key pair, run the forger on the public key with a signing oracle for every query, and accept a valid signature on a message that was never queried.

@[reducible, inline]
abbrev Cslib.Crypto.Signature.Scheme.sufCmaExperiment {PK SK M Sig : Type} [Inhabited Sig] [DecidableEq M] [DecidableEq Sig] (S : Scheme PK SK M Sig) (A : Forger PK M Sig) :

The strong forgery experiment ([BS23], Section 13.1.1): as eufCmaExperiment, but a valid pair (m, σ) wins whenever the oracle never answered m with σ.

@[reducible, inline]
abbrev Cslib.Crypto.Signature.Scheme.oneTimeEufCmaExperiment {PK SK M Sig : Type} [Inhabited Sig] [DecidableEq M] (S : Scheme PK SK M Sig) (A : Forger PK M Sig) :

The one-time existential forgery experiment: as eufCmaExperiment, but the signing oracle answers only the first query and refuses every later one.

Strong unforgeability implies existential unforgeability: a forger wins the existential experiment at most as often as the strong one.

theorem Cslib.Crypto.Signature.Scheme.sufCmaExperiment_eq_eufCmaExperiment {PK SK M Sig : Type} [Inhabited Sig] [DecidableEq M] [DecidableEq Sig] {S : Scheme PK SK M Sig} (hS : S.Correct) (hunique : ∀ keys ∈ S.keyGen.eval.support, ∀ (m : M) (σ σ' : Sig), S.verify keys.1 m σ = true → S.verify keys.1 m σ' = true → σ = σ') (A : Forger PK M Sig) :

Unique signatures: for a correct scheme in which each message has at most one valid signature under each supported key pair, the strong and existential forgery experiments have the same distribution.

An indexed signature scheme ([BS23], Definition 14.6) with capacity capacity: it signs a message m at an index u, and the signer must never use an index twice.

  • keyGen : ProbComp (PK × SK)

    Key generation: draw a public key and its secret key.

  • capacity : ℕ

    The number of indices available; the signer uses indices below it.

  • sign : SK → ℕ → M → ProbComp Sig

    Sign a message at an index with the secret key.

  • verify : PK → ℕ → M → Sig → Bool

    Verify a candidate signature on a message at an index under the public key.

@[reducible, inline]
abbrev Cslib.Crypto.Signature.IndexedScheme.eufCmaExperiment {PK SK M Sig : Type} [Inhabited Sig] [DecidableEq M] (S : IndexedScheme PK SK M Sig) (A : Forger PK (ℕ × M) Sig) :

The indexed forgery experiment ([BS23], Definition 14.6): the forger chooses the index of each signing query, a query at a used index or at an index ≥ capacity is refused, and the forger wins with a valid signature on a pair (u, m) with u < capacity that was never signed.

@[reducible, inline]

The counter forgery experiment ([BS23], Section 14.6.4): the signer keeps a counter, signs its i-th message at index i and publishes i with the signature; it refuses once the capacity is used up. The forger wins with a valid signature, at an index u < capacity, on any message that was never signed.