Skip to content

How to Sign a Windows Program With Code Signing

Signing a Windows program is a short, repeatable routine once the certificate is ready. This guide covers preparation, the signing command, timestamps and verification.

10 min readUpdated Nov 23, 2026By XPASS Editorial Team

How to Sign a Windows Program With Code Signing

Once you hold a code signing certificate, signing a Windows program is a short routine that you can repeat for every release. The part that surprises many first timers is not the command itself but everything around it: where the key lives, which files to sign, why a timestamp matters and how to confirm the result. This guide walks through the whole process in the order you will meet it. Platform tooling and policies change, so treat the commands below as a pattern and confirm details in the current Windows documentation and your certificate issuer's instructions.

Before you sign: what you need ready

A few things must be in place before the first signature.

  • A code signing certificate issued to your organization or to you, with the private key available on a protected device. The article about standard and EV code signing explains how the choices differ.
  • The files you plan to sign, built from a known version of your source.
  • A machine with the Windows SDK, which includes SignTool, or another signing tool that your issuer or build system supports.
  • The name of a timestamp service, supplied by your issuer or another trusted provider.
  • A short written note of who is allowed to sign and where the signing machine or token is kept.

If your certificate is on a hardware token, install the vendor's driver or client software, plug in the token and make sure Windows can see the certificate. If your issuer provides a cloud signing service instead, follow its instructions for connecting your build to the service. In both cases the private key is never copied to the build server.

Decide what to sign

Not every file in your package needs the same treatment, but a good rule is to sign everything that Windows or the user will run, load or install as yours. That usually means the installer, the main executables, any dynamic libraries you built, and any driver or script files that the platform expects to be signed. Files that come from third parties inside your package are often already signed by their authors, and you should leave their signatures in place.

Order matters when files are nested. If an installer contains executables, sign those inner files first, then build the installer around them, then sign the installer itself. If you sign the installer first and then change anything inside, the installer's signature breaks. A tidy way to remember it is to sign from the inside out.

The signing command

SignTool is the standard command line tool for Authenticode signing on Windows. A typical invocation looks like the example below. The placeholders in capital letters stand for values you supply, and the exact options for selecting a certificate depend on where the certificate lives.

signtool sign /fd SHA256 /tr YOUR_TIMESTAMP_URL /td SHA256 /a YourInstaller.exe

Here is what each part means:

Option Purpose
sign Tells SignTool to sign the file
/fd SHA256 Chooses the hash algorithm used for the file digest
/tr and your timestamp URL Requests an RFC 3161 timestamp from the named server
/td SHA256 Chooses the hash algorithm for the timestamp
/a Lets SignTool pick a suitable certificate automatically
the final argument The file to sign

When more than one certificate is installed, use the options that pick a certificate by its thumbprint or subject name rather than relying on automatic selection. Some tokens will ask for a PIN at signing time. Build pipelines that cannot answer a prompt need a signing service or a hardware module that supports unattended use, as discussed in the comparison of certificate types.

If you sign many files, you can pass several names to one command, or loop over a folder in your build script. Keep the signing step in one script that everyone uses so that options such as the hash algorithm and timestamp stay consistent between releases.

Always add a timestamp

A certificate has an expiry date. If you sign without a timestamp, Windows may treat the signature as invalid once the certificate expires. With a trusted timestamp, the signature proves it was made while the certificate was valid, and verifiers can continue to accept it afterwards. Adding a timestamp is one extra option in the command, and it protects every older release you have already shipped.

Timestamp servers are online services, so signing needs network access to them. If a timestamp server is temporarily unreachable, the signing command may fail. Build scripts should retry a few times and, if possible, fall back to a second timestamp service from your issuer's documentation. Do not skip the timestamp just to get a build through, because a missing timestamp becomes a problem months later.

Verify the result

Never assume signing worked. Verify every release before publishing.

  1. Run the verification command, for example signtool verify /pa /v YourInstaller.exe, and read the output for the certificate chain and the timestamp.
  2. Right-click the file in Windows, open Properties, choose the Digital Signatures tab and check that the signer name matches your organization and that a timestamp is listed.
  3. In PowerShell, use Get-AuthenticodeSignature on the file to see its status. A healthy result reports the status as valid.
  4. Test on a clean machine or virtual machine that does not have your development tools installed. Download the installer the way a customer would and watch the dialog that appears. The publisher name should be yours.

If the dialog still warns, that does not always mean the signature failed. Reputation systems may need time, and platform policies change. Check the signature details first. If they are valid, the warning probably relates to reputation rather than a signing mistake.

A plain example release routine

Imagine a small team shipping a desktop tool called Notes Helper. On release day the lead developer builds the executables, signs them with the hardware token connected to the signing machine, packages them into an installer, then signs the installer. The script uses the same hash algorithm and timestamp service every time. After signing, the script runs the verification command on every file and stops the release if any check fails. A teammate then downloads the published installer on a clean virtual machine and confirms the publisher name in the dialog. The whole routine takes minutes once it is scripted, and the written checklist makes it repeatable when a different person is on duty.

The team also keeps a list of past releases with the certificate name and expiry date, so that when renewal time approaches nobody is surprised. They store the token in a locked drawer when it is not in use and they record who has the PIN.

Limits and what to watch for

  • A valid signature is not a safety statement. It shows the publisher and that the file is intact, not that the code is free of bugs or harmful behaviour.
  • Warnings can persist for new publishers. Platform reputation systems may take time, and policies change, so avoid promising customers that signing removes every prompt.
  • Do not leave keys on shared machines. A private key on a general-purpose build server is a risk if anyone with access can use it to sign files.
  • Watch expiry dates. Plan renewal well in advance, because identity checks can take time.
  • Do not modify a file after signing it. Even repackaging or running a compression tool can break the signature, and the file must be signed again.
  • Use the same publisher name consistently. Administrators who approve software by publisher name may need to re-approve if the name changes.
  • Keep logs of what was signed, when and by whom. If a key is ever suspected to be compromised, the log helps you decide which releases to rebuild.
  • Respect the rules for the platform. Drivers, store submissions and some enterprise programs have extra requirements beyond a normal signature.

Troubleshooting common problems

When signing fails, the cause is usually one of a few things. If SignTool says no certificates were found, the token may not be connected, the client software may not be running or the certificate may not be visible to your user account. If the signing succeeds but verification reports a chain problem, an intermediate certificate may be missing or the machine may not trust the issuer yet. If the timestamp step fails, check network access and try another timestamp server. If an installer shows as invalid after signing, check whether another tool altered it after signing. If the dialog shows an unexpected publisher name, confirm which certificate was selected, particularly on machines with several certificates installed.

Keep notes of every failure and the fix. Over time these notes become the team's runbook and make onboarding a new developer a matter of reading a page rather than discovering each problem alone. If you are still deciding which kind of certificate suits your products, the guide on choosing code signing for app developers is a good next step, and the article on why distributed software needs a digital signature explains the reasoning that makes all this effort worthwhile.

Signing in a build pipeline

Many teams eventually move signing into an automated pipeline. The pipeline builds the files, sends only the hash or the file to a protected signing step, receives the signed result, and then runs the verification checks. The key idea is that the pipeline never holds the private key itself. Instead it calls a signing service, a hardware security module or a dedicated signing machine that only a few trusted jobs can reach. Limit which branches and which people can trigger the signing job, because anyone who can trigger it can effectively sign as your organization. Record each run so that you can answer later which commit produced which signed file.

Finally, test the pipeline the same way you test the code: run it on a throwaway build, confirm that the signature verifies, and confirm that a deliberately modified file is rejected by the verification step. A control that has never been seen to fail is hard to trust.

Telling customers what to expect

After you start signing, tell customers what to look for. On your download page, state the publisher name that should appear in the installer dialog, and explain briefly how to open the file properties and view the signature. If you publish checksums, keep them on the same page, and remind users to download only from your official site. This small effort turns your signature into something customers actively use rather than an invisible technical detail, and it gives your support team a ready answer when someone reports a suspicious copy.

Summary

Signing a Windows program is a repeatable routine: prepare the certificate and key, decide which files to sign, sign from the inside out with a modern hash and a trusted timestamp, and verify the result on a clean machine before publishing. A signature shows who published the file and that it has not changed, but it does not prove the code is safe and may not remove every warning. Protect the private key, script the process, record what you sign and watch expiry dates. When you are ready to look at certificate options, see the SSL certificates page.

Frequently asked questions

What tool signs Windows programs?

The usual command line tool is SignTool, which ships with the Windows SDK. Some build systems and signing services wrap it or provide their own tools, but the idea is the same: hash, sign, timestamp.

Why should I add a timestamp?

A timestamp from a trusted time server proves the file was signed while the certificate was valid, so the signature can keep verifying after the certificate expires.

Which files should I sign?

Sign everything that users or Windows will run or load as yours, such as the installer, main executables and libraries. Check the current platform documentation for the exact expectations.

How do I check that a signature worked?

Use SignTool verify, open the file properties and read the Digital Signatures tab, or run Get-AuthenticodeSignature in PowerShell. Test on a clean machine before you publish.

About the author

Bob Kanokphon Thongdee, founder of XPASS VPN

Bob Kanokphon Thongdee

  • Founder of XPASS VPN
  • Co-founder of eSIMonline.asia
  • More than 7 years in online marketing
  • Founder of Cojourney Visa and Cojourney Travel

Need an SSL certificate?

Pick the certificate type that fits your site and see the price before you check out.

SSL from $14.99

See SSL certificates

Keep reading

SSL Guides

Standard vs EV Code Signing: What Is the Difference?

Standard and EV code signing certificates both sign software, but they differ in vetting, key handling and how some platforms treat them. Here is how to choose.

9 min read

SSL Guides

Which Code Signing Certificate Should App Developers Choose?

Code signing proves who built your software and that it has not been altered. Here is how to choose the right certificate for your platform, team and release process.

10 min read

SSL Guides

Why Software You Distribute Should Carry a Digital Signature

A digital signature tells users who published a file and whether it changed on the way to them. Here is why that matters for any software you distribute.

9 min read