Documentation

CslibFrontier.Crypto.Computational.IndexedSignature.Counter

Counter-stateful signatures from indexed signatures #

An indexed signature scheme becomes an ordinary many-time signature scheme once the signer chooses the indices itself: it keeps a counter j, signs its j-th message at index j, and publishes j with the signature. This is the construction of [BS23], Section 14.6.4, with the counter as the nonce, and it is how Merkle's tree signature is used ([Mer90a], Sections 6–7). The signer is stateful, so the construction is not a SignatureScheme, whose signer is a function of the secret key alone. Instead, the state lives in the signing oracle of a dedicated security game.

The counter signing oracle (counterSigningOracle) at security parameter n holds the counter and the signed messages. While j < capacity n it signs the request at index j, answers with the word encPair encUnary encBits (j, σ) and advances; once the capacity is exhausted it answers the empty word and records nothing. A signature word is verified by counterVerify, which reads (u, σ) and runs the indexed verifier at u. The game counterEufCmaGame is the EUF-CMA experiment with this oracle; the forger wins with a valid signature on any message it never had signed, of any length, at an index u < capacity n. It admits forgeries on messages of every length, where SignatureScheme.eufCmaGame counts only n-bit ones, but it also requires the forgery's index to be below the capacity, which counterVerify alone does not check. The two games are therefore not ordered in general.

From j = capacity n on, the signing oracle refuses every request, and a forgery counts only at an index below the capacity, as in indexedEufCmaGame. Definition 14.6 (printed p. 597) has message space {1, …, q} × M, and in the nonce example of Section 14.6.4 the counter runs from 1 to q (printed p. 603); here indices run from 0 to q - 1.

The security reduction is exact. counterForger runs a counter forger, answering its j-th signing query through the indexed signing oracle at index j and forwarding the forgery with its index. Indices never repeat, so the indexed oracle never refuses, and the simulation is perfect: the counter forger's success is at most the indexed forger's (succProbability_counterEufCmaGame_le). Replies are truncated to a bound on the signing length, which the honest oracle never exceeds, so that the reduction is strict oracle PPT for every external oracle (isOraclePPT_counterForger).

Main definitions #

Main results #

References #

The counter signing oracle and its game #

The counter signing oracle at security parameter n. Its state is the number j of signatures issued so far and the signed messages, most recent first. While j < capacity n, the requested message is signed at index j, the reply is the word encPair encUnary encBits (j, σ), and the state advances; afterwards every request receives the empty word and changes nothing.

Verify a counter signature word on msg under pk: read the index u and the indexed signature σ from the word encPair encUnary encBits (u, σ) (with requestDecoder, which reads every word) and check verify pk u msg σ.

The counter EUF-CMA experiment: sample (pk, sk) ← keyGen n, run the forger on (n, pk) with the counter signing oracle started at (0, []), and accept a valid counter signature, at an index below capacity n, on a message that was never signed, of any length.

Completeness: the counter signature word of an indexed signature at an index below the capacity verifies.

theorem Cslib.Crypto.IndexedSignatureScheme.counterVerify_of_mem_support_counterSigningOracle {S : IndexedSignatureScheme} (n : ℕ) (keys : List Bool × List Bool) (hkeys : keys ∈ (S.keyGen n).eval.support) (request : Unit × List Bool) {j : ℕ} (hj : j < S.capacity n) (signed : List (List Bool)) {result : List Bool × ℕ × List (List Bool)} (hresult : result ∈ (S.counterSigningOracle n keys.2 request (j, signed)).eval.support) :
S.counterVerify keys.1 request.2 result.1 = true ∧ result.2 = (j + 1, request.2 :: signed)

Every reply of the counter signing oracle below the capacity verifies on the requested message, and the oracle advances its counter and logs the message.

Efficiency of the game #

The whole counter EUF-CMA experiment is uniformly strict PPT in its unary security parameter for every oracle-PPT forger.

The security predicate #

Existential unforgeability of the counter-stateful use of an indexed scheme under adaptive chosen-message attack ([BS23], Section 14.6.4, with the counter as the nonce) against uniform strict oracle-PPT forgers. A forgery on any never-signed message counts, whatever its length, provided its index is below capacity n.

Counter EUF-CMA security gives negligible forging probability for every oracle-PPT forger.

The reduction to indexed forgery #

The indexed forger's answer to a counter forger's signing request, with the counter j as its state: below the capacity, sign the message at index j by one external query to the indexed signing oracle, truncate the reply to bound n msg.length bits, answer with the counter signature word and advance; otherwise answer the empty word.

The indexed forger built from a counter forger: run it with counterHandler from counter 0, and forward its forgery (msg, encPair encUnary encBits (u, σ)) as (u, msg, σ).

Exact simulation #

The exact bound #

theorem Cslib.Crypto.IndexedSignatureScheme.succProbability_counterEufCmaGame_le {S : IndexedSignatureScheme} {bound : ℕ → ℕ → ℕ} {n : ℕ} (hbound : ∀ x ∈ (S.keyGen n).eval.support, ∀ j < S.capacity n, ∀ (msg σ : List Bool), σ ∈ (S.sign x.2 j msg).eval.support → σ.length ≤ bound n msg.length) (adversary : Forger) :

Counter forgery reduces to indexed forgery without loss. For every forger and every security parameter n, the forging probability in the counter game is at most the forging probability of counterForger in the indexed game. The bound bound n L must cover the length of every indexed signature on an L-bit message at an index below the capacity under a supported key; the indexed forger truncates replies to it.

Efficiency of the reduction #

Security #

A counter as the nonce ([BS23], Section 14.6.4, pp. 602–603): if S is a secure q-indexed signature (Definition 14.6, p. 597), with q = capacity n, then the stateful signer that signs its j-th message at index j and publishes j with the signature is existentially unforgeable under adaptive chosen-message attack (CounterEUFCMA). This is the security that Section 14.6.4 states for a nonce-based signature whose nonce is never used twice (p. 602), for its counter nonce (p. 603).

The differences from the source are those of IndexedEUFCMA (see the IndexedSignature module docstring), shared by premise and conclusion:

  • signing may be randomized, where Definition 14.6 requires deterministic signing, so the theorem covers more schemes and is the source's for deterministic ones;
  • messages are bit strings of any length;
  • a request the source forbids (a repeated index or one u ≥ capacity n in the indexed game, any request once j = capacity n in the counter game) is answered with the empty word and not recorded, instead of being excluded from the adversary class; a forger can predict these refusals, so the notions agree;
  • indices run over 0, …, q - 1 instead of 1, …, q, and a forgery counts only at an index below the capacity, which the counter game reads from the signature word.

Forgers are uniform strict oracle-PPT machines. The reduction counterForger forwards each request at the counter's index and the forgery with its index; it is certified (isOraclePPT_counterForger) and has loss 1 (succProbability_counterEufCmaGame_le).