问题
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!
回答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
回答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
回答3:
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.
回答4:
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.
回答5:
In my case Caps Lock key was problem.
回答6:
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.
来源:https://stackoverflow.com/questions/10887127/jarsigner-error-java-lang-runtimeexception-keystore-load-keystore-was-tampere