Documentation

CslibFrontier.Crypto.Computational.Signature

Uniform digital signature schemes and existential unforgeability #

A uniform digital signature scheme (SignatureScheme) consists of a strict probabilistic polynomial-time key generator keyGen, a strict probabilistic polynomial-time signing algorithm sign, and a deterministic polynomial-time verification algorithm verify that accepts every signature produced by sign on an n-bit message under a key pair sampled at security parameter n. The message space at parameter n is exactly the n-bit words; this module does not claim security for arbitrary polynomial-length message families.

We formalize two adaptive chosen-message security notions against uniform strict oracle-PPT forgers (IsOraclePPT):

Main definitions #

Main results #

References #

@[reducible, inline]

An adaptive forger receives a unary security parameter and a public verification key, queries a signing oracle on chosen messages, and outputs a candidate (message, signature) pair.

@[reducible, inline]

Output ((msg, sig), queried) of a forger run against a message-logging signing oracle: the candidate forgery (msg, sig) as bit words, then the list of queried messages. The forgery is framed, with msg framed again inside it, and so is each queried message.

A uniform digital signature scheme on n-bit messages at security parameter n, with strict polynomial-time key generation and signing, deterministic polynomial-time verification, and perfect completeness on supported key pairs, n-bit messages, and signatures.

Signatures have polynomially bounded length: some plain polynomial-time bound n L bounds every signature on a message of length L under a key pair sampled at parameter n.

exists_sign_length_bound on the scheme's own message space: some plain polynomial-time bound n bounds every signature on an n-bit message under a key pair sampled at parameter n.

Full adaptive chosen-message security (EUFCMA) #

@[reducible, inline]

Stateful signing/tagging oracle on the message space adm: it signs an admissible requested message with sign sk and prepends it to the list of queried messages, and it answers any other request with the empty word, without signing or recording it (Signer.restrict).

@[reducible, inline]

Stateful signing/tagging oracle that invokes sign sk on every requested message and prepends the message to the list of queried messages: signingOracleOn on every word.

Stateful signing oracle at parameter n: it signs an n-bit requested message under sk and prepends the message to the list of queried messages, and it answers a request of any other length with the empty word without signing or recording it: signingOracleOn on the n-bit words, instantiated at S.sign.

The EUF-CMA experiment: sample (pk, sk) ← S.keyGen n, run the adaptive forger on (n, pk) with oracle access to S.signingOracle n sk, which signs n-bit messages only, and accept when the forger outputs a valid signature on an n-bit message that was never queried to the signing oracle.

Running an oracle-PPT forger against signingOracleOn (adm n) sign is uniformly strict PPT in the unary security parameter n, public/auxiliary input, and secret key, when the message space adm is decidable in polynomial time.

Running an oracle-PPT forger against signingOracleOf sign is uniformly strict PPT in the unary security parameter, public/auxiliary input, and secret key.

Running an oracle-PPT forger against S.signingOracle is uniformly strict PPT in the unary security parameter, public key, and secret key.

Run the complete EUF-CMA experiment on its unary security parameter for any oracle-PPT forger.

The EUF-CMA experiment is uniformly strict PPT, independently of unused auxiliary input.

Existential unforgeability under adaptive chosen-message attack (EUF-CMA) against uniform strict oracle-PPT adversaries: [BS23], Attack Game 13.1 and Definition 13.2 (pp. 529–530), for the message space of n-bit words. Signing queries and the forgery both lie in that space: the signing oracle answers a query of any other length with the empty word, without signing or recording it.

Full EUF-CMA security gives negligible forgery probability for every oracle-PPT forger.

Establish EUF-CMA security by bounding every oracle-PPT forger's success probability.

One-time adaptive chosen-message security (OneTimeEUFCMA) #

@[reducible, inline]

One-time signing/tagging oracle on the message space adm: it answers the first admissible query using sign sk and records it, and it returns the empty word without signing or recording on every other query. A query outside adm is refused without using up the one answer ((Signer.restrict _ adm).oneTime).

One-time signing oracle at parameter n that answers at most the first n-bit signing query using S.sign sk and returns the empty word without signing on any other query: oneTimeSigningOracleOn on the n-bit words, instantiated at S.sign.

The one-time EUF-CMA experiment: sample (pk, sk) ← S.keyGen n, run the adaptive forger on (n, pk) with oracle access to S.oneTimeSigningOracle n sk (which answers at most one signing query, on an n-bit message), and accept when the forger outputs a valid signature on an n-bit message distinct from the queried message (if any).

Running an oracle-PPT forger against oneTimeSigningOracleOn (adm n) sign is uniformly strict PPT in the unary security parameter n, public/auxiliary input, and secret key, when the message space adm is decidable in polynomial time.

Running an oracle-PPT forger against oneTimeSigningOracle is uniformly strict PPT in the unary security parameter, public key, and secret key.

Run the complete one-time EUF-CMA experiment on its unary security parameter for any oracle-PPT forger.

The one-time EUF-CMA experiment is uniformly strict PPT, independently of unused auxiliary input.

Existential unforgeability under one-time adaptive chosen-message attack against uniform strict oracle-PPT adversaries: a secure one-time signature in the sense of [BS23], Definition 14.1 (p. 583), that is, Attack Game 13.1 (pp. 529–530) with at most one signing query, for the message space of n-bit words. Signing queries and the forgery both lie in that space: the oracle answers only the first n-bit query, and it answers a query of any other length with the empty word without signing or recording it, so such a query does not use up the one answer.

One-time EUF-CMA security gives negligible forgery probability for every oracle-PPT forger.

Establish one-time EUF-CMA security by bounding every oracle-PPT forger's success probability.

Starting from the empty query log, oneTimeSigningOracle records at most one queried message.

theorem Cslib.Crypto.SignatureScheme.run_oneTimeSigningOracle_apply_eq_of_agree (S : SignatureScheme) {α : Type} (n : ℕ) (sk₁ sk₂ : List Bool) {agree : List Bool → Prop} (hagree : ∀ (req : List Bool), agree req → S.sign sk₁ req = S.sign sk₂ req) (prog : Probability.WordOracleComp Unit α) (s : List (List Bool)) (a : α) (queried' : List (List Bool)) (hq' : ∀ r ∈ queried', agree r) :
((OracleComp.interpret (OracleComp.sumHandler (fun (k : ℕ) => StateT.lift (ProbComp.unifOracle k)) fun (q : Unit × List Bool) (s : List (List Bool)) => (S.oneTimeSigningOracle n sk₁ q s).eval) prog).run s) (a, queried') = ((OracleComp.interpret (OracleComp.sumHandler (fun (k : ℕ) => StateT.lift (ProbComp.unifOracle k)) fun (q : Unit × List Bool) (s : List (List Bool)) => (S.oneTimeSigningOracle n sk₂ q s).eval) prog).run s) (a, queried')

If S.sign sk₁ and S.sign sk₂ agree on all requests satisfying agree, then running any adaptive program against oneTimeSigningOracle under sk₁ and sk₂ assigns the same probability to every outcome (a, queried') whose recorded query log satisfies agree.

Reduction from one-time EUF-CMA to full EUF-CMA #

Open stateful handler at parameter n that forwards at most the first signing request in the message space adm n to the external signing oracle (truncating the reply to bound n msg.length), and answers every other request with [] itself. A request outside the message space does not use up the one forwarded query.

def Cslib.Crypto.SignatureScheme.limitToOneQuery (adm : ℕ → List Bool → Bool) (bound : ℕ → ℕ → ℕ) (adversary : Forger) :

Wrap an adaptive forger so that it issues at most one external signing query, on a message in the message space adm n.

Running an adaptive program filtered through oneTimeFilterHandler adm against signingOracleOn (adm n) sign produces the same distribution as running it against oneTimeSigningOracleOn (adm n) sign whenever all outputs of sign sk msg have length at most bound n msg.length.

Refusing signing queries outside the message space in the forger #

def Cslib.Crypto.SignatureScheme.restrictQueries (adm : ℕ → List Bool → Bool) (bound : ℕ → ℕ → ℕ) (adversary : Forger) :

The forger that runs adversary at parameter n, forwards each signing request in the message space adm n to the external signing oracle (truncating the reply to bound n msg.length), and answers every other request with [] itself, as the signing oracle on adm n does. Against the signing oracle on every word it plays the game of adversary against the oracle on adm n (run_restrictQueries_eq_signingOracleOn), so a bound proved for the unrestricted oracle transfers to the restricted one.

theorem Cslib.Crypto.SignatureScheme.run_restrictQueries_eq_signingOracleOn (adm : ℕ → List Bool → Bool) (sign : List Bool → List Bool → ProbComp (List Bool)) (bound : ℕ → ℕ → ℕ) (n : ℕ) (pk sk : List Bool) (hbound : ∀ (msg sig : List Bool), sig ∈ (sign sk msg).eval.support → sig.length ≤ bound n msg.length) (adversary : Forger) :
((OracleComp.interpret (OracleComp.sumHandler (fun (k : ℕ) => StateT.lift (ProbComp.unifFin k)) (signingOracleOf sign sk)) (restrictQueries adm bound adversary n pk)).run []).eval = ((OracleComp.interpret (OracleComp.sumHandler (fun (k : ℕ) => StateT.lift (ProbComp.unifFin k)) (signingOracleOn (adm n) sign sk)) (adversary n pk)).run []).eval

Running restrictQueries adm bound adversary against the signing oracle on every word is running adversary against the signing oracle on adm n, whenever every output of sign sk msg has length at most bound n msg.length.

Full EUF-CMA security implies one-time EUF-CMA security.