What is Timestamping

Identifying date/time for events as they happen is critical. Failing to identify the correct date and time makes the information irrelevant as it reduces its relevance. As an example what if the deed of a car sale doesn’t mention what date it was signed or the birth certificate doesn’t mention what date/time someone was born etc. In simple words putting correct date & time on electronic records / documents is critical for us and this process is called timestamping. During Timestamping the following aspects are key:

  1. Where is the time taken from and is it trustworthy?
  2. Can the mentioned time be forged in future?

Where is the time taken from?

Getting time from your watch or mobile can be wrong due to mechanical or technical flaws. A slack of one or two minutes might be OK to mention when submitting your university assignment but critical electronic business transactions will not tolerate this. In the electronic world, time is normally taken from local computer sync with the internet clock. For critical application time is taken from the atomic clock. The Network Time Protocol (NTP) is normally used to synchronize time between two systems.

Protecting Timestamp forgery

In the digital era, placing time on paper is now replaced with adding time on your electronic document e.g. email, word or pdf document. Note that in electronic documents changing content is much easier and less detectable than in the paper based world. One of the most critical parts in timestamping is to ensure any timestamp created can’t be forged in future. Hence digital signatures come to the rescue. The time hence taken and placed on a digital document is also digitally signed. This ensures any change in either the timestamped content or the time can be easily detected. Digital Signature also identifies who created the time hence can be questioned in future about its authority.

Time Source

Where is the time taken from and is it trustworthy?

Time Forgery

Can the mentioned time be forged in future?

time is ticking

Timestamping Format

IETF defined RFC 3161 (with few updates in RFC 5816) standard which guides on how to record timestamp inside any electronic content be it XML, Word documents or PDF. Another somewhat similar standard used specifically by Microsoft is called Authenticode. The RFC 3161 timestamp request and response can be summarized as:

RFC 3161 Request

  • Hash of the content to be timestamped
  • Timestamp Policy

RFC 3161 Response

  • Status; Success, Failure etc.
  • Hash of the original content
  • Timestamp signer name
  • Timestamp time
  • Extensions
  • Digital Signature on timestamp response

RFC 3161 Timestamp Request Detailed

Timestamp request and responses are defined in ASN.1 formats.

TimeStampReq ::= SEQUENCE  {

   version               INTEGER  { v1(1) },
   messageImprint        MessageImprint,
   reqPolicy             TSAPolicyId              OPTIONAL,
   nonce                 INTEGER                  OPTIONAL,
   certReq               BOOLEAN                  DEFAULT FALSE,
   extensions            [0] IMPLICIT Extensions  OPTIONAL  }

      MessageImprint ::= SEQUENCE  {

        hashAlgorithm                AlgorithmIdentifier,
        hashedMessage                OCTET STRING  }


RFC 3161 Timestamp Response Detailed

TimeStampResp ::= SEQUENCE  {
      status                  PKIStatusInfo,
      timeStampToken          TimeStampToken     OPTIONAL  }

  PKIStatusInfo ::= SEQUENCE {
      status        PKIStatus,
      statusString  PKIFreeText     OPTIONAL,
      failInfo      PKIFailureInfo  OPTIONAL  }
 PKIStatus ::= INTEGER {
      granted                (0),  
      grantedWithMods        (1),
      rejection              (2),
      waiting                (3),
      revocationWarning      (4),  
      revocationNotification (5)  }
PKIFailureInfo ::= BIT STRING {
   badAlg               (0),
   badRequest           (2),
   badDataFormat        (5),
   timeNotAvailable    (14),
   unacceptedPolicy    (15),
   unacceptedExtension (16),
   addInfoNotAvailable (17),
   systemFailure       (25)  }
 TimeStampToken ::= ContentInfo
     -- contentType is id-signedData ([CMS])
     -- content is SignedData ([CMS])
   version                      INTEGER  { v1(1) },
   policy                       TSAPolicyId,
   messageImprint               MessageImprint,
   serialNumber                 INTEGER,
   genTime                      GeneralizedTime,
   accuracy                     Accuracy                 OPTIONAL,
   ordering                     BOOLEAN             DEFAULT FALSE,
   nonce                        INTEGER                  OPTIONAL,
   tsa                          [0] GeneralName          OPTIONAL,
   extensions                   [1] IMPLICIT Extensions   OPTIONAL  }

Authenticode Request

Microsoft code signing tools utilize the Authenticode standard for timestamping.

TimeStampRequest ::= SEQUENCE {
   countersignatureType OBJECT IDENTIFIER,
   attributes Attributes OPTIONAL, 
   content  ContentInfo

Authenticode Response

The time stamp response is a PKCS #7 signed message signed by the time stamp server. 


How Timestamp server produces timestamps

Timestamp servers are normally built as software programs but can also be deployed as a hardware boxes. Timestamp servers take in timestamp requests and generate the timestamp response. The process can be defined as:

  1. Clients of Timestamp servers are business applications who are signing documents or transactions (xml or json). They process the input document which needs to be time stamped and identifies its hash e.g. SHA-256, form the time stamp request as per RFC 3161 and send it to the Timestamp Server
  2. The Timestamp server verifies the incoming request as per RFC 3161 standard and create a digitally signed timestamp response which contains: 
    1. The input document hash
    2. The time at which the response is being created
    3. Other data like nonce, extensions
  3. The time source from where Timestamp server gets the time can be:
    1. Current machine time
    2. Time from HSM
    3. Time from external time source over NTP

Applications creating timestamp

Timestamps are now common in many document processing applications when they are digitally signing documents. Some of these are:

  • Adobe Acrobat
  • Microsoft Word

Creating Digital Signatures with embedded Timestamp in Adobe Acrobat Reader

The free Adobe Acrobat Reader DC allows you to digitally sign PDF documents with timestamps. Here are the steps to create one:

  • Ensure you configure Adobe Acrobat Reader to use a timestamp server

  • Once done, create a signature field and choose the signing certificate

Adobe Acrobat Timestamping - selecting signer cert


Adobe Acrobat Timestamping - choosing appearance

  • At signing time, Adobe Acrobat will communicate with the timestamp server to create an RFC 3161 complaint timestamp and embed it inside the PDF

trusting timestamp

  • You can also validate the signature and see the embedded timestamp

Adobe Acrobat Timestamping - signature verified

  • Clicking on Advanced button shows the timestamp information

Adobe Acrobat Timestamping info

Creating Digital Signatures with embedded Timestamp using Microsoft Word

To get step by step actions on creating digital signatures in Microsoft Word click here. By default, creating timestamps during signing is disabled. To enable timestamps in Office 2010 onwards, configure two entries in registries via regedit.

  • Change XAdESLevel set to 2
  • Set TSALocation set to your timestamp server

Microsoft Office - timestamping - registry settings

Once done, restart Microsoft Word, create a signature line and sign the document. Note that Microsoft Word 2010 onwards creates XML based digital signatures. On verifying the signature you will see the XAdES-T format which denotes that the digital signature also has an embedded timestamp information.

Microsoft Office Timestamped Signature


Creatine Timestamp Request using OpenSSL

OpenSSL is open source crypto tool to create RFC 3161 based timestamps. Unfortunately you can’t send these via OpenSSL hence you have to rely on Curl. The following command will create timestamp and saves it on hard disk. Windows release for OpenSSL can be found here.

openssl ts -query -sha256 -cert -data C:\\test\\openssl\\timestamp\\hello-world.txt -out C:\\test\\openssl\\timestamp\\tsa_request.ts

Viewing Timestamp Request Contents

openssl ts -query -in C:\\test\\openssl\\timestamp\\tsa_request.ts -text

Using configuration from C:\Program Files\OpenSSL-Win64-111g\bin\cnf\openssl.cnf
Version: 1
Hash Algorithm: sha256
Message data:
    0000 - b9 4d 27 b9 93 4d 3e 08-a5 2e 52 d7 da 7d ab fa   .M'..M>...R..}..
    0010 - c4 84 ef e3 7a 53 80 ee-90 88 f7 ac e2 ef cd e9   ....zS..........
Policy OID: unspecified
Nonce: 0x96952486F1BFE380
Certificate required: yes

Sending Timestamp Request using CURL

curl -H "Content-Type:application/timestamp-query"  --data-binary "@C:\\test\\openssl\\timestamp\\tsa_request.ts"  http://timestamp.sectigo.com -o "C:\\test\\openssl\\timestamp\\tsa_response.tsr"

Viewing Timestamp Response

openssl ts -reply -in C:\\test\\openssl\\timestamp\\tsa_response.tsr -text

D:\Data\codegic\Software\curl\curl-7.70.0-win64-mingw\curl-7.70.0-win64-mingw\bin>openssl ts -reply -in C:\\test\\openssl\\timestamp\\tsa_response.tsr -text
Using configuration from C:\Program Files\OpenSSL-Win64-111g\bin\cnf\openssl.cnf
Status info:
Status: Granted.
Status description: unspecified
Failure info: unspecified

TST info:
Version: 1
Policy OID:
Hash Algorithm: sha256
Message data:
    0000 - b9 4d 27 b9 93 4d 3e 08-a5 2e 52 d7 da 7d ab fa   .M'..M>...R..}..
    0010 - c4 84 ef e3 7a 53 80 ee-90 88 f7 ac e2 ef cd e9   ....zS..........
Serial number: 0x4F5C6033A07903AA689A0B814FB239F49A8C50F8
Time stamp: Jan  8 17:14:46 2021 GMT
Accuracy: unspecified
Ordering: no
Nonce: 0x96952486F1BFE380
TSA: DirName:/C=GB/ST=Greater Manchester/L=Salford/O=Sectigo Limited/CN=Sectigo RSA Time Stamping Signer #2