Signature Algorithms #
This file defines SignatureAlg m M PK SK S, a type representing a digital signature scheme
with computations in the monad m, message space M, public/secret key spaces PK/SK,
and signature space S.
Signature algorithm with computations in the monad m,
where M is the space of messages, PK/SK are the spaces of the public/private keys,
and S is the type of the final signature.
- keygen : m (PK × SK)
- sign (pk : PK) (sk : SK) (msg : M) : m S
Instances For
In the new API, QueryImpl (M →ₒ S) is just M → m S (since Domain = M).
The old version used ⟨fun | query () msg => ...⟩ which matched the old struct-based API.
Instances For
Transport a signature scheme across a monad morphism by mapping each algorithmic component.
This is the basic reindexing operation used by naturality theorems for generic constructions:
if a signature scheme was defined in a source monad m, then any monad morphism m →ᵐ n
induces the corresponding scheme in n.
Instances For
Completeness of a signature scheme with error δ: for every message, the canonical
keygen-sign-verify execution accepts with probability at least 1 - δ.
The error δ captures all sources of failure, including both verification mismatches and
signing failures (e.g., abort in schemes like Fiat-Shamir with aborts).
Complete sigAlg runtime 0 is equivalent to PerfectlyComplete sigAlg runtime.
Instances For
Perfect completeness: the canonical keygen-sign-verify execution always accepts.
This is the special case of Complete with zero error.
Instances For
If every key pair (pk, sk) in the support of a generator satisfies
Pr[= a | f pk sk] ≥ 1 - δ, then the overall probability Pr[= a | gen >>= f] ≥ 1 - δ.
This reduces a "for all keys" completeness statement to per-key bounds.
- main (pk : PK) : OracleComp (spec + OracleSpec.ofFn fun (x : M) => S) (M × S)
Instances For
Unforgeability experiment for a signature algorithm: runs the adversary and checks whether the adversary successfully forged a signature. The ambient oracle family is forwarded unchanged, the signing oracle is logged, and the final check requires both signature validity and that the forged message was never submitted to the signing oracle.
Instances For
The success probability of a CMA adversary in the unforgeability experiment.
Instances For
An EUF-NMA (existential unforgeability under no-message attack) adversary for a
signature scheme. Unlike a CMA adversary (unforgeableAdv), the NMA adversary has NO
access to a signing oracle — it must forge a signature having only seen the public key.
In the random oracle model, the adversary still has access to the scheme's oracle spec
(e.g., the random oracle H), but never sees any legitimately generated signatures.
- main (pk : PK) : OracleComp spec (M × S)
Instances For
The EUF-NMA experiment: generate a key pair, give the public key to the adversary (with no signing oracle), and check whether the adversary produced a valid forgery.
Instances For
The success probability of an EUF-NMA adversary.
Instances For
An EUF-NMA adversary with managed random oracle: the adversary returns a QueryCache
alongside its forgery. The experiment verifies using withCacheOverlay, which resolves
cached entries from the adversary's table and forwards misses to the real oracle.
This supports compositional CMA-to-NMA reductions: the CMA-to-NMA reduction programs
hash entries for signing simulation into the cache, while forwarding the inner adversary's
hash queries to the external oracle. The forking lemma (Fork.fork) can then replay the
external oracle queries via seeded simulation, while the programmed entries are preserved
deterministically.
- main (pk : PK) : OracleComp spec ((M × S) × spec.QueryCache)
Instances For
The managed-RO NMA experiment: generate a key pair, run the adversary to get a forgery
and a QueryCache, then verify the forgery through withCacheOverlay so that programmed
entries take priority over the real oracle.
Instances For
The success probability of a managed-RO NMA adversary.
Instances For
Embed a standard NMA adversary as a managed-RO NMA adversary with an empty cache. The empty cache means all queries fall through to the real oracle, recovering the standard NMA experiment.