jarsigner error: java.lang.RuntimeException: keystore load: Keystore was tampered with, or password was incorrect

Pushpalanka picture Pushpalanka · Jun 4, 2012 · Viewed 29k times · Source

I am trying to sign a .wgt file(widget which is a jar file) using jarsigner of Java 6. But when I try to sign, it gives me the following error, after asking to enter the passphrase for keystore.

jarsigner error: java.lang.RuntimeException: keystore load: Keystore was tampered with, or password was incorrect

I even tried with a newly created key store, So that I am sure I am entering the correct password. Is there anything else which could have been gone wrong? Thanks in advance!

Answer

Peter picture Peter · Aug 24, 2013

If you're quoting the password, try removing the quotes. I experienced this error when using jarsigner in the 1.7.0_25-b17 JDK on Windows 7. I typically use earlier versions of jarsigner on Solaris and Linux and have always quoted the password using single quotes because it often contains characters that are interpreted by the shell.

I haven't verified, but I'm guessing that the shell interpreter on *nix trims quotes before passing the parameters to jarsigner, but the Windows command prompt doesn't.

For example, instead of

jarsigner -keystore /my/cert/file -storepass 'password' /my/jar/file my_alias

try

jarsigner -keystore /my/cert/file -storepass password /my/jar/file my_alias