22

If I set a timestamp with signing, what happens?
What if I don't set?

Is it essential? Why is it recommended?

Mathias Brossard
  • 3,668
  • 2
  • 26
  • 30
Benjamin
  • 10,085
  • 19
  • 80
  • 130

2 Answers2

40

Timestamping is used to specify time when the digital signature is made. This is needed to properly validate the signature.

If signature timestamp is present, the application which validates (verifies) the signature, will check whether the certificates involved into signature validation were valid at the moment of signing. If there's no timestamp for the signature, certificate validity is checked for the moment of signature validation, which is not always acceptable.

Example:
Certificate is valid from: 1st of January, 2008
Certificate is valid to: 31st of December, 2010
Signature is made on: 4th of July, 2009
Signature is verified on: 30th of April, 2012

With timestamp: signature is ok (signature was made during certificate validity period) Without timestamp: signature is not valid (certificate has expired by the moment of signature verification).

Timestamping should be used if the signature is supposed to be used (to proof authenticity of the document author or data originator) in long term, i.e. longer than one or several days.

Timestamping is not necessary when you, for example, send a short signed note to the colleague and this note is expected to be read and disposed of the same day as it has been written. Of course, timestamping can not be used when it's not supported by the signing technologies or when timestamping authority is not available.

On the other hand, timestamping is a must when you create signed documents for wide distribution or for long-term storage and archiving purposes. Timestamping is also used when signing the executable modules of software applications.

Update: the timestamp is also signed with a certificate. This signature is also validate using regular rules, which means that the certificate used to sign the timestamp must be valid at the moment of signature validation. In the above example if the timestamping certificate expired on the 1st of April, 2012, then the timestamp will be reported as not valid and won't be counted during validation of the signature.

Eugene Mayevski 'Callback
  • 45,135
  • 8
  • 71
  • 121
  • 1
    This statement "certificate used to sign the timestamp must be valid at the moment of signature validation" and the example given in the last update at the end is wrong according to me.It defeats the whole idea of signing the timestamp. The timestamp certificate need to be valid only during the signing of timestamp not while validating. – Byju Veedu Nov 20 '14 at 06:11
  • 5
    @ByjuVeedu Sorry, but your accordance is incorrect. Any certificate (not signature) being validated must be valid at the moment of validation. This applies to certificates used in timestamping as well. – Eugene Mayevski 'Callback Nov 20 '14 at 07:02
  • @Eugene Mayevski 'Allied Bits, I just tried to move my system clocks to the future. And the signature was valid despite of the timestamp certificate validity. Signature without certificate was failed. – Denis Jul 31 '17 at 07:56
  • @denis what software did you use to check the validity? – Eugene Mayevski 'Callback Jul 31 '17 at 08:21
  • @Eugene Mayevski 'Allied Bits, I used double click on the file and check. I also tried signtool.exe. Please see https://stackoverflow.com/questions/329396/what-happens-when-a-code-signing-certificate-expires and https://search.thawte.com/support/ssl-digital-certificates/index?page=content&id=AR1119 "Is timestamped code valid after a Code Signing Certificate expires?" – Denis Jul 31 '17 at 08:27
  • 3
    @denis RFC 3161, paragraph 4.3 explicitly mentions that the timestamping certificate will expire and the time stamp will become invalid. If you have a normative reference to the opposite, I will be happy to read it and update the answer. So far, I saw no requirement to trust expired certificates. – Eugene Mayevski 'Callback Jul 31 '17 at 09:01
  • 1
    @EugeneMayevski'AlliedBits , you mentioned after the timestamping certificate expires, the timestamp will become invalid. As I checked, taking Windows 2000 SP4 installer (W2KSP4_EN.EXE) as an example, its signing certificate expires on 2003-12-19, while its timestamp signing certificate expires on 2004-01-07. However, as I view it from today, Windows 10 still reports that the digital signature is valid. How does it work? Is it because the timestamping certificate is not revoked, so it's valid? – robbie fan Jan 03 '19 at 03:16
  • 3
    @robbiefan this behavior contradicts to the general rules of how certificate validation works. After 2004-01-07, the signature is not valid. If Windows 10 accepts it, such behavior violates the validation rules and guidelines. Why they are doing this, is the question for Microsoft to answer. – Eugene Mayevski 'Callback Jan 03 '19 at 14:10
  • Hi. I tried to follow up on the discussion wrt. the expiry of TS cert: https://stackoverflow.com/questions/73908536/does-an-expired-timestamping-certificate-invalide-the-code-signing?noredirect=1#comment130547174_73908536 Maybe you wish to share an answer there. Cheers. – Martin Ba Oct 03 '22 at 14:33
9

If the signing certificate expires and there's no timestamp, there's no way to verify that the signature was made at a time when the certificate was valid, so previously signed code may just "stop working".

Timestamping involves a third party (usually your CA) attesting that you made the signature at a particular time. Regardless of when your certificate expires, somebody receiving the signed code can then verify that your certificate was valid at the time you signed it.

SimonJ
  • 21,076
  • 1
  • 35
  • 50