Since code-signing keys moved onto USB tokens and HSMs, signtool fails in new and confusing ways. The three errors people search for most are "No certificates were found that met all the given criteria", "SignerSign() failed" with a hex code, and timestamp server errors. Each has a small number of real causes. This guide lists them with the commands to diagnose and fix each one.
Before you start: three quick checks
:: Which signtool are you running? Use a current Windows SDK build.
where signtool
:: Can Windows see the token and its key?
certutil -scinfo
:: Which code-signing certificates does your user have, and do they have a private key?
powershell -c "Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert | Format-List Subject, Thumbprint, NotAfter, HasPrivateKey"
If the last command shows nothing, signtool will not find anything either. If it shows your certificate with HasPrivateKey : False, Windows has the certificate but cannot link it to the key on the token.
Error 1: "No certificates were found that met all the given criteria"
signtool searched the certificate store with your filters and found no certificate that matches and has a usable private key and is valid for code signing. Causes, most common first:
The token middleware or minidriver is missing
Plugging in a token is not enough. Windows needs the vendor's driver to expose the certificate and key: SafeNet Authentication Client for Thales/SafeNet eTokens, the YubiKey Smart Card Minidriver for YubiKeys (it adds ECC key support and PIN management on top of the built-in Windows PIV driver), the Feitian middleware for ePass tokens, and so on. Install it, re-plug the token, and rerun certutil -scinfo. An error such as NTE_BAD_KEYSET there points to the same problem.
The certificate is in the store but not linked to the key
Happens after importing the .cer file by hand, or after a driver change. Re-link it by serial number:
certutil -user -repairstore my "<certificate serial number>"
Afterwards HasPrivateKey should be True.
Wrong store or wrong filter
/n "Name"must match the subject CN exactly; a trailing "Ltd." or a different capitalisation of the company name is enough to miss. Prefer/sha1 <thumbprint>, which is unambiguous.- signtool searches the current user's
Mystore by default. If the certificate is in the machine store, add/sm. /apicks automatically, but only among certificates it considers valid for code signing.
The certificate is not a code-signing certificate, or has expired
A document-signing or TLS certificate on the same token will not match: signtool requires the Code Signing extended key usage. Check NotAfter too.
You are not in the session where the token is visible
A USB token is only reachable from an interactive desktop session. signtool run from a Windows service, a scheduled task without "Run only when user is logged on", a CI agent installed as a service, or over SSH/WinRM runs in a different session (often Session 0) and sees an empty store. Run the agent as a process in a logged-in user session, or move signing to a component designed to bridge that gap.
Remote Desktop or a virtual machine
Over RDP, the token is only visible if smart card redirection is enabled. On a VM, the USB device must be passed through to the guest.
Error 2: "SignerSign() failed" with a code
The hex code in brackets is a standard Windows error. The ones seen most with tokens:
| Code | Meaning | Typical fix |
|---|---|---|
0x80090016 (-2146893802) | NTE_BAD_KEYSET: keyset does not exist | Token unplugged, wrong session, or certificate not linked to the key. See the checks above, run certutil -repairstore. |
0x80090022 (-2146893790) | NTE_SILENT_CONTEXT: the provider needed to show UI (a PIN prompt) but was not allowed | Signing ran in a non-interactive context. Run in a user session, or supply the PIN through a method that does not need a dialog (see our post on PIN prompts in automation). |
0x8010006E (-2146434962) | SCARD_W_CANCELLED_BY_USER | The PIN dialog was cancelled or timed out, often because nobody was at the screen. |
0x8007000B (-2147024885) | ERROR_BAD_FORMAT | For MSIX/APPX: publisher in the manifest does not exactly match the certificate subject (event 150), or /fd does not match the package's hash algorithm (event 151). Details appear in Event Viewer under Applications and Services Logs > Microsoft > Windows > AppxPackagingOM. |
0x800700C1 (-2147024703) | ERROR_BAD_EXE_FORMAT | The file is not a signable PE file, is corrupt, or is a type signtool cannot sign directly. |
A wrong PIN typically shows up as a PIN-related smart card error rather than SignerSign. Stop after one failure: most tokens lock after a small number of wrong attempts (some after three), and an EV token locked hard may need the CA to reissue it.
Error 3: timestamp failures
Typical messages: "The specified timestamp server either could not be reached or returned an invalid response", or "SignerTimeStamp() failed" / "SignerTimeStampEx2() failed" with a code.
Wrong switch for the URL
Use /tr (RFC 3161) plus /td sha256 for modern timestamp URLs. /t is the legacy Authenticode protocol and uses SHA-1. Using an RFC 3161 URL with /t, or forgetting /td, is the most common mistake:
signtool sign /sha1 <THUMBPRINT> /fd sha256 /tr http://timestamp.digicert.com /td sha256 /v MyApp.exe
Network codes
0x80072EE2(ERROR_INTERNET_TIMEOUT): timeout.0x80072EFD(ERROR_INTERNET_CANNOT_CONNECT): cannot connect.0x80072EFF(ERROR_INTERNET_CONNECTION_RESET): connection reset. Check proxy and firewall: the signing API may not use the same proxy settings as your browser. Allow outbound HTTP to the TSA.0x80190194(HTTP_E_STATUS_NOT_FOUND): HTTP 404. The URL is wrong or retired. Confirm the current URL on your CA's site.
Throttling and outages
Public TSAs rate-limit heavy use. When a build signs hundreds of files in a burst, some requests fail. Add a retry with a short delay, sign files in batches (signtool accepts several files per call), or use an alternative TSA. Do not respond to timestamp errors by removing the timestamp: an untimestamped signature becomes invalid when the certificate expires.
Common RFC 3161 TSAs: DigiCert http://timestamp.digicert.com, Sectigo http://timestamp.sectigo.com, SSL.com http://ts.ssl.com, GlobalSign http://timestamp.globalsign.com/tsa/r6advanced1.
ECC certificates
Many new code-signing certificates use ECDSA keys. Match the digest to the curve: SHA-256 for P-256 and SHA-384 for P-384 (/fd sha384 /td sha384). Very old signtool versions also have trouble with ECC, so update the Windows SDK if signing works on one machine and not another.
Verify what you produced
signtool verify /pa /v MyApp.exe
Look for the signing certificate chain, "The signature is timestamped", and "Successfully verified". Run it on the final artifact after every packaging step, not on an intermediate build output.
How OneSigner handles it
Most of these failures come from where signtool runs: the wrong session, a PIN dialog nobody answers, a token on someone's desk. With OneSigner, the token stays on one Windows machine that runs the token operation inside a logged-in user session, the PIN is kept in the service configuration file (restrict it to SYSTEM and administrators) and supplied automatically (through the vendor's PKCS#11 module where available, so no vendor PIN window appears), and build machines sign remotely with OneSignTool or AzureSignTool. The certificate is selected by thumbprint in a profile. See certificate not found and signing fails in Session 0.



