Skip to content

Evidence records

Status: implemented (first milestone). This page describes long-term evidence that one operator can issue and another can take over and renew. Operator instructions are in Preserve evidence.

A Witness receipt shows that several signers saw a file hash at a time each signer measured. Those signatures use keys and algorithms that will eventually expire or weaken. An evidence record keeps the proof checkable after that: it binds the file hash to a timestamp from an outside time-stamp authority (TSA) and, before that timestamp can no longer be verified, adds a newer timestamp that covers the older one.

Witness uses the standard formats, so a verifier does not need Witness software:

  • RFC 3161 time-stamp tokens, requested from TSAs that each operator chooses and trusts;
  • RFC 4998 evidence records (ASN.1, DER), which the European Commission's open-source DSS library can validate.

What the first milestone must show

  1. Operator A (a Witness gateway) puts the hashes of several files into one tree and gets one RFC 3161 token for the tree's root from its TSA. Each file gets its own evidence record.
  2. A exports the records, the Witness receipts, proofs and key history, and the TSA certificate path and revocation lists (CRLs) needed to check the tokens, then disappears before the first renewal is due. B imports the exported files with A already offline, checking everything against its own trust settings; nothing in the package can make itself trusted.
  3. Before A's TSA certificate expires, B adds a renewal timestamp from a different TSA that B trusts. B needs none of A's keys and none of the original files.
  4. After A's TSA certificate has expired, an offline third party, C, validates the renewed record against the original file with unmodified EU DSS, and checks the Witness receipt separately with witness verify. An unrelated file, an altered record, an untrusted TSA, or missing revocation evidence must not validate.

What is preserved

For each confirmed receipt, Operator A preserves two objects, each with its own evidence record:

Object Hash in the record Why
The document The SHA-256 hash the client submitted Lets anyone holding the file prove it existed by the TSA's time. Witness never sees the file.
The signed receipt SHA-256 of the exact receipt bytes in the export Shows the signers' signatures and clock readings existed by the TSA's time.

The Witness log commits to the receipt record but not to its signatures, so the second record is what preserves the signatures. A timestamp only shows that the signed values existed by the TSA's time. It does not make the signers' clock readings more accurate.

Separate records (rather than one record for both objects) let C validate the document record with nothing but the file.

Building a batch

Operator A builds an RFC 4998 hash tree that is separate from the Witness log:

  • Leaves: the 32-byte SHA-256 hashes of the objects in the batch, in the order they were added.
  • Pairing: adjacent nodes are paired level by level. A node without a partner moves up unchanged.
  • Parent: SHA-256 of the two child hashes sorted in binary ascending order and concatenated (RFC 4998 ยง4.2). This is different from the Witness log, which keeps left/right order and prefixes leaves and nodes.
  • Root: the root itself is the timestamp's message imprint (it is already a SHA-256 value; RFC 4998 ยง4.3 step 4). A batch of one object is timestamped over that object's hash.

Each record's reduced hash tree lists, level by level, the hashes needed to reach the root:

  • the first list contains only the object's own hash;
  • each later list contains only the partner at the next level up; the hash computed so far is not repeated (the verifier adds it);
  • a level where the node has no partner is omitted.

A single-value list passes its value through unchanged, and every other list is sorted with the computed hash, concatenated, and hashed. This matches DSS 6.5.1 (EvidenceRecordTimeStampSequenceVerifier.computeDigestValueGroupHash) and Bouncy Castle's RFC 4998 implementation (BinaryTreeRootCalculator). Putting only the object's hash in the first list means each record names exactly one object, so the records of paired objects are not interchangeable.

Time-stamp tokens

An operator configures, for each TSA it uses: the request URL, the trust anchors it accepts, any intermediate certificates, and the CRL URLs that cover the TSA's certificate path. Witness does not follow URLs found inside certificates.

Getting a token

The operator requests a token whose SHA-256 message imprint is the root, with a random 64-bit nonce and certReq = true, and accepts the response only if the status is granted, the imprint and nonce match, genTime is within the allowed clock difference of the operator's clock (default 300 seconds), and the token passes the checks below. The nonce and clock checks apply only when a token is first obtained.

Checking a token

A token is accepted only if all of these hold:

  • It is DER-encoded CMS SignedData with exactly one signer and eContentType = id-ct-TSTInfo. (genTime with fractional seconds is rejected in pass 1.)
  • The signed attributes include exactly one contentType (id-ct-TSTInfo) and exactly one messageDigest, equal to the SHA-256 of the exact eContent octets. The signature is checked over the DER SET OF encoding of the signed attributes, with an allowed algorithm (ECDSA P-256 or P-384 with SHA-256/384, RSA PKCS#1 v1.5 or PSS with SHA-256/384/512). The message imprint itself is always SHA-256.
  • The signer identifier and the first ESS signing-certificate-v2 entry both identify the same TSA certificate.
  • The TSA certificate has a critical extended key usage containing only timeStamping; if it has a key usage extension, that permits digital signatures.
  • The certificate path leads to one of the verifier's own trust anchors and is valid at genTime, and also at the time it is being relied on (see Checking a record).
  • When revocation evidence is required, it is embedded and complete (below).

Revocation evidence

After accepting a token, the operator fetches the configured CRLs. A CRL covers a certificate in the path (other than a trust anchor) only if:

  • it is a complete CRL (no delta or partitioned CRL) signed by that certificate's issuer;
  • it does not list the certificate;
  • its thisUpdate is at or after the token's genTime, so it speaks for the moment of timestamping, and at or before the certificate's notAfter, because a CRL issued after a certificate expires may no longer list it;
  • when the token is first obtained or renewed, its nextUpdate is in the future. A verifier checking historical evidence does not apply this rule.

If a suitable CRL is not available yet, the batch stays incomplete and the operator retries later. When every certificate is covered, the operator stores a copy of the token with the certificates and CRLs added to the CMS certificates and crls fields. The signed content and signer information stay byte-for-byte unchanged; this is checked before the copy is saved. The copy is frozen from then on, because a renewal covers its exact bytes.

OCSP is not supported in pass 1. A TSA whose certificates offer only OCSP cannot be used yet.

Outbound requests

TSA and CRL URLs come only from operator configuration. Requests follow no redirects and have size and time limits.

Checking a record

To check a record for an object with hash h, a verifier:

  1. checks that the first archive timestamp's reduced hash tree starts with [h] and reaches the token's imprint;
  2. checks each later archive timestamp in the chain: its reduced hash tree starts with [SHA-256 of the previous token's exact DER] and reaches its own token's imprint, and its genTime is later than the previous one;
  3. checks every token (above) with revocation evidence required. Each token's certificate path must be valid at the next token's genTime; the newest token's path must be valid at the time of checking. Every archive timestamp uses SHA-256.

Operator A: issuing records

  • Reserve: a batch reserves its members (document and receipt objects for each receipt, both in the same batch), the exact receipt bytes, the root, and the nonce in one transaction before contacting the TSA. Each (receipt, object kind) pair belongs to at most one batch.
  • Timestamp: an accepted token is saved before revocation evidence is collected, so a restart does not request a second token for the same batch.
  • Complete: once revocation evidence is complete, the frozen token copy is saved and the batch's records become available. A batch is published as a whole.
  • Batch state changes are conditional on the previous state, so a second worker cannot overwrite a newer state.

Export package

GET /v1/evidence/{hash} on Operator A returns the package for a document hash once its batch is complete:

{
  "format": "witness-evidence/v1",
  "document": { "sha256": "<hex>", "evidence_record": "<base64 DER>" },
  "receipt": {
    "content": "<base64 exact receipt bytes (SignedAttestation JSON)>",
    "sha256": "<hex>",
    "evidence_record": "<base64 DER>"
  },
  "proof_bundle": { "...": "the Witness proof bundle, if the receipt is logged" },
  "key_history": { "...": "the gateway's key history" }
}

witness evidence export --hash HASH --out DIR writes the package plus document.ers, receipt.json, receipt.ers, proof.json, and key-history.json. Tokens carry their full certificate path, up to and including the root, as BSI TR-ESOR recommends. Nothing in the package is treated as trusted: operators and verifiers configure their own trust anchors.

Operator B: custody and renewal

witness-custodian keeps imported records in its own SQLite database.

  • import checks, without the original file: both records (see Checking a record) under B's own TSA trust anchors; that the receipt bytes match the receipt record; that the receipt verifies against B's pinned Witness key file and the key history authenticated from it, and is for the document's hash; and, if present, that the proof bundle verifies for that receipt. It then records the renewal deadline: the earliest notAfter in the newest token's certificate path, minus a safety margin (default 90 days). Importing a package again never replaces a newer chain with an older one.
  • status lists records and their deadlines.
  • renew renews records whose deadline falls within a window. It refuses to renew a record whose newest token is no longer valid now: that renewal would be too late. Records whose newest token is the same share one renewal: B timestamps SHA-256 of that token's exact DER with its own TSA, checks the new token and completes its revocation evidence as above, and appends a new archive timestamp (reduced hash tree [leaf]) to each record's newest chain (RFC 4998 ยง5.2). Each record is updated only if its newest token is still the one that was renewed, and all of a renewal's updates commit together. A renewal saved before the previous token expired remains valid after it expires.
  • export writes the renewed records and the original receipt files.

Hash-tree renewal, needed if SHA-256 weakens, requires the holder to rehash the original file and is not part of pass 1.

Verification by a third party (C)

C needs the original file, the exported files, and the TSA root certificates it trusts. Without network access, C:

  • validates document.ers against the original file and receipt.ers against receipt.json with unmodified EU DSS (see interop/dss/); both must pass;
  • checks the receipt with witness verify receipt.json --network-config PIN --key-history key-history.json --data ORIGINAL.

The handoff test also checks that these fail: an unrelated file, an altered record or signed content, an untrusted TSA, a record whose newest CRL is missing, a record that was never renewed (after its TSA certificate expires), and a renewal attempted after the previous token expired.

Limits

  • The TSA's time is only as trustworthy as the TSA. Witness does not make the TSA qualified or the signers' times more accurate.
  • Renewal must happen before the newest timestamp stops being verifiable. If every custodian misses the deadline, the evidence cannot be repaired.
  • Each record carries the hashes it needs, so removing one record from storage does not affect the others in its batch.
  • As in RFC 4998, tree nodes are hashed without separate leaf and node prefixes. Someone could build a record for the 64-byte concatenation of two child hashes in a tree. That says nothing about any chosen document.