Skip to content
Standards7 min read

RFC 3161 Timestamping: A Practical Guide for Developers

An RFC 3161 timestamp is a signed token from a timestamp authority that binds the hash of your data to a time. You send a hash, you get the token back, and anyone can verify it later with standard tools.

By Cédric Driaux, Founder of tryVidimus

Drawing of a request and a reply exchanged with a clock, and a token below

The RFC 3161 timestamp protocol in brief

RFC 3161 is one of the three standards behind trustworthy photos, with C2PA and the eIDAS qualified timestamp. This guide covers the request, the token and the verification, with commands you can run.

RFC 3161 defines the Time-Stamp Protocol. It involves two roles: a client that holds some data, and a Time Stamping Authority (TSA) that holds a trusted clock and a signing key. The exchange is one request and one response.

  1. The client hashes its data and sends the hash to the TSA.
  2. The TSA builds a small structure with that hash and its current time, signs it, and returns it.
  3. The client stores the response next to the data. Anyone can verify it later, offline.

Three properties follow from this design: first, the TSA never sees the data, only a hash, so the content stays private. The token proves that the data existed at the latest at the time it states, not that it was created at that time. And the token does not depend on the client: whoever requested it cannot change the time afterwards.

Example: your backend receives a photo, computes its SHA-256, and asks a TSA to stamp that hash. Later, a third party recomputes the hash of the file it was given and checks it against the token. If one byte of the file has changed, the check fails.

The request and the token

Both messages are ASN.1 structures encoded in DER. Over HTTP, the client posts the request with the content type application/timestamp-query, and the TSA answers with application/timestamp-reply.

Request fieldWhat it carries
messageImprintThe hash algorithm and the hash of your data. The only required link to your content.
reqPolicyOptional. The TSA policy you ask the token to be issued under.
nonceOptional. A large random number, echoed in the token, that protects against replayed responses.
certReqA flag asking the TSA to include its signing certificate in the response.

The response has two parts: a status, which says whether the request was granted or rejected, and the time-stamp token. Read the status first.

The token itself is a CMS signed-data object. Its signed content is a structure called TSTInfo, which holds the facts the TSA vouches for.

TSTInfo fieldWhat it tells you
policyThe identifier of the policy the TSA applied.
messageImprintThe hash you sent, copied back. It must equal the hash of your data.
serialNumberA number unique to this token for this TSA.
genTimeThe time the TSA certifies, in UTC.
accuracyOptional. How far genTime may be from the true time.
noncePresent if you sent one. It must match yours.

Here is a generic example with the OpenSSL command line. It builds a request for a file, sends it to a TSA with curl, and prints the response. The TSA address is a placeholder: use the one your provider gives you.

# 1. Build the request: SHA-256 of the file, ask for the TSA certificate
openssl ts -query -data photo.jpg -sha256 -cert -out request.tsq

# 2. Send it to the timestamp authority (placeholder address)
curl -s -H "Content-Type: application/timestamp-query" \
  --data-binary @request.tsq \
  https://tsa.example.com/tsr -o response.tsr

# 3. Read the response: status, policy, hash, serial number, time
openssl ts -reply -in response.tsr -text

If you already hold a hash and not the file, replace the data option with the digest option and pass the hash in hexadecimal. The request is the same.

Verifying a token

A complete verification answers four questions, in this order:

  1. Does the hash in the token equal the hash of the data I hold? If not, stop: the token is about something else.
  2. Is the signature on the token valid?
  3. Does the signing certificate chain to a root I trust, and is it a certificate meant for time stamping?
  4. What time does the token state, and is that authority the one I expected?

OpenSSL does the first three in one command. You give it the data or its hash, the response, and the certificate chain of the TSA as a PEM file. Again, this is a generic example.

# Verify against the original file
openssl ts -verify -data photo.jpg -in response.tsr -CAfile tsa-chain.pem

# Or verify against a hash you already hold (hexadecimal)
openssl ts -verify -digest <sha256-hex> -in response.tsr -CAfile tsa-chain.pem

The chain file is the part people get wrong. With no trusted chain, or the wrong one, a valid token fails; with a chain you did not check, an untrusted authority passes. Get the certificates from the TSA's own publication, not from the party that sent you the token.

A verifier should also separate what is proven from what is declared. In a tryVidimus bundle, the time certified by the authority is in gen_time. The captured_at time of each file is the time observed by the service, and it is not qualified.

In test mode, the authority is simulated and the timestamp has no legal value. A correct verifier reports that state instead of calling the proof valid. Our guide on how to verify a sealed photo programmatically builds the whole check in code.

Choosing a timestamp authority

Any TSA that speaks RFC 3161 returns a token you can verify. The protocol is the same. What differs is who stands behind the clock and the key, and that decides what the token is worth to a third party.

  • Status. Do you need a qualified electronic timestamp? In the European Union, only a timestamp from a qualified trust service provider carries the presumption described in our article on the qualified timestamp under eIDAS.
  • Verifiability. Can a stranger find the provider on the European trusted lists and obtain its certificate chain without asking you?
  • Policy. Does the TSA publish the policy identifier it puts in the token, and the hash algorithms it accepts?
  • Granularity. One token per item, or one token for a batch of hashes combined in a Merkle tree? Batching means fewer requests, but each verification then needs the Merkle path in addition to the token.

Test before you commit. Request a token, then give the file, the token and the public chain to a colleague who has no access to your systems. If they cannot verify it alone, neither can the other side in a dispute.

For reference, tryVidimus requests one qualified timestamp per proof. In production it comes from Certigna, a French qualified trust service provider.

Frequently asked questions

What is an RFC 3161 timestamp?

It is a signed token issued by a Time Stamping Authority under the Time-Stamp Protocol defined in RFC 3161. The token binds the hash of some data to a time stated by the authority. Anyone who holds the data, the token and the authority's certificates can check that the data existed at the latest at that time and has not changed.

Does the timestamp authority see my file?

No. The request contains a hash of the data, with the name of the hash algorithm, and not the data. A hash such as SHA-256 cannot be reversed into the original content. The authority certifies a time for a value it cannot read, which suits private material such as photos.

How do I verify an RFC 3161 token with OpenSSL?

Use the ts command with the verify option. Pass the original file with the data option, or its hash with the digest option, then the response file and the certificate chain of the authority as a PEM file. OpenSSL checks that the hash matches, that the signature is valid and that the certificate chains to the roots you provided.

What is the difference between a timestamp response and a timestamp token?

The response is the whole message returned by the authority: a status, and the token when the request is granted. The token is the signed object inside it, a CMS signed-data structure whose content is the TSTInfo. Some systems store the full response, others only the token.

Is every RFC 3161 timestamp a qualified timestamp?

No. RFC 3161 is a technical protocol; qualified is a legal status under the eIDAS Regulation. A timestamp is qualified when it is issued by a qualified trust service provider. A token from an authority without that status verifies the same way, but it does not carry the presumption that applies to qualified timestamps in the European Union.

Should I timestamp each file or a batch of files?

It depends on what a verifier will receive. One token per item is the simplest to check: a hash, a token, a certificate chain. A batch combines many hashes in a Merkle tree and stamps the root, which means fewer requests but an extra Merkle path to keep and verify for each item. tryVidimus uses one timestamp per proof.

Try it in the sandbox

An RFC 3161 timestamp is a small, standard object: a hash, a time and a signature that anyone can check with common tools. Its worth to a third party depends on the authority behind it, which is where a qualified provider matters. You can seal test proofs and inspect their tokens for free in the sandbox, without a card.

Create an account

Official sources

Cédric Driaux · Founder of tryVidimus

Cédric Driaux is the founder of tryVidimus, published by Fyher. He has been a software developer for 23 years. He also builds ScanStay, a photo proof tool for short-term rental hosts.

Related articles