Digital Certificate Tester User Manual

Find out, in a minute, whether a digital certificate can really be used to sign from a given Windows account: a key in the Windows certificate store (a CSP or a KSP), in a PFX file, or in an HSM, a smart card or a USB token (PKCS#11). When it cannot, the program tells you why and what to do.

Download

Digital Certificate Tester can be downloaded from https://tsaserver.com/CertificateTester.zip. The archive contains the single file Digital Certificate Tester.exe. This manual is also available online at https://tsaserver.com/manual/digital-certificate-tester/.

1. What is Digital Certificate Tester?

Installing a certificate is easy. Knowing that it will sign when an application needs it is not. The certificate can be listed in the Windows store while the HSM that holds its key is unreachable, the DLL of the provider of the key is missing (Provider DLL failed to initialize correctly, error 0x8009001D), the account of a service is not allowed to read the key, the PIN is wrong, or the library of the device has the wrong bitness. The application that needs the certificate usually reports one short, obscure message.

Digital Certificate Tester removes the guessing. It uses the key of the certificate exactly as an application does, signs random data with every hash algorithm and every method that applications use, verifies every signature with the public key of the certificate, and reports the result with all the details of the key: where it is stored, which provider holds it, what the provider needs, and how fast it signs.

Only the use of the key is tested

The program tests the cryptographic operation of signing and nothing else. It does not check whether the certificate is revoked, qualified, expired, trusted, or whether its key usage allows a given purpose. A certificate that is expired still shows whether its key works.

What you can do with it

2. Requirements

Test as the right account

A certificate that works for you may not work for the service that uses it, because a service runs under another account (an IIS application pool, NETWORK SERVICE, a service account) with other rights and another set of keys. Run the program on the same computer and, when possible, as that account (section 13). A result obtained on your own PC says little about a server.

3. Start the program

Double-click Digital Certificate Tester.exe. It opens the main window. The same file is also a command-line tool: when you start it with arguments it runs without a window and writes the report to the console (section 14).

The parameter /gui opens the window with the fields already filled in, which is useful for a shortcut:

Shell
"Digital Certificate Tester.exe" /gui /pkcs11 "C:\Windows\System32\eTPKCS11.dll" /slot 0 /pin 1234 /thumbprint 1DDF4A677FEAA2057BCEC975778AD5EAED70E52A
"Digital Certificate Tester.exe" /gui /pfx "C:\keys\signing.pfx" /password MyPassword
"Digital Certificate Tester.exe" /gui /store LocalMachine\My /thumbprint 900FB3CD611104916164242C16DAD369189D2023

The PIN and the passwords are only typed into the fields. They are never saved (section 18).

4. The main window

The main window: certificate selection on the left, the report on the right
The main window after a test. On the left you select the certificate and set the test; on the right the report appears, coloured by result.
AreaWhat it is for
Windows Certificate Store, PFX digital certificate file, PKCS#11 interfaceThe three places where the certificate and its key can be. Select one; only its group is active.
Certificate InformationA short description of the selected certificate and of the provider of its key. Nothing is opened to show it.
Signing testThe hash algorithms, the size of the data and the optional methods (section 7).
Speed and continuous testThe settings of the speed test and of the continuous test (sections 11 and 12).
Run the test asThe account under which the test runs, and the analysis of the permissions of the key file (section 13).
The report (right)Green lines are OK, orange lines are warnings, red lines are failures. The long tests write their lines while they run.
Inspect keyDescribes the certificate and its key (or scans the PKCS#11 device). Nothing is signed.
Run testsThe signing test: every hash, every method, every signature verified.
Speed testSignatures per second and per minute, with latencies.
Continuous / StopSigns every few seconds until you stop it, and logs every change of state.
Provider healthLoads every cryptographic provider of the computer and reports the broken ones.
Copy report, Save reportCopy the text of the report to the clipboard, or save it as a text file for the support.

5. Quick start

  1. Select the certificate. For a certificate that is installed on the computer, keep Windows Certificate Store, select Current User or Local Machine (the one that the application uses) and pick the certificate in the list.
  2. Press Run tests. The report shows the key, then every signature with its result.
  3. Read the last two lines. Signatures: N verified, 0 failed and the Verdict: The certificate CAN be used to sign from this process, or CANNOT with the red lines above it that give the cause and what to do.
  4. Repeat as the account of the application (section 13) if the result for your own account is good but the application still fails.

6. Select the certificate

The selection has three groups, one for each place where a certificate can be. Only the group of the selected source is active.

6.1 The Windows certificate store

The Windows Certificate Store group
The certificates of the Current User store, with the provider of the selected key shown below.
Current User or Local Machine?

A certificate in the Current User store, and its key, belong to one account. A service that runs under another account does not see them at all. A service uses the Local Machine store, with a key whose permissions allow the account of the service (section 13.3).

6.2 A PFX or P12 file

The PFX group with a file and a password
A PFX file and its password.

Select the file (...) and type its password. Show opens the standard window of the certificate. The file is loaded when the test runs. The program tries the key storage flags in a fixed order: first ephemeral (the key lives only in memory and no key file is written on the disk), then machine key set, user key set and the default one. The line Key provider of the report tells which way worked. A wrong password is reported as such (section 15).

The beginning of the report of a PFX test
The report of a PFX file: the line Key provider: none says that the key is loaded in memory only, with no key file on the disk.

6.3 A PKCS#11 device

The PKCS#11 group: library, slot, PIN, certificate list
The library of the device, the slot, the PIN and the certificates found on the token.
  1. The library. PKCS#11 driver path lists the libraries of the known manufacturers that are installed on the computer (eTPKCS11.dll, IDPrimePKCS11.dll, opensc-pkcs11.dll, cryptoki.dll, softhsm2-x64.dll and others). Select one, or type or browse (...) to the library of your device. It must have the same bitness as the program.
  2. The certificates are found by themselves. As soon as the library is selected, the program reads the certificates that are installed on the token and puts them in the Certificate list. You do not have to select a file. No PIN is sent for this: only the objects that the token shows without a login are read.
  3. The slot and the PIN. Slot number is the position of the token in the list of tokens (the first is 0). The program looks for the selected certificate on all the tokens and uses the one that holds it, so a wrong slot number is corrected (the report says so with the line Slot used). Type the PIN of the normal user of the token.
  4. Scan. Shows the complete report of the library: tokens, details, mechanisms and objects (section 8). When you typed the PIN, the scan also logs in, to find the certificates and the keys that the token shows only after the login. Some tokens hide their certificates until then.
  5. When no certificate is found. If the token shows no certificate, select the public certificate of the key as a file with Select .CER file... (DER or Base64). The two ways exist side by side: use the list of the token, or the file. Show opens the selected certificate.
The PIN is never sent twice when it is wrong

Every wrong PIN decrements the retry counter of the token, which locks after a few attempts. When a device rejects a PIN, the program does not send it again (in the scan, in a test, in the continuous test) until you change the PIN or restart the program. The scan also shows the state of the counter before you test: retry counter is full, low, FINAL TRY or LOCKED.

7. The signing test

Press Run tests. The program opens the key of the certificate, signs random data with every method and every hash that you selected, and verifies each signature.

7.1 The options

The signing test and speed test options
The options of the signing test, of the speed test and of the continuous test.
OptionMeaning
Hash algorithmsSHA-256, SHA-384 and SHA-512 are selected by default. SHA-1 (legacy) is for old systems only. Every selected hash is tested with every method.
Data to sign (random)The size, in bytes, of the random data that is signed (default 1,024). The data changes at every run.
RSA-PSSAlso test the RSA-PSS padding (RSA keys only). It is optional: many providers do not support it and it is then reported as not supported, not as a failure.
CMS fallback (legacy CSP)Also test the signature through a detached CMS message (SignedCms), the Windows path that works with some legacy CryptoAPI providers that refuse a SHA-2 hash directly. Optional.
Hash on the device (PKCS#11)For PKCS#11, also use the mechanisms that hash inside the device (for example CKM_SHA256_RSA_PKCS), when the token supports them. Optional.

7.2 What is signed, and how

Applications sign in different ways. The program tests each of them, so a result for one method is not taken for another.

MethodWhat it doesNeeded
SignData (store and PFX keys)The provider hashes the data and signs it. RSA PKCS#1 v1.5, or ECDSA.yes
SignHash (store and PFX keys)The program hashes the data and the provider signs the digest.yes
Sign the data, hash on the host (PKCS#11)The program hashes. For an RSA key it signs the DigestInfo with CKM_RSA_PKCS; for an EC key it signs the digest with CKM_ECDSA (a digest longer than the curve order is truncated, as the standard says). The result of an EC key is the raw pair r || s.yes
RSA-PSS (SignData and SignHash)The probabilistic RSA padding.optional
CMS fallbackThe signature value of a detached CMS message made with the key of the certificate.optional
Hash on the device (PKCS#11)The token hashes and signs (CKM_SHA256_RSA_PKCS, CKM_ECDSA_SHA256 and similar).optional

For every signature the program does three more things, which is what makes the result trustworthy:

7.3 Read the report

The report of a test: certificate and key, open the key, signatures
The first part of the report of a certificate of the Windows store: the certificate, its key, the provider, then the signatures.
The end of the report with the result
The end of the same report: every method verified, and the verdict.
ColourMeaning
[ OK ] greenThe step worked. For a signature: it was created, it verifies, and modified data is rejected.
[WARN] orangeSomething to look at that does not stop the signing: a slot that was not the configured one, a PIN counter that is low, a provider whose DLL has another bitness.
[FAIL] redThe step failed. Under a red line the report writes the possible cause, what to do and the technical detail (the original message of Windows or of the device).
no colourInformation, including a method that the provider does not support and that is not required.

The Result section at the end counts the signatures and gives the verdict:

The report of a test of a key on a PKCS#11 device
The report of a key on a PKCS#11 device: the certificate, the library, the key object on the token, the slot used, and the signatures.

A line such as RSA-PSS ... not supported by this provider/device does not make the verdict negative: only the required methods count.

8. What the report says about the key

The first section of every report, and the result of Inspect key, describe the certificate and where its key lives. For a key of the Windows store:

Key information of a certificate whose key is in a CryptoAPI provider
Inspect key of a certificate whose key is in a CryptoAPI provider (CSP): the key container, the provider DLL and the key file with its permissions.
LineWhat it tells you
Test processThe account that runs the test, 32 or 64 bit, whether it is interactive (it has a desktop) or a service, and whether it is an administrator. This is the account for which the verdict is valid.
ProviderThe provider that holds the key, marked KSP (CNG key storage provider) or CSP (CryptoAPI provider, with its type). See section 9.
Key container, Key setThe name of the key in the provider, and whether it is a user key (of one account) or a machine key (of the computer).
Key specAT_KEYEXCHANGE or AT_SIGNATURE for a CryptoAPI key; CNG for a key of a KSP.
CNG key / CAPI keyThe algorithm and the size of the key.
Export policy / ExportableWhether the key can be exported. A key of a token or of an HSM never can.
UI policy / ProtectedWhether the key asks a person for a PIN or a confirmation. A service has nobody to answer and fails with NTE_SILENT_CONTEXT.
Key storage / Hardware device / RemovableHardware or software key; a removable device (a token); a key protected by the platform (a TPM).
Smart card readerThe reader of a smart card key.
Provider DLLThe DLL of the provider: its path, its bitness and its version. MISSING in red is the usual cause of Provider DLL failed to initialize correctly. A bitness that does not match the program is reported in orange.
CSP/KSP mapping, Same device, other providersThe other provider that Windows maps to the same device (section 9).
Key file, Owner, Allow, DENYFor a software key: the file of the key and its permissions. This account can read the key file in green, or CANNOT in red.

For a PKCS#11 device the report is the one of Scan:

The scan of a PKCS#11 device
The scan of a PKCS#11 library: the token, the state of its PIN, its mechanisms, the certificates found, and (after the login) the private keys.
LineWhat it tells you
Library, Library infoThe library that was loaded and its version and Cryptoki version.
Slots, Slot idHow many slots the library reports and which have a token. A slot with a token that is not initialized is skipped (some devices always keep one free slot).
TokenLabel, manufacturer, model, serial number, hardware and firmware.
PIN length, Login required, User PIN initializedThe PIN rules of the token and whether its normal-user PIN is set.
User PINThe retry counter: full (OK), low (a wrong PIN was entered recently, orange), FINAL TRY (one more wrong PIN locks the token, red), LOCKED (the token refuses every PIN until it is unblocked, red).
SessionsThe sessions that are open and the maximum that the token allows. It matters for the speed test with several threads.
MechanismsThe signing mechanisms of the token (RSA_PKCS, ECDSA, SHA256_RSA_PKCS, ...). A mechanism that is missing explains an optional method that is not supported.
Certificate on the tokenEach certificate with its key type, its CKA_ID and its thumbprint.
Login, Private keyAfter a login with the PIN: the private keys of the token, with the type, the label, the CKA_ID, whether the key can sign, is sensitive, is extractable and asks for the PIN at every use (always authenticate). A certificate and a key must have the same CKA_ID.
Slot usedThe slot where the certificate was found. If it is not the slot that you typed, the line is orange: the order of the slots changes when tokens are plugged or unplugged.

9. CSP, KSP and PKCS#11

A key can be reached through three different paths. An application uses one of them, so a certificate can work for one application and fail for another. The report says which path the key of your certificate uses.

PathHow it worksTypical failure
CSP
CryptoAPI provider
The older Windows interface. The certificate in the store has a provider, a container and a provider type (for example eToken Base Cryptographic Provider, type 1). Old providers do not support SHA-2 through the RSA classes.NTE_BAD_ALGID with SHA-256; NTE_BAD_KEYSET; provider DLL missing.
KSP
CNG
The newer interface. The provider has no type (shown as CNG). Elliptic-curve keys exist only here.Provider DLL missing; NTE_NOT_SUPPORTED; the key asks for a PIN (NTE_SILENT_CONTEXT).
PKCS#11The application loads the library of the manufacturer itself and sends the PIN itself. It does not need the Windows store at all.Library not found or of another bitness; no token present; PIN rejected; key not found on the token.
The same device on two paths

An HSM or a token very often installs both a CSP and a KSP, and Windows maps one to the other (for example SafeNet Smart Card Key Storage Provider and eToken Base Cryptographic Provider). The report shows the mapping in the lines CSP/KSP mapping and Same device, other providers. An application that uses CryptoAPI and one that uses CNG take different paths to the same key, so test the certificate in the way that your application uses it (store, or PKCS#11).

10. Provider health

The button Provider health checks every cryptographic provider registered on the computer, before you choose any certificate. For each provider it reads the registration, checks that its DLL exists and has the right bitness, and loads it (with a limit of 15 seconds).

The result of Provider health
The providers of a computer. AlfaSignKSP is registered, but its DLL is gone: any certificate whose key is in it fails.

Run it first when a certificate that was working suddenly fails on a computer.

11. Speed test

The speed test answers: how many signatures per minute can this key produce? It matters for a time stamp server, a signing service or any application that signs often.

Set Duration (s) and Threads (the number of signatures that run at the same time), then press Speed test. The first hash of the list is used.

The result of a speed test
A speed test of a key on a PKCS#11 device, with one session.
LineMeaning
ConfigurationHash, size of the data, threads, duration, and how the key is used.
SignaturesHow many signatures were made, and how many failed.
SpeedSignatures per second, and per minute.
LatencyThe time of one signature: minimum, average, median, the 95th percentile (95 signatures out of 100 were faster) and maximum.
Per threadThe speed of one thread, when you use several.
Kind of key (example from a test computer)Signatures per minute, one thread
RSA 2048 in a PFX file (software)about 110,000
ECDSA P-256 in a PFX file (software)about 275,000
RSA 2048 on a software token (SoftHSM2)about 65,000 (about 165,000 with 4 sessions)
RSA 2048 on a USB tokenabout 220
ECDSA P-256 on a USB tokenabout 420

The figures depend on the computer and the device. They show the order of magnitude: a USB token is thousands of times slower than a software key.

12. Continuous test

A certificate can work now and fail in ten minutes: the network between the server and the HSM breaks, the token is unplugged, a service of the HSM client restarts. The continuous test reproduces this case. It signs every N seconds (default 5), verifies each signature, and writes a line only when the state changes: signing stops, or signing works again. The key is opened again after every failure, from scratch, so the test also shows whether an application would recover by itself.

Press Continuous; the button becomes Stop continuous. Disconnect the token or the HSM and connect it again to see the reaction. This is a real run with a USB token that was unplugged twice:

Output
[    ] Continuous test Started: 00:12:51: signing every 2 s with SHA-256. Disconnect and reconnect the token/HSM to see the reaction.
[ OK ] Continuous test 00:12:54: signing works (2447 ms)
[FAIL] Continuous test 00:13:10: SIGNING FAILED: No PKCS#11 device is present (no token in any slot). [PKCS#11]
[ OK ] Continuous test 00:13:38: SIGNING WORKS AGAIN after 29 s of outage
[FAIL] Continuous test 00:14:40: SIGNING FAILED: No PKCS#11 device is present (no token in any slot). [PKCS#11]
[ OK ] Continuous test 00:14:49: SIGNING WORKS AGAIN after 9 s of outage
[WARN] Continuous test Finished: ran 127 s: 45 signatures OK, 18 failed, 2 outage(s), 38 s without signing

The last line gives the totals: the signatures that worked, the failures, the number of outages and the time without signing. From the command line the same test runs for a fixed time (/continuous /interval 5 /seconds 600) and the exit code tells whether everything worked.

13. Run as another account

A service does not run as you. A signing service, a time stamp server or any web application under IIS runs under a service account, such as an application pool identity, NETWORK SERVICE or a dedicated account. It has other permissions, no desktop, its own profile and certificate store. A test that works for you proves little for it. The group Run the test as runs the test under the account that matters.

The Run the test as group
The account of the test, and the analysis of the permissions of the key file.

13.1 Another user

Select Another user (user name and password), type the account (DOMAIN\user, .\user for a local account, or user@domain) and its password, then use Run tests, Inspect key or Speed test as usual. The program starts a second copy of itself with that account, runs the test there and shows its report in your window, with the account written at the top.

Typical messages: The user name or the password is not correct; The account is not allowed to log on in this way (a service account such as an application pool identity cannot be used with a password: use the analysis of section 13.3); The account is disabled; The account is locked out.

13.2 Service accounts

LocalSystem, NetworkService and LocalService need administrator rights. The program then creates a temporary scheduled task that runs the test under that account once, reads its result, and deletes the task and the result file. Nothing else is changed. Without administrator rights the option explains that and does nothing; start the program with Run as administrator to use it.

A PIN or a password is not passed to a service account (it would have to be written in a file). Use a source that needs none: a certificate of the Local Machine store whose key that account can use.

13.3 Who can read the key file

You often cannot log on as the account of an IIS application pool: it has no password. The button Analyse answers the question without logging on. Select the certificate, type the account in Who can read the key file (for example IIS AppPool\TSAPool; the list offers common accounts) and press Analyse. The program reads the permissions of the key file and tells whether that account has read access. The name of an application pool is enough: its identity is worked out, so IIS does not have to be installed on the computer.

The analysis of the access of an account to the key file
An application pool that cannot use a user key: the key is in the profile of the account that installed it.

The analysis is approximate: it considers the account and the groups that it always belongs to (Everyone, Authenticated Users, Users, and IIS_IUSRS for a pool). It never changes a permission.

14. Command line

The same file works without a window when you start it with arguments. It writes the report to the console and ends with an exit code, so it fits a monitoring script, a scheduled task or a support session. Arguments begin with / or -; a value follows the name (/slot 0) or is joined with a colon (/slot:0).

Exit codeMeaning
0Everything worked: the required signatures were created and verified.
1A test failed (the report says which one and why).
2The arguments are not valid (the usage is printed).

The source of the certificate

ArgumentsMeaning
/store CurrentUser\My /thumbprint <thumbprint>A certificate of the Windows store. CurrentUser or LocalMachine, then the store (default My). The thumbprint is the one shown by the Certificates console.
/scpin <PIN>The smart card PIN of a store certificate whose key is on a token (set silently).
/pfx <file> /password <password>A PFX or P12 file.
/pkcs11 <library.dll> /slot <n> /thumbprint <thumbprint> /pin <PIN>A PKCS#11 device. The certificate is searched on the token by its thumbprint (with a login when the token hides it). Alternative to the thumbprint: /cert <file.cer>.
/simulate KSP:<provider>
/simulate CSP:<provider>:<type>
Builds, in memory only, a certificate whose key is said to be in that provider. It reproduces a missing or broken provider (for example /simulate KSP:AlfaSignKSP) and checks that the diagnostics explain it. Nothing is installed.

Secrets. A PIN or a password written on the command line can be seen in the list of processes. Give - as the value (/pin -) to read it from the standard input, or use /secrets-stdin and send lines PIN=..., SCPIN=..., PASSWORD=..., ended by an empty line.

What to do

CommandMeaning
(nothing)The signing test of the selected certificate.
/inspectDescribe the certificate and its key (or scan the PKCS#11 device). Nothing is signed.
/scanScan a PKCS#11 library; with /pin it also logs in.
/listList the certificates of a store that have a private key.
/healthCheck every CSP and KSP of the computer.
/speed /seconds 10 /threads 4 /noreuseThe speed test. /noreuse opens the key for every signature.
/continuous /interval 5 /seconds 600The continuous test, for 600 seconds (0 = until the process is stopped).
/acl "IIS AppPool\TSAPool"Can that account read the key file of the certificate?
/as <user> /aspassword <password>Run the test, /inspect or /speed under another user.

Options

OptionMeaning
/hash sha256,sha384,sha512,sha1The hash algorithms (default: SHA-256, SHA-384 and SHA-512).
/size <bytes>The size of the random data (default 1024).
/nopss, /nocms, /notokenhashSkip the optional RSA-PSS, CMS fallback or hash-on-the-device methods.
/jsonWrite the report as JSON instead of text.
/out <file>Also write the report to a file.
/guiOpen the window with the fields filled in (section 3).

Examples

Shell
rem a certificate of the Local Machine store, SHA-256 only
"Digital Certificate Tester.exe" /store LocalMachine\My /thumbprint 900FB3CD611104916164242C16DAD369189D2023 /hash sha256

rem a token through PKCS#11; the PIN comes from the standard input
echo 1234| "Digital Certificate Tester.exe" /pkcs11 "C:\Windows\System32\eTPKCS11.dll" /slot 0 /thumbprint 1DDF4A677FEAA2057BCEC975778AD5EAED70E52A /pin -

rem speed of a PFX key with 4 threads for 10 seconds
"Digital Certificate Tester.exe" /pfx signing.pfx /password MyPassword /speed /seconds 10 /threads 4

rem the providers of this computer
"Digital Certificate Tester.exe" /health

Monitoring. The exit code and the JSON report make a simple check. This PowerShell script checks every 15 minutes (as a scheduled task) that a key on an HSM still signs, and writes the cause to the event log when it does not:

PowerShell
$exe  = "C:\Tools\Digital Certificate Tester.exe"
$lib  = "C:\Program Files\SafeNet\LunaClient\cryptoki.dll"
$thumb = "1DDF4A677FEAA2057BCEC975778AD5EAED70E52A"

$report = "1234" | & $exe /pkcs11 $lib /slot 0 /thumbprint $thumb /pin - /hash sha256 /nopss /nocms /json
if ($LASTEXITCODE -ne 0) {
    Write-EventLog -LogName Application -Source "Application" -EntryType Error -EventId 4001 `
        -Message "The signing key does not work: $report"
}

The JSON report has the form {"success":true,"errors":0,"warnings":0,"items":[{"section":"...","name":"...","value":"...","level":"ok"}]}, where level is info, ok, warn or error.

15. Messages and solutions

Every failure in the report has the same shape: a headline with the code, then Possible cause, What to do and Technical detail. The tables below list the messages that you will meet. None of the remedies is applied by the program: it only tells you what to do.

Windows: CryptoAPI and CNG

MessageCause and solution
The provider of the private key failed to initialize (“Provider DLL failed to initialize correctly”). 0x8009001D NTE_PROVIDER_DLL_FAILThe DLL of the CSP or KSP that holds the key is missing, damaged or blocked; the client software of the HSM, token or smart card is not installed, was removed or was updated without a restart; the HSM client service is stopped or the network to the HSM is down; the bitness of the DLL does not match the process; Windows security (an antivirus, a policy) blocked the DLL. Run Provider health: it names the provider and the file. Reinstall or repair the client software, restart the application, check the HSM link, and use the same bitness.
The DLL of the provider cannot be found (“Provider DLL could not be found”). 0x8009001EThe provider is registered but its DLL was deleted. Same remedies as above.
The key set does not exist, or the account cannot read it (“Keyset does not exist”). 0x80090016 NTE_BAD_KEYSETThe certificate is in the store, but its private key file was deleted, was installed by another account, or the account cannot read it; or the key is on a token or HSM that is not connected. Reconnect the device; install the certificate again with its private key in the right store; give the account the Read right on the key (section 13.3).
Access to the private key is denied. 0x80090010 NTE_PERM, 0x80070005 E_ACCESSDENIEDThe account that runs the application may not use the key. Grant Read in certlm.msc > All Tasks > Manage Private Keys. For IIS the account is IIS AppPool\<pool name>. Use Analyse to see who has access.
The key needs a PIN or a confirmation from a person, and no window can be shown here. 0x80090022 NTE_SILENT_CONTEXTThe key is protected by a PIN (smart card, token) or by strong key protection, and the process has no desktop (a service). Type the Smart Card PIN in the program, or use PKCS#11, which sends the PIN itself.
The provider type of the key does not match the provider (“Invalid provider type specified”). 0x80090014The key refers to a CSP that is not installed or was replaced (the HSM client was removed), or the container belongs to another provider. The section Likely cause checks the provider. Reinstall the client of the device.
The provider does not support the algorithm. 0x80090008 NTE_BAD_ALGIDA legacy CSP (for example Microsoft Base Cryptographic Provider) cannot sign with SHA-256, SHA-384 or SHA-512. Use Microsoft Enhanced RSA and AES Cryptographic Provider, a KSP, or the PKCS#11 library of the device. SHA-1 may work for a test.
The operation is not supported by the provider. 0x80090029 NTE_NOT_SUPPORTEDThe provider cannot do this kind of signature (RSA-PSS, a hash that the device does not know). For an optional method the report shows information, not a failure. Use PKCS#1 v1.5 and SHA-256.
The key cannot be used in this state. 0x8009000B NTE_BAD_KEY_STATENo access to the key, or a key that needs a person. Check Manage Private Keys and the PIN setting; use PKCS#11 for tokens.
The provider failed. 0x80090020 NTE_FAILAn internal error of the provider or of the device: a stuck smart card, a removed card, a network HSM that dropped the connection. Unplug and plug the token, restart the Smart Card service (SCardSvr), reconnect the HSM.
The private key does not exist. 0x8009002C NTE_NO_KEYThe key was deleted from the token or HSM, or the certificate was copied without its key. Install the certificate again with its key.
The ECDSA key of the certificate uses explicit curve parameters instead of a named curve.Windows cannot import such a private key. Create the certificate again with a named curve such as P-256.
The private key of the certificate is in the CryptoAPI provider ..., which cannot hold ECDSA keys.An EC key needs a KSP (CNG). Install the certificate again so that its key is in a CNG provider.
The certificate has NO private key in this source.It was installed without its key, or the key was deleted. Install the certificate again from a PFX file with its key.
There is no smart card or token in the reader. 0x8010000C SCARD_E_NO_SMARTCARD; the card was removed 0x80100069; no reader 0x8010002E; the Smart Card service is not running 0x8010001DInsert the token or card; plug the reader; start the Smart Card service in services.msc; try again.
The PIN is not correct 0x8010006B / is blocked 0x8010006C / the entry was cancelled 0x800704C7Check the PIN; do not retry blindly. A blocked PIN is unblocked with the PUK or the administrator PIN of the token (the software of the token has a command for it).
The signature was created but does NOT verify with the public key of the certificate.The key on the device does not belong to this certificate (a renewed certificate with a new key, a wrong container), or the provider returned a wrong signature. Select the certificate whose key is on the device.
The verification accepted MODIFIED data.The verification of this method is not reliable. This should never happen; report it with the report saved.

PFX and files

MessageCause and solution
The password of the PFX file is not correct. 0x80070056A wrong password (Windows calls it “network password”), or the file is damaged or is not a PKCS#12 file. Check it with certutil -dump file.pfx or OpenSSL, or export the certificate again.
The PFX file was not found / a file cannot be foundThe path is wrong, the file was moved, or the account that runs the test cannot see it (for example a mapped drive of another session). Use a local or UNC path that the account can read.
The PFX file contains no private key.The file has only the certificate. Export it again with the private key.

PKCS#11

MessageCause and solution
The PKCS#11 library was not found: ...The file was removed or the path is wrong. Select the library again; the list of the window shows the ones that are installed.
The PKCS#11 library ... cannot be used: it is a 32-bit library, while the application runs as 64-bit.The library and the program have different bitness. Select the 64-bit version of the library of the device. (The program is a 64-bit process on 64-bit Windows.)
The PKCS#11 library ... cannot be loaded (...). Check that it is the 64-bit version of the library and that the software of the device is installed.The text in brackets is the message of Windows. The file is not a PKCS#11 library, or a file that it needs is missing: install the client software of the device.
No PKCS#11 device is present (no token in any slot).The library loaded but reports no token: the token is not inserted or not recognised, the HSM client is not running, the network to the HSM is down, or the account that runs the test does not see the device. Insert the token, start the client, check the link and the account.
The signing certificate was not found on the PKCS#11 devices and the slot N does not exist.No token shows the certificate and the slot number is out of range. Use Scan to see the slots; the first is 0.
The device rejected the PIN. CKR_PIN_INCORRECTThe PIN is wrong. The program does not send it again. Do not retry until you are sure; CKR_PIN_LOCKED means the token is locked and needs the PUK or the SO PIN; CKR_PIN_EXPIRED means the PIN must be changed with the software of the token; CKR_PIN_LEN_RANGE / CKR_PIN_INVALID mean the PIN has a length or format that the token does not accept.
The test with a wrong PIN
A wrong PIN on a test token: the report explains it and the PIN is not sent again.
The private key of the selected certificate was not found on the device (session state ..., N private keys visible). The EC private key ... cannot be identified.The token holds no private key that matches this certificate: another token or slot, a key that was deleted or never created, a certificate of another key pair, or a PIN that gives no access to the keys. Click Scan with the PIN and compare the CKA_ID of the certificate and of the private key; select the certificate that is on the token.
Slot used: N ... NOT the configured slotInformation (orange). The certificate was found on another token than the one in the slot that you typed, and it was used. The order of the slots changes when tokens are plugged or unplugged; this is why the program searches all of them.
CKR_TOKEN_NOT_PRESENT, CKR_DEVICE_REMOVED, CKR_SESSION_HANDLE_INVALID, CKR_DEVICE_ERRORThe connection with the device was lost (token removed, network interruption, reset). The program reloads the library once and retries; the report says when it happened. See section 12.
CKR_MECHANISM_INVALID (for a “Hash on the device” method)The token does not support that mechanism. It is an optional method: the result is information, not a failure.
CKR_DATA_LEN_RANGEThe device does not accept data of that length (for example a long digest with a short curve). Use a hash that fits the curve, or let the device hash.
CKR_KEY_FUNCTION_NOT_PERMITTEDThe key may not sign (CKA_SIGN is false).

Provider health and Run as

MessageCause and solution
DLL MISSING ... the provider is registered but cannot loadSee 0x8009001D above. Repair or reinstall the client software of the device.
did not answer in 15 seconds (the provider hangs)A network HSM that is down, or a Smart Card service that does not respond. Check the HSM, restart its client service or the Smart Card service.
loads, but its DLL is 32-bit (or 64-bit)A process of the other bitness cannot use the provider. Use the build of the application that matches it.
The user name or the password is not correct. / The account is not allowed to log on in this way. / The account is disabled. / The account is locked out.The logon of Another user failed. A service account (an application pool) cannot log on with a password: use Analyse.
Access denied: the account cannot read the exeCopy Digital Certificate Tester.exe to a folder that the account can read.
Running as ... needs an administratorThe service-account options create a temporary scheduled task. Start the program with Run as administrator.
has NO read access to the key fileSee section 13.3.

16. Typical situations

The certificate is in the store but signing fails

  1. Press Provider health. A red line names a provider whose DLL is missing or hangs: that is the cause for every certificate whose key is in it.
  2. Press Inspect key and look at Provider, Provider DLL and Key file. The Likely cause section of a failed test says the same in words.
  3. If the key is on a token or an HSM, check that the device is connected and that its client service runs. Run the continuous test to see whether it comes and goes.

It works for me, but not for the service

  1. Find the account of the service (for IIS: the identity of the application pool, IIS AppPool\<name>).
  2. Press Inspect key: if the key is a user key (Key set: user key), the service does not see it. Install the certificate and its key in the Local Machine store.
  3. Give the account Read on the private key (Manage Private Keys), then check with Analyse.
  4. Test as the account itself: Another user for a normal account, or a service-account option (administrator needed).
  5. For a PKCS#11 device: the account must have access to the library, the configuration of the client and the device. Run the test as that account.

The PIN is wrong or the token is nearly locked

Press Scan without a PIN first: the line User PIN shows the retry counter. If it says FINAL TRY or LOCKED, do not enter a PIN you are not sure of; unblock the token with its PUK or administrator PIN using the software of the token. The program never sends a rejected PIN a second time.

Signing is too slow

Run the speed test with 1 thread and with several. A software key signs thousands of times per second; a USB token only a few. If a network HSM does not scale with the number of threads, check the limit of sessions of the HSM and the network latency. If the first signature is much slower than the next ones, the cost is opening the key: let the application reuse the key instead of opening it for every signature.

SHA-256 fails with an old provider

The result is NTE_BAD_ALGID for SHA-256 but SHA-1 signs: the key is in a legacy CSP such as Microsoft Base Cryptographic Provider. Move the key to a provider that supports SHA-2 (a KSP, or Microsoft Enhanced RSA and AES Cryptographic Provider) or use the PKCS#11 library of the device. A 1024-bit RSA key also limits the hashes that can be used with the PSS padding.

32-bit and 64-bit

The message it is a 32-bit library, while the application runs as 64-bit means that the library and the program do not match. Use the 64-bit library of the device. This version of the program runs as a 64-bit process on 64-bit Windows; a device that has only a 32-bit library cannot be tested with it.

17. What the program does and does not do

Use real devices carefully

A test signs with the real key. For a device that logs every signature or limits their number, or that asks for a confirmation on its own screen, use a test certificate, or keep the number of signatures small (disable the optional methods and select one hash).

18. Settings and files

19. Glossary

TermMeaning
Private keyThe secret half of a certificate. It signs. It must never be copied; an HSM never lets it out.
HashA short fingerprint of data. A signature signs the hash.
SignData, SignHashTwo ways to sign: the provider hashes and signs, or the caller hashes and the provider signs the digest.
PKCS#1 v1.5, PSSTwo paddings of an RSA signature. v1.5 is the usual one.
ECDSAThe signature of an elliptic-curve key. The result is the pair r, s.
CSPCryptographic Service Provider: the older CryptoAPI component that manages keys, identified by a name and a type.
KSP, CNGKey Storage Provider: the newer component of Cryptography API: Next Generation. Elliptic-curve keys need it.
Key containerThe name under which a provider keeps a key.
User key, machine keyA key of one account (in its profile), or a key of the computer (usable by the accounts that have the right).
Key fileThe file where Windows keeps a software key. Its permissions decide who can use the key.
Certificate storeThe place where Windows keeps certificates. Current User belongs to an account, Local Machine to the computer.
ThumbprintThe hash of a certificate. It identifies the certificate in a store or on a token.
PFX / P12A file with a certificate and its private key, protected by a password.
HSMHardware Security Module: a device that keeps keys and signs inside it.
PKCS#11The standard interface of programs to the keys of an HSM, a smart card or a token, through a library of the manufacturer.
Slot, tokenIn PKCS#11, a place where a device is connected, and the device (or the partition) that is in it.
Session, loginA connection to a token, and the step where the PIN is presented. A token limits the sessions and counts the wrong PINs.
CKA_IDThe identifier that links the certificate, the public key and the private key of a pair on a token.
MechanismA signing method of a token, such as CKM_RSA_PKCS or CKM_ECDSA.
PUK, SO PINThe administrator secrets of a token, used to unblock the user PIN.
Application pool identityThe Windows account under which an IIS application runs.
Bitness32-bit or 64-bit. A process can load only the DLLs of its own bitness.

Every effort has been made to make this manual as complete and accurate as possible, but no warranty or fitness is implied. The information provided is on an “as is” basis. The author shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this manual or from the use of the program. Signing with the key of a device can be logged, limited or charged by the device or its operator, and a wrong PIN can lock a token: use the program with care on production devices.

.NET, Windows, Windows Server, IIS and PowerShell are trademarks of Microsoft Corporation. SafeNet, Luna and other product names are trademarks of their owners. SoftHSM is a project of the OpenDNSSEC community. All other trademarks are the property of their respective owners.