What happens to signed code when the code signing certificate expires? In many cases, an expired certificate means that the signature validation will fail and a trust warning will appear in the browser.punch clock

Time-stamping was designed to alleviate this problem. The idea is that at the time, at which the code is signed, the certificate was confirmed to be valid and, therefore, the signature is valid. This is much the same as a handwritten signature.

The main benefit is that it extends code trust beyond the validity period of the certificate. The code stays good as long as you can run it. Also, down the road the certificate may be revoked and the code will still be trusted.

Time-stamping the signature is implemented as follows:

  • The signature is sent to the time-stamping authority (TSA).
  • The TSA adds a time-stamp to the bundled information and computes a new hash.
  • The TSA signs the new hash with its private key creating a new bundle of information.
  • The time-stamped bundle, original bundle that was sent to the TSA and the time-stamp are re-bundled with the original code.

Upon receipt of a time-stamped signature, the following is done for verification:

  • The time-stamp is added to the bundled signature information and the combined signature and time-stamp are hashed.
  • The time-stamping authority’s public key is applied to the time-stamped signature block, revealing the hash calculated by the TSA.
  • The validity of the TSA’s public key is verified by checking its expiry date and consulting the revocation lists to be sure that it has not been revoked.
  • The two hashes are compared. If the hashes are equal, the time-stamp is considered to be valid.

In the event that the code-signing certificate must be revoked due to a compromise, the revocation will be made depended on a specific date. The idea is to choose a date that was before the compromise took place. This means that signatures with time-stamps before the revocation date will remain to be valid.

Entrust operates the following time-stamp authorities:

  • Authenticode – https://timestamp.entrust.net/TSS/AuthenticodeTS
  • RFC 3161 (SHA-1) – https://timestamp.entrust.net/TSS/RFC3161sha1TS
  • RFC 3161 (SHA-2) – https://timestamp.entrust.net/TSS/RFC3161sha2TS

Code-Signing Series

This is the sixth post in our code-signing. Check out the full list to read past entries and see what’s upcoming.