18

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!

Pushpalanka
  • 857
  • 1
  • 8
  • 20

8 Answers8

6

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

Devid Farinelli
  • 7,514
  • 9
  • 42
  • 73
Peter
  • 928
  • 10
  • 18
4

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.

ScouseChris
  • 4,377
  • 32
  • 38
2

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

Devid Farinelli
  • 7,514
  • 9
  • 42
  • 73
Bhaskar
  • 41
  • 3
0

The error message you are getting describes the problem. Either you've typed your password incorrectly or the keystore has become corrupted.

The most likely answer is that you've confused the keystore password with the password for the alias/keypass.

Jivings
  • 22,834
  • 6
  • 60
  • 101
  • 3
    I think you haven't exhausted all possible causes. I get the same, and I have doublechecked everything. – rwst Oct 02 '12 at 08:13
  • 3
    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. – Brian Knoblauch Aug 01 '13 at 20:10
0

In my case Caps Lock key was problem.

user2983041
  • 1,761
  • 4
  • 19
  • 31
0

In my case, the problem was that the folder had weird characters. I changed the name and it works.

0

Just change the filename. You have just given only the name without the extension.

Genry
  • 1,358
  • 2
  • 23
  • 39
vishal
  • 9
  • 1
  • 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 – Genry Jun 08 '21 at 13:25
-1

My problem was that I was putting the password in the command with the -storepass and -keypass switches (which is a bad idea anyway) and on my system Jarsigner was having none of it. Once I pulled those out and allowed Jarsigner to prompt me for the passwords it worked as expected.

rob5408
  • 2,972
  • 2
  • 40
  • 53