Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keystore was tampered with or password was incorrect

Tags:

java

android

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?

like image 558
Sachin Parashar Avatar asked Dec 05 '22 01:12

Sachin Parashar


1 Answers

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
like image 69
rafaelc Avatar answered Dec 06 '22 19:12

rafaelc