Documentation

CslibFrontier.Crypto.Computational.OneWayToSignature

Equivalence between one-way functions and one-time digital signatures, and necessity for EUF-CMA #

This module establishes the foundational reductions connecting one-way functions (OneWay and OneWayOn) and uniform digital signature schemes (SignatureScheme):

  1. Secure signatures imply one-way functions (SignatureScheme.OneTimeEUFCMA.exists_oneWay, SignatureScheme.EUFCMA.exists_oneWay): for any digital signature scheme S that is existentially unforgeable under one-time (or full adaptive) chosen-message attack, reindexing the seeded key-generation evaluator (seed ↦ (n, (evaluate n seed).1)) across all input lengths via GeneratorReindex.parameter yields a one-way function. Any PPT inverter for this function gives a zero-query PPT forger that recovers a valid secret key for the challenge public key and signs 0^n.
  2. Lamport's one-time signature scheme from a one-way function (lamportScheme, succProbability_eufOneTimeGame_lamport_le, OneWayOn.oneTimeEUFCMA_lamport, OneWayOn.exists_oneTimeSignature, OneWay.exists_oneTimeSignature): given any deterministic polynomial-time function f : List Bool → List Bool, lamportScheme f is the basic Lamport scheme S_L of [BS23], Section 14.1 (pp. 584–585) on domain X = {0,1}ⁿ and message length v = n. Key generation samples 2n independent n-bit secret words and publishes their f-images as the verification key; signing an n-bit message reveals one secret word per message bit; verification checks that each revealed signature block has length msg.length (σᵢ ∈ {0,1}ⁿ) and that its f-image matches the corresponding public-key block. When f is one-way on a domain valid containing every n-bit word (OneWayOn f valid, [BS23], Section 8.11.1, Definition 8.6, p. 336; valid n w = decide (w.length = n) gives the source's assumption on X = {0,1}ⁿ), lamportScheme f is one-time EUF-CMA secure (OneTimeEUFCMA, [BS23], Definition 14.1, p. 583; Attack Game 13.1, pp. 529–530): any one-time forger must supply an n-bit preimage at some slot j never revealed by the single signing query.
  3. Equivalence (exists_oneWay_iff_exists_oneTimeSignature): a one-way function (OneWay) exists if and only if a one-time EUF-CMA secure signature scheme exists.

Together with SignatureScheme.EUFCMA.oneTimeEUFCMA, this establishes the necessity half of Rompel's theorem ((∃ S, S.EUFCMA) → ∃ f, OneWay f) and the one-time sufficiency half ((∃ f, OneWay f) ↔ (∃ S, S.OneTimeEUFCMA)). The many-time sufficiency half is proved in CslibFrontier.Crypto.Computational.Rompel from universal one-way hash families and authentication trees: every uniform OneWay function yields a stateless many-time SignatureScheme satisfying EUFCMA on n-bit messages (OneWay.exists_eufCMA) and a WordSignatureScheme satisfying EUFCMA on arbitrary-length messages (OneWay.exists_wordEUFCMA), and exists_oneWay_iff_exists_signature states Rompel's equivalence.

Main definitions #

Main results #

References #

Secure digital signatures imply one-way functions #

Any digital signature scheme that is existentially unforgeable under one-time chosen-message attack (OneTimeEUFCMA) implies the existence of a one-way function.

Any digital signature scheme that is existentially unforgeable under adaptive chosen-message attack (EUFCMA) implies the existence of a one-way function.

Lamport's one-time signature scheme from any one-way function #

noncomputable def Cslib.Crypto.lamportKeyGen (f : List Bool → List Bool) (n : ℕ) :

Lamport key generation: sample 2n independent n-bit secret words, publish their f-images as the framed public key, and keep the framed secret words as the signing key.

Lamport signing: decode the secret key into 2n words and, when the message length matches, reveal word 2 * i + msg[i].toNat for each bit position i < msg.length.

def Cslib.Crypto.lamportVerify (f : List Bool → List Bool) (pk msg sig : List Bool) :

Lamport verification ([BS23], Section 14.1, pp. 584–585): decode the public key into 2 * msg.length blocks and the signature into msg.length blocks, and check for every i < msg.length that the revealed block sigWords[i] lies in {0,1}^{msg.length} (so wrong-length preimages of f are rejected) and f (sigWords[i]) = pkWords[2 * i + msg[i].toNat].

Because the total decoder frames does not require a canonical encList encBits tail (for instance [true, false] and [true, false, true] also decode to [[false]] alongside the canonical [true, false, false]), this check is trivially malleable on a fixed message and does not give strong unforgeability (SUF-CMA); it is sound for OneTimeEUFCMA because a forgery must be on a fresh message and lamportInverter uses the same frames decoder.

theorem Cslib.Crypto.lamportVerify_lamportSign (f : List Bool → List Bool) (n : ℕ) (keys : List Bool × List Bool) (hkeys : keys ∈ (lamportKeyGen f n).eval.support) (msg : List Bool) (hmsg : msg.length = n) (sig : List Bool) (hsig : sig ∈ (lamportSign keys.2 msg).eval.support) :
lamportVerify f keys.1 msg sig = true

Lamport's one-time digital signature scheme built from any polynomial-time function f.

Security reduction for Lamport's one-time signature scheme #

noncomputable def Cslib.Crypto.lamportSimKeys (f : List Bool → List Bool) (n j : ℕ) (y : List Bool) :

Sample the simulated public key and dummy signing key around a challenge y at index j.

Reduction that inverts f on challenge y at security parameter n by embedding y at a uniformly sampled index j < dyadicSize (2 * n). When j < 2 * n, embed y in slot j of a Lamport public key and run a one-time forger; otherwise return the empty word.

Concrete reduction bound for Lamport's one-time signature scheme S_L ([BS23], Section 14.1, pp. 584–585): for every parameter n and every answer domain valid containing all n-bit words, a one-time forger adversary succeeds against lamportScheme f hf with probability at most dyadicSize (2 * n) times the inversion probability of lamportInverter f hf adversary in inversionGameOn f valid (Definition 8.6, p. 336). Because lamportInverter draws its slot guess with fair coins from {0, …, dyadicSize (2 * n) - 1} where dyadicSize m = 2 ^ (Nat.log 2 m + 1), the loss factor is dyadicSize (2 * n) (≤ 4 * n for n ≥ 1, and 2 at n = 0) instead of the source's 2 * n.

theorem Cslib.Crypto.OneWayOn.oneTimeEUFCMA_lamport {f : List Bool → List Bool} {valid : ℕ → List Bool → Bool} (hf : OneWayOn f valid) (hvalid : ∀ (n : ℕ) (w : List Bool), w.length = n → valid n w = true) :

One-time security of the basic Lamport signature scheme S_L ([BS23], Section 14.1, pp. 584–585; Theorem 14.1, p. 584 is the one-bit case; general security follows from Theorem 14.2, p. 587; historical attribution to [Lam79], whose primary technical report was not inspected): if f is one-way on an answer domain valid containing every n-bit word (OneWayOn f valid, [BS23], Section 8.11.1, Definition 8.6, p. 336), then lamportScheme f is existentially unforgeable under a one-time adaptive chosen-message attack (OneTimeEUFCMA, [BS23], Definition 14.1, p. 583; Attack Game 13.1, pp. 529–530).

With valid n w = decide (w.length = n) the assumption is Definition 8.6 on X = {0,1}ⁿ (wider predicates, such as fun _ _ => true for OneWay, give stronger assumptions). Material deviations from [BS23], Section 14.1:

  • Message length v equals the security parameter n ({0,1}ⁿ), with X = {0,1}ⁿ and framing encoding encList encBits for keys and signatures. The total decoder frames also accepts non-canonical final frames (e.g., [true, false] and [true, false, true] alongside [true, false, false] for [[false]]); this is sound for OneTimeEUFCMA (which requires a fresh message, and lamportInverter uses the same frames decoder), though lamportScheme is malleable on the same message and thus not strongly unforgeable (SUF-CMA).
  • The edge case n = 0 is admitted: M = {[]} with pk = sk = sig = [], where both the one-time signature game and inversionGameOn (via lamportInverter returning []) can be won with probability 1, and the concrete bound holds trivially (≤ 1 ≤ 2 = dyadicSize 0 * 1).
  • Adversaries and reductions are uniform strict PPT (IsPPT, IsOraclePPT) receiving n in unary.
  • The reduction lamportInverter draws its slot guess with fair coins from {0, …, dyadicSize (2 * n) - 1} (dyadicSize (2 * n) ≤ 4 * n for n ≥ 1, 2 at n = 0), giving SIGadv[A, S_L] ≤ dyadicSize (2 * n) * OWadv[B, f] (succProbability_eufOneTimeGame_lamport_le) for one-query forger A and B scored on valid via inversionGameOn, instead of the source's factor 2 * n.
theorem Cslib.Crypto.OneWayOn.exists_oneTimeSignature {f : List Bool → List Bool} {valid : ℕ → List Bool → Bool} (hf : OneWayOn f valid) (hvalid : ∀ (n : ℕ) (w : List Bool), w.length = n → valid n w = true) :

Any function one-way on a domain containing every n-bit word implies the existence of a one-time EUF-CMA secure signature scheme.

Any one-way function implies the existence of a one-time EUF-CMA secure signature scheme.

Equivalence between one-way functions and one-time digital signatures: a one-way function exists if and only if a one-time EUF-CMA secure uniform signature scheme exists.