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

31,767

Solution 1

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

Solution 2

I had the exact opposite issue to @Peter I had special characters in my password and my signing script kept giving this error until I wrapped the password in double quotes "

I think this was because I was running a batch file to sign my app rather than typing it directly into the command line and windows was getting confused about the special characters in the password.

Solution 3

Check your keystore alias name once. Some times keystore alias name is different from keytool alias name then it gives the same error...So check it alias names once

Share:
31,767

Related videos on Youtube

Pushpalanka
Author by

Pushpalanka

Undergraduate, Department of Computer Science and Engineering, University of Moratuwa, Sri Lanka.

Updated on July 17, 2022

Comments

  • Pushpalanka
    Pushpalanka almost 2 years

    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!

  • rwst
    rwst over 11 years
    I think you haven't exhausted all possible causes. I get the same, and I have doublechecked everything.
  • user1568901
    user1568901 almost 11 years
    I have the same problem. I can generate a fresh keystore with a simple password, have it all accepted fine, then still get this error.
  • Genry
    Genry about 3 years
    Can you please give an example which file name are you talking about? There are 2 files in the command, one for the certificate and one for the target file