Search code examples
androidandroid-studiokeytool

How to get `incorrect password` from keytool?


Windows10 user. I am trying to recover my keystore password. I am using keytool.exe found in C:\Program Files\Android\Android Studio\jre\bin.

I want to eventually change the password, but I am unsure of what the password is. I am trying to get an incorrect password error by running a command similar to:

keytool -keypasswd -keypass "foo" -new "foobar"-keystore "C:\Users\Me\Desktop\stuff\keystores\android.jks"

I have also tried:

keytool -keypass "foo" -new "foobar"-keystore "C:\Users\Me\Desktop\stuff\keystores\android.jks"

My error message for both is

Illegal option:  
C:\Users\Me\Desktop\stuff\keystores\android.jks

***Side Note:

I do have the password "Remembered" in Android Studios, and am able to generate new keys and updates with it. My end goal is to transfer the keystore over to my mac. If there is another way to find the password or to handle this configuration, I am all ears.


Solution

  • I was able to find a command that issues a Enter keystore password: prompt. Command:

    keytool -list -v -keystore C:\Users\Me\Desktop\stuff\keystores\android.jks
    

    After a few attempts of doing the incorrect password, I received the error code:

    keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect
    

    And finally, I was able to guess my correct password, which output:

    Keystore type: JKS
    Keystore provider: SUN
    
    Your keystore contains 1 entry
    
    Alias name: myandroidkey
    Creation date: 16-Aug-2018
    Entry type: PrivateKeyEntry
    Certificate chain length: 1
    Certificate[1]:
    ...
    
    *******************************************
    *******************************************