Friday, June 11, 2021

Keytool and Keystore tips and tricks

When releasing or debugging the app, Google often yells at us regarding the improper SHA-1 keys. Here are some tricks for accessing keys via the keytool program. Keytool is the software by Oracle for creating and accessing SHA-1 keys. If the keys are generated via Android Studio, the keytool cannot apply the previous initial password to access them because Android Studio assigns its own password to the keystore.

Default password for the keytool program (that is eventually used for keys generation and storing them) is "changeit". Default password that Android Gradle assigns to the keystore is "android".

To see the current keys, run 

    ./gradlew signingreport 

from the project's folder. It will show keys, their aliases and storage path e. g. /home/oleg/.android/debug.keystore.

To change the key password, go in the terminal to the storage of the keys that is listed in the above ./gradlew signingreport as "Store". Than run 

    keytool -storepasswd -keystore debug.keystore 

and follow the instructions. As an old (current) password we can write "changeit" or "android" supra.

No comments:

Post a Comment