Documentation

Complexity.Crypto.Computational.MerkleSignature

Merkle signatures #

Merkle's tree signature ([Mer90], Section 6) authenticates 2 ^ d one-time verification keys by the root of a Merkle tree, which is the public key. The signature at leaf u is the one-time key of leaf u, its one-time signature and its authentication path. Each leaf may be used once, so the scheme is an indexed signature scheme (IndexedSignatureScheme) whose index is the leaf ([BS23], Section 14.6.1, "Shrinking the public-key").

MerkleSignature.scheme S H depth builds it from any signature scheme S, used as a one-time scheme on n-bit messages, and a keyed hash H with n-bit digests under n-bit keys:

The capacity is 2 ^ depth n, required to be computable in unary in polynomial time, hence polynomial in n. Security is in Complexity.Crypto.Computational.MerkleSignature.Security.

The scheme is stateful in use: the signer must sign at most once per leaf, for instance with a counter. IndexedSignatureScheme makes the leaf an explicit input, and its security game refuses a repeated leaf.

Main definitions #

Main results #

References #

Words #

A Merkle signature: the one-time verification key, the one-time signature and the authentication path.

Instances For

    The secret key: the hash key and the one-time key pairs.

    Instances For

      The public key: the hash key and the Merkle root of the one-time verification keys.

      Instances For

        Algorithms #

        noncomputable def Cslib.Crypto.MerkleSignature.keyGen (S : SignatureScheme) (H : List Bool → List Bool → List Bool) (depth : ℕ → ℕ) (n : ℕ) :

        Key generation: a uniform n-bit hash key and 2 ^ depth n key pairs of S.

        Instances For

          Sign msg at leaf u, given the hash key and the one-time key pairs: sign the digest H k msg with the one-time key of leaf u, and attach its verification key and authentication path.

          Instances For

            Sign msg at leaf u with a secret key word.

            Instances For
              def Cslib.Crypto.MerkleSignature.verify (S : SignatureScheme) (H : List Bool → List Bool → List Bool) (depth : ℕ → ℕ) (pk : List Bool) (u : ℕ) (msg sig : List Bool) :

              Verify a signature on msg at leaf u under the public key pk = (k, root): the attached verification key opens leaf u of the depth-depth k.length tree with root root (merkleVerify, which checks the path length and u < 2 ^ depth k.length), and the one-time signature verifies on H k msg.

              Instances For

                Completeness #

                theorem Cslib.Crypto.MerkleSignature.mem_support_keyGen {S : SignatureScheme} {H : List Bool → List Bool → List Bool} {depth : ℕ → ℕ} {n : ℕ} {keys : List Bool × List Bool} (h : keys ∈ (keyGen S H depth n).eval.support) :
                ∃ (k : List Bool) (otsKeys : List (List Bool × List Bool)), k.length = n ∧ otsKeys.length = 2 ^ depth n ∧ (∀ x ∈ otsKeys, x ∈ (S.keyGen n).eval.support) ∧ keys = (publicKey H k otsKeys, secretKey k otsKeys)

                Every supported key generation produces an n-bit hash key and 2 ^ depth n supported one-time key pairs.

                theorem Cslib.Crypto.MerkleSignature.verify_sign {S : SignatureScheme} {H : List Bool → List Bool → List Bool} {depth : ℕ → ℕ} (hlen : ∀ (k m : List Bool), (H k m).length = k.length) (n : ℕ) (keys : List Bool × List Bool) (hkeys : keys ∈ (keyGen S H depth n).eval.support) {u : ℕ} (hu : u < 2 ^ depth n) (msg sig : List Bool) (hsig : sig ∈ (sign S H keys.2 u msg).eval.support) :
                verify S H depth keys.1 u msg sig = true

                Completeness: an honest signature at a leaf u < 2 ^ depth n verifies.

                Efficiency #

                Merkle's tree signature ([Mer90], Section 6; [BS23], Section 14.6.1) as an indexed signature scheme of capacity 2 ^ depth n, from a signature scheme S used as a one-time scheme and a keyed hash H with digests of the key's length.

                Instances For