Repository navigation
Timestamp
Append an RFC 3161 document timestamp (/DocTimeStamp, SubFilter ETSI.RFC3161): a timestamp authority (TSA) asserts that the exact document bytes existed at a given time. This proves the file has not been modified since that time — it does not identify a signer, and no signing certificate is involved. Only the document digest leaves the machine.
hspdf timestamp [--tsa URL] [--field name] inFile [outFile]
hspdf timestamp contract.pdf # DigiCert TSA, field "Timestamp1"
hspdf timestamp --tsa https://tsa.example.com/ contract.pdf out.pdf
hspdf timestamp --field "Evidence-final" contract.pdf
cat contract.pdf | hspdf timestamp - - > evidenced.pdf| Flag | Default | Meaning |
|---|---|---|
--tsa |
http://timestamp.digicert.com |
timestamp authority URL (http/https) |
--field |
Timestamp1, Timestamp2, … |
signature field name shown in reader signature panels |
The default TSA was picked by comparing the public TSAs for reader acceptance: DigiCert is an AATL member, chains to the ubiquitously trusted DigiCert Assured ID Root CA, and answered fastest. Sectigo and Certum are equivalent alternatives. TSAs whose roots are not in AATL/system stores (e.g. self-operated ones) validate cryptographically but readers flag them as untrusted.
- The timestamp is appended as a PDF incremental update: original bytes stay untouched, so existing signatures remain valid.
- A hidden signature field is attached to page 1 (widget in
/Annots+/Pback-reference) — readers that only list page annotations find it. PDF 1.7 documents using xref streams additionally get the/Extensions /ADBE /ExtensionLevel 3declaration that introduces document timestamps. -
/Contentscarries the CMS time-stamp token, bound to the SHA-256 digest of the whole file except the token gap (/ByteRange). Any later change to covered bytes invalidates the stamp. - The engine validates its own output before returning (TSTInfo profile, message imprint, token signature).
Repeating the command extends the proof: every new timestamp covers all previous revisions, forming a PAdES-style timestamp chain. Verify with hspdf signatures validate (see Signatures).
-
-o(offline mode) refuses to run — the TSA request is the point of the operation. - Encrypted documents are rejected for now; decrypt first (see Decrypt).
- Long-term validation (embedding the TSA's CRL/OCSP via a DSS) is not yet implemented; without it, re-stamping periodically keeps the proof verifiable.
package main
import (
"context"
"github.com/huzpsb/hspdf/pkg/api"
"github.com/huzpsb/hspdf/pkg/pdfcpu/model"
)
func main() {
ctx := context.Background()
conf := model.NewDefaultConfiguration()
// info.GenTime is the TSA asserted time; only the digest was sent.
info, err := api.TimestampFile(ctx, "in.pdf", "out.pdf", "", "Evidence-1", conf)
if err != nil {
panic(err)
}
_ = info
}api.Timestamp is the stream variant; an empty TSA URL selects the DigiCert default.
Related: Signatures · Certificates · Web UI
hspdf wiki
Getting started
Fork features
Inspect
Document
Pages
Content
Extract
Resources
Security
Viewer
Trust
Developers