Expand description
Merkle batch signing (issue #392).
A TPM 2.0 makes roughly 5-50 ECDSA signatures per second, far below
robot topic rates. In batch mode the agent hashes a batch of events
into a Merkle tree and the signer signs only a batch statement naming
the root, once per batch. Each event carries the statement, its
signature and its inclusion proof in provenance.batch, so it can still
be verified on its own.
The tree is the RFC 9162 (Certificate Transparency) Merkle tree over
SHA-256: leaf SHA-256(0x00 || leaf payload), node
SHA-256(0x01 || left || right), inclusion proofs as RFC 9162 audit
paths (leaf first). The leaf payload is the event’s signing payload
with provenance.batch also removed. The construction is identical to
the Python SDK’s phytrace.core.merkle and PhyCloud’s verifier, pinned
by PhyTrace/test-vectors/merkle-batch.json.
Constants§
- STATEMENT_
TYPE typeof a batch statement.
Functions§
- audit_
path - RFC 9162 inclusion proof for
leaves[index], leaf first;Noneifindexis out of range. - hex
- Lowercase hex.
- leaf_
hash - Hash of a leaf payload.
- merkle_
root - RFC 9162 Merkle tree hash of leaf hashes.
- node_
hash - Hash of an interior node.
- root_
from_ proof - The root an inclusion proof leads to (RFC 9162 §2.1.3.2), or
Noneif the proof does not fit a tree ofsizeleaves. - verify_
inclusion - Whether a batch-signed event (JSON) is in the batch its
statementdescribes: its inclusion proof leads to the statement’s root, and its provenance matches the statement (boot epoch, key, sequence range). The statement’s signature is checked separately.
Type Aliases§
- Hash
- A 32-byte SHA-256 hash.