This article will assist you to troubleshoot common warning and error messages associated with KeyLocker and jSign. Included are errors which are displayed when running a healthcheck as well as during file signing.
Healthcheck Errors:
Your client certificate path or password is incorrect. You will not be able to complete specific actions (such as sign, generate keypairs and approve releases) until these credentials are corrected.
This error can occur if the path set in your Environment Variables is incorrect.
Open your Environment Variables and ensure that the following variable is correct:
Another reason for this error is the use of an incorrect client certificate password.
A third possible cause is that the client certificate was generated and encrypted using AES and a SHA-256 signature hash. This is not supported by older versions of Windows.
Status: Connection failed
This error can be caused by using an invalid API key.
Note: jSign is not listed among the mapped signing tools in the healthcheck.
jSign Errors:
'jsign' is not recognized as an internal or external command, operable program or batch file.
This message will appear if the path to jsign.exe has not been mapped correctly.
jsign: Failed to load the keystore C:\Program Files\DigiCert\DigiCert KeyLocker Tools\pkcs11properties.cfg
java.security.KeyStoreException: Unable to load the keystore C:\Program Files\DigiCert\DigiCert KeyLocker Tools\pkcs11properties.cfg
at net.jsign.KeyStoreType.getKeystore(KeyStoreType.java:486)
at net.jsign.KeyStoreBuilder.build(KeyStoreBuilder.java:283)
at net.jsign.SignerHelper.build(SignerHelper.java:256)
at net.jsign.SignerHelper.sign(SignerHelper.java:388)
at net.jsign.JsignCLI.execute(JsignCLI.java:132)
at net.jsign.JsignCLI.main(JsignCLI.java:40)
Caused by: java.io.IOException: load failed
at jdk.crypto.cryptoki/sun.security.pkcs11.P11KeyStore.engineLoad(P11KeyStore.java:781)
at java.base/java.security.KeyStore.load(KeyStore.java:1473)
at net.jsign.KeyStoreType.getKeystore(KeyStoreType.java:483)
... 5 more
Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_FUNCTION_FAILED
at jdk.crypto.cryptoki/sun.security.pkcs11.wrapper.PKCS11.C_FindObjectsInit(Native Method)
at jdk.crypto.cryptoki/sun.security.pkcs11.P11KeyStore.findObjects(P11KeyStore.java:2676)
at jdk.crypto.cryptoki/sun.security.pkcs11.P11KeyStore.mapLabels(P11KeyStore.java:2291)
at jdk.crypto.cryptoki/sun.security.pkcs11.P11KeyStore.engineLoad(P11KeyStore.java:771)
... 7 more
Try `java -jar jsign.jar --help' for more information.
This error will appear if your KeyLocker credentials have not been configured or if the incorrect API key has been used.
jsign: Couldn't sign C:\filestosignpath\myfile.exe
java.security.ProviderException: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_FUNCTION_FAILED
at jdk.crypto.cryptoki/sun.security.pkcs11.P11Signature.engineSign(P11Signature.java:671)
at java.base/java.security.Signature$Delegate.engineSign(Signature.java:1423)
at java.base/java.security.Signature.sign(Signature.java:712)
at net.jsign.bouncycastle.operator.jcajce.JcaContentSignerBuilder$1.getSignature(Unknown Source)
at net.jsign.bouncycastle.cms.SignerInfoGenerator.generate(Unknown Source)
at net.jsign.bouncycastle.cms.CMSSignedDataGenerator.generate(Unknown Source)
at net.jsign.bouncycastle.cms.CMSSignedDataGenerator.generate(Unknown Source)
at net.jsign.asn1.authenticode.AuthenticodeSignedDataGenerator.generate(AuthenticodeSignedDataGenerator.java:50)
at net.jsign.AuthenticodeSigner.createSignedData(AuthenticodeSigner.java:373)
at net.jsign.AuthenticodeSigner.sign(AuthenticodeSigner.java:348)
at net.jsign.SignerHelper.sign(SignerHelper.java:394)
at net.jsign.JsignCLI.execute(JsignCLI.java:132)
at net.jsign.JsignCLI.main(JsignCLI.java:40)
Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_FUNCTION_FAILED
at jdk.crypto.cryptoki/sun.security.pkcs11.wrapper.PKCS11.C_SignFinal(Native Method)
at jdk.crypto.cryptoki/sun.security.pkcs11.P11Signature.engineSign(P11Signature.java:621)
... 12 more
Try `java -jar jsign.jar --help' for more information.
This error means that the password for your client certificate is incorrect.
This error can also occur if you have not added a signer to your certificate in DigiCert ONE.
Error: Unable to access jarfile <file path>
This error appears if the path to jsign5-0.jar contains spaces. For example: C:\jsign path\jsign-5.0.jar
jsign: The file <file path> couldn’t be found
This error can mean that either the pkcs11properties.cfg file or the file that you want to sign cannot be found.
jsign: No certificate found under the alias '<keypairalias>' in the keystore SunPKCS11-signingmanager (available aliases: <keypairalias1>, <keypairalias2>)
Try `java -jar jsign.jar --help' for more information.
This error means that an incorrect keypair alias was referenced in the signing command.
jsign: keystore option should either refer to the SunPKCS11 configuration file or to the name of the provider configured in jre/lib/security/java.security
Try `java -jar jsign.jar --help' for more information.
This error will appear when jSign cannot locate your pkcs11properties.cfg file.
For a detailed guide to setting KeyLocker up for use with jSign see Configure KeyLocker for jSign using the PKCS#11 Library.