Sachin Parashar Sachin Parashar - 1 month ago 12
Java Question

Keystore was tampered with or password was incorrect

I know there are already such questions but I couldn't find any answer that could help me.

I am trying to get a Google Maps API key for which I have to have a MD5 key using this command :

keytool -list -v -alias androiddebugkey -keystore "/Users/Sachin Parashar/.android/debug.keystore" -storepass android -keypass android


but it is giving this error :

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:780)
at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:56)
at sun.security.provider.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:225)
at sun.security.provider.JavaKeyStore$DualFormatJKS.engineLoad(JavaKeyStore.java:70)
at java.security.KeyStore.load(KeyStore.java:1445)
at sun.security.tools.keytool.Main.doCommands(Main.java:792)
at sun.security.tools.keytool.Main.run(Main.java:340)
at sun.security.tools.keytool.Main.main(Main.java:333)
Caused by: java.security.UnrecoverableKeyException: Password verification failed
at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:778)
... 7 more


Does anyone know what's wrong with this command?

Answer

Read the stacktrace. This error is raised when your password is just wrong.

As you're dealing with the debug keystore, you can remove it and create a new one.

First, delete this file

/Users/Sachin Parashar/.android/debug.keystore

Then, run (on the same folder, i.e. /Users/Sachin Parashar/.android/)

keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000

Finally, you can run what you were trying before

keytool -list -v -alias androiddebugkey -keystore "/Users/Sachin Parashar/.android/debug.keystore" -storepass android -keypass android
Comments