Just recently I have had a problem with a key store. I know there are plenty of questions about this problem already. I have read them all and Googled furiously.
keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect
java.io.IOException: Keystore was tampered with, or password was incorrect
at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:772)
at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:55)
at java.security.KeyStore.load(KeyStore.java:1214)
at sun.security.tools.KeyTool.doCommands(KeyTool.java:885)
at sun.security.tools.KeyTool.run(KeyTool.java:340)
at sun.security.tools.KeyTool.main(KeyTool.java:333)
Caused by: java.security.UnrecoverableKeyException: Password verification failed
at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:770)
... 5 more
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
Version: 3.8.0
Build id: I20120502-2000
If I type in the password very quickly it works, sometimes.
It seems that opening up Eclipse and entering the password the first time lets me use the keystore.
Obviously, if all else fails, I will have to create a new key store. I really would like to get this resolved, I am just not sure what to do now besides republish with a new key.
If the key cannot be recovered properly, I might open source it on Github.
A special thanks to user Erhannis!
Here is what I did:
The command would error out on me each time:
keytool -importkeystore -srckeystore old.keystore -destkeystore new.keystore -v
Since you told me we could extract private keys from the Java Keystore(.jks), I dug deeper and ended up using a variation of the command. I followed the links you posted here and here:
keytool -importkeystore -srckeystore old.keystore -destkeystore new.keystore -deststoretype pkcs12
After extracting the private key and storing as PKCS12, I think extracted my private key and put it back into a brand new Java Keystore:
keytool -importkeystore -srckeystore new.keystore -srcstoretype pkcs12 -destkeystore final.keystore -deststoretype jks
http://developer.android.com/tools/publishing/app-signing.html#signapp
http://code.google.com/p/android-keystore-password-recover/
How to handle a lost KeyStore password in Android?
Android: I lost my android key store, what should I do?
Forgot Keystore password, thinking of Brute-Force detection. will it corrupt the keystore?
I have lost the password for android Keystore file
Problem running my signed, release keystore in Eclipse
Android - Forgot keystore password. Can I decrypt keystore file?
Android release keystore issue: "Keystore was tampered with, or password was incorrect"
I may have had the same problem. I never did figure out why it was failing (though I wonder if it was because the keystore password was shorter than 6 digits), but I was able to copy my key into a new keystore, which I then renamed to replace the old one, and it mysteriously worked after that (using the new passwords). Needed the key password, by the way. Working off https://security.stackexchange.com/a/3795, I did the following:
keytool -importkeystore -srckeystore old.keystore -destkeystore new.keystore -v
After double-checking that the new one worked, I just copied it over the old one. Hope it works for you; good luck.