Explanation of Digital Code Signatures in Microsoft WindowsPermanent link for this heading

Last update: 20 April 2023 (gs)

What is the purpose of digital code signatures?Permanent link for this heading

A digital code signature, or code signature for short, validates that a program file has been published by a specific developer and has not been changed since then by providing the following information:

  • A hash of the program files content, signed with the developers Code Signing Certificate.
  • A Code Signing Certificate for the developer or publisher of an application, issued and signed by a Certificate Authority (CA), that is trusted by the operating system.
  • A countersignature proving that the signing of the file occurred at a specific time and date, also issued and signed by a trusted Certificate Authority (CA).

What is the purpose of the countersignature?Permanent link for this heading

The attached countersignature verifies that the signing of the program file occurred at a specific time and date with a specific code signing certificate, that way it is possible to verify that a code signature was created with a valid code signing certificate.
This is achived by signing the following information with a time stamping certificate from a trusted Certificate Authority (CA):

  • The timestamp of the creation of the countersignature from the CA server that is issuing this signature, to prove that the CA received the counter signing request at a specific point in time.
  • The actual signature value, so the hash signed by the code signing certificate, of the program file in question, which links the countersignature to a specific program file and code signing certificate.

Why do existing code signatures not expire when the code signing certificate does?Permanent link for this heading

Because of the countersignature by a trusted Certificate Authority (CA), the operating system is able to validate that the code signing certificate used to sign the program file was valid at the time of the creation of the signature.
Furthermore the intended purpose of the expiration of the code signing certificate, is still observed, since it still enforces a relatively small period of validity for any given signature key, as a precaution in case of theft of that key.

Why is it not necessary to re-issue a code signature after the code signing certificate expires?Permanent link for this heading

The purpose of expiration dates on certificates is to reduce the usefulness of any potentially stolen signing key, by forcing the thief to show their hand early, before the stolen key becomes useless.

This rotation of keys is very important for things like webservices because they continually issue new signatures potentially every few microseconds, without any way to verify if the signing key is still only in the possession of the service provider at that time.

But the countersignature on a code signature proves exactly that point, even if a thief gains access to a code signing certificate after it has expired, they can’t forge or modify an existing code signature because of the following properties:

  • Trying to change the file itself would invalidate the existing signature, so the thief would have to create a new one with the stolen certificate.
  • Modifying the existing signature or using a different certificate, invalidates the countersignature since the signature value is no longer the same as the one that was signed, so the thief would have to get a new countersignature.
  • But since the new countersignature contains a timestamp, that is beyond the control of the thief, from a time after the certificate expires, the newly created signature with a valid countersignature is useless, since the certificate was already expired when it was created.

ReferencesPermanent link for this heading

Download PDF

Download PDF