Code signing how-to

How to Sign a Windows Application (SignTool, Timestamping, SmartScreen)

Sign your .exe, .dll and .msi files with SignTool, add a timestamp so signatures outlive the certificate, and understand how SmartScreen reputation builds.

Here is how to sign a Windows application in short: connect the hardware token (or cloud signing service) that holds your code signing key, run Microsoft SignTool with a SHA-256 file digest and an RFC 3161 timestamp server, then verify the result. The whole process takes one command per file once your certificate is set up.

Signing attaches your verified publisher name to the file and proves that nobody changed it after you built it. Windows shows that name in the User Account Control prompt instead of “Unknown publisher.” If you do not have a certificate yet, compare code signing certificates first; this guide starts after delivery.

What you needWhere it comes from
Code signing certificate (OV or EV)Issued by DigiCert or Sectigo after validation
Private key on certified hardwareUSB token, your HSM or the CA’s cloud signing service
SignTool.exeIncluded in the Windows SDK
Timestamp server URLProvided by your CA, for example DigiCert’s
The files to sign.exe, .dll, .msi, .cab or script files from your build

Need a code signing certificate first?

Compare OV and EV code signing certificates from DigiCert and Sectigo.

Compare code signing certificates

How to sign a Windows application with SignTool

  1. Prepare the key

    Plug in your token and install its driver, or install your CA’s cloud signing client. Check that the certificate appears in the Windows certificate store (certmgr.msc → Personal → Certificates).

  2. Install SignTool

    Install the Windows SDK and note the path to signtool.exe, or open a Developer Command Prompt for Visual Studio.

  3. Sign with a timestamp

    Run signtool sign with /fd sha256, /tr (timestamp server) and /td sha256, plus /a, /n or /sha1 to pick the certificate. Enter the token PIN when asked.

  4. Verify

    Run signtool verify /pa /v on the signed file and check that the signature and timestamp are both reported as valid.

How do I sign an .exe with SignTool?

Run signtool sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /a "MyApp.exe". This signs the file with SHA-256, adds a timestamp from DigiCert’s server and lets SignTool pick the best matching certificate automatically.

signtool sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /a "C:\build\MyApp.exe"

If you have more than one certificate installed, select the right one explicitly. Use /n "Your Company Inc." to select by subject name, or /sha1 <thumbprint> to select by certificate thumbprint (remove the spaces from the thumbprint).

signtool sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /sha1 0123456789ABCDEF0123456789ABCDEF01234567 "C:\build\MyApp.exe"
signtool verify /pa /v "C:\build\MyApp.exe"

What each option does:

  • /fd sha256 – file digest algorithm (the hash of your file).
  • /tr URL – RFC 3161 timestamp server; use the URL your CA provides.
  • /td sha256 – digest algorithm for the timestamp request.
  • /a, /n or /sha1 – how SignTool picks the certificate.
  • verify /pa – checks the file with the default Authenticode policy.

Cloud signing services usually work through a plugin or key storage provider that SignTool calls. The command looks almost the same; follow your CA’s setup guide for the extra parameters.

Why should I timestamp my signature?

Timestamping keeps your signature valid after the certificate expires. The timestamp proves the file was signed while the certificate was still valid, so Windows keeps trusting it.Without a timestamp, every copy of your software shows an invalid signature on the day the certificate expires. As of March 1, 2026, new code signing certificates are limited to a maximum of 460 days (CA/Browser Forum ballot CSC-31), so this happens sooner than it used to.

  • Signature stays valid after the certificate expires
  • Proves when the file was signed
  • Keeps older releases trusted after a renewal
  • Costs one extra parameter: /tr with /td

Why does SmartScreen still warn after signing?

Because Microsoft Defender SmartScreen also looks at reputation, not only at the signature. A new certificate or a new file starts with little reputation, and the warning fades as clean downloads build up over time.

SmartScreen checks two signals: publisher reputation (tied to your signing certificate) and file reputation (tied to the file’s hash). Microsoft gives no exact threshold. Its documentation says reputation builds organically through download volume and can take several weeks.

As of October 2026, an EV certificate no longer skips this process. Microsoft’s documentation states that EV-signed files stopped bypassing SmartScreen in 2024 and now build reputation the same way as OV-signed files. EV still means stricter identity validation, which some enterprise buyers ask for.

Tip: Sign every release with the same certificate identity and always timestamp. Changing your publisher identity affects the publisher trust signal, so avoid switching names between releases.

Can I sign MSI and PowerShell scripts too?

Yes. SignTool signs Windows Installer (.msi) packages, .dll and .cab files with the same command as an .exe. PowerShell scripts are signed with the Set-AuthenticodeSignature cmdlet, which adds a signature block at the end of the script.

File typeToolNote
.exe, .dllSignToolSign every binary you ship, not just the installer
.msi, .cabSignToolSign the files inside before you build the package, then sign the package
.ps1 PowerShell scriptsSet-AuthenticodeSignatureUse -TimestampServer with an http:// URL and -HashAlgorithm SHA256
MSIX / APPX packagesSignToolThe package publisher must match the certificate subject
Set-AuthenticodeSignature -FilePath .\Deploy.ps1 -Certificate (Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert) -HashAlgorithm SHA256 -TimestampServer "http://timestamp.digicert.com"

Office macros, Java and other platforms use their own tools; this page sticks to Windows.

Code signing certificates for Windows software

Signing in your build pipeline

Make signing a fixed step in your release process, not a manual task at the end. That way every file you ship is signed the same way, with the same identity and a timestamp.

  1. Build your binaries in release mode.
  2. Sign every executable and library (.exe, .dll) that ends up on the user’s machine.
  3. Package the signed files into your installer (.msi or setup .exe).
  4. Sign the installer itself, with a timestamp.
  5. Verify all signed files with signtool verify /pa before you publish.

Two optional SignTool options are worth adding: /d "Product name" sets a description and /du https://your-site.example adds a URL to the signature details. Keep the token, HSM or cloud signing credentials out of your source code and give build agents only the access they need.

Common SignTool errors and fixes

ErrorLikely causeFix
No certificates were found that met all the given criteriaToken not connected, driver missing or wrong /n or /sha1 valueReconnect the token, check certmgr.msc, copy the thumbprint again
The specified timestamp server either could not be reached or returned an invalid responseFirewall, proxy or wrong URLAllow outbound HTTP to the timestamp server and retry
Verify reports an untrusted rootMissing intermediate certificate or wrong verify policyInstall the CA’s intermediate certificate and use verify /pa
PIN prompt blocks the buildToken client asks for the PIN interactivelyCheck your token client’s settings or move to cloud signing

Where and how your key is stored decides how well signing fits into automated builds. See our overview of code signing key storage requirements for tokens, HSMs and cloud signing. To understand why a website certificate cannot sign software, read code signing vs SSL.

Sign your next release with a trusted certificate

Choose an OV or EV code signing certificate with compliant key storage.

View code signing certificates

Products

Categories

  • Code Signing Certificates

    Code signing and EV code signing certificates from DigiCert, Sectigo and Comodo to sign…

    from $324.99

Related articles

Frequently asked questions

How do I sign an .exe with SignTool?

Open a command prompt with the Windows SDK installed, connect your token or cloud signing client, and run: signtool sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /a "MyApp.exe". Replace the timestamp URL with the one your CA provides and use /n or /sha1 if several certificates are installed. Then check the result with signtool verify /pa /v "MyApp.exe".

Why should I timestamp my signature?

A timestamp proves that you signed the file while your certificate was valid, so the signature stays valid after the certificate expires. Without one, every copy of your software shows an invalid signature on the expiry date. As of March 1, 2026, new code signing certificates last at most 460 days, so timestamping every release with /tr and /td is essential.

Why does SmartScreen still warn after signing?

Microsoft Defender SmartScreen also checks reputation. A new certificate or new file starts with little reputation, and warnings fade as clean downloads build up, which can take weeks. As of October 2026, Microsoft states that EV certificates stopped bypassing SmartScreen in 2024, so EV and OV signed files build reputation the same way. Sign consistently with the same identity.

Can I sign MSI and PowerShell scripts too?

Yes. SignTool signs .msi installer packages, .dll and .cab files with the same command you use for an .exe, including the timestamp options. PowerShell scripts are signed with the Set-AuthenticodeSignature cmdlet, using -HashAlgorithm SHA256 and -TimestampServer with an http:// URL. Sign the files inside an installer first, then sign the installer package itself.