Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Can I Prevent Needing to Re-sign My Code Every 1 or 2 Years?

I was reading What happens when a code signing certificate expires - Stack Overflow and wondering about a more solid answer. The answer provided was more about setting up your own CA. Even with your own CA you will still need to deal with expiring code certificates.

If you signed the code without using a time stamping service, after the certificate expires your code will no longer be trusted, and depending on security settings it may not be allowed to run. You will need to re-sign all of your code with a new certificate, or with a renewed certificate, every 1 or 2 years.

Trusted (digital) timestamping allows the digital signature to be valid even after the certificate itself has expired. You would need to re-sign code with the new certificate only if you have made changes.

Does this all sound correct? If so, I need recommendations on what timestamping service to use, preferably from someone who has actually used one. I'd also like to know if there are any in-house solutions, similar to being your own CA.

Right now this applies to PowerShell scripts, but I will eventually have the same issue with other code.

Update: Sample of how to sign a PS script with a timestamp (you can make a script for this):

Set-AuthenticodeSignature -filepath "D:\Projects\A Sample\MyFile.ps1" 
  -cert gci cert:\CurrentUser\My -codesigning 
  | where -Filter {$_.FriendlyName -eq "Thawte Code Signing"}
  -IncludeChain All 
  -TimeStampServer "http://timestamp.verisign.com/scripts/timstamp.dll"

Then, to see the Signer Certificate and TimeStamper Certificate, you can do this:

Get-AuthenticodeSignature MyFile.ps1 | fl *

It gives you the Subject (CN, OU, etc.), Issuer, Before/After Dates, and Thumbprints for both your cert and the timestamper's cert. You also get a message indicating the status of the signature.

like image 735
Bratch Avatar asked May 26 '09 21:05

Bratch


People also ask

How long is a Code Signing certificate valid?

Code Signing certificates are valid for 1 to 3 years depending on which life cycle you choose when you purchase the certificate. See: pricing information. You should also timestamp your signed code to avoid your code expiring when your certificate expires.

What happens when my Code Signing certificate expires?

Q: What happens if the Code Signing certificate expires? A: Code Signing certificates are issued for a period of one to three years. The expiration of a Code Signing certificate means that you cannot create new signatures. All past signatures will work for a given timestamp.

How does Code Signing work?

Code signing is a process by which the software developer signs the applications and executables before releasing them. It is done by placing a digital signature onto the executable, program, software update or file. The certificate ensures that the software has not been tempered and the user can safely download it.


1 Answers

You're better off selecting one of the trusted certificate providers (Verisign, Thawte, Comodo, etc.). This allows you to sign your software without the user explicitly trusting your private root CA. We've used both Verisign and Thawte, Comodo even GoDaddy with timestamping without any issues with the software becoming invalid even years after the certificate expires.

like image 194
Paul Alexander Avatar answered Oct 19 '22 14:10

Paul Alexander