How can I retrieve a saved keystore password from Android Studio?

22,484

Solution 1

You can find this in the idea.log files generated by Android Studio:

Search for "Pandroid.injected.signing.key.password" and you can see the key password.

Example logs:

2015-11-13 10:22:48,844 [ 709463] INFO - a.gradle.invoker.GradleInvoker - Build command line options: [--configure-on-demand, -Pandroid.injected.invoked.from.ide=true, -Pandroid.injected.signing.st ore.file=/Users/varun/Projects/myapp/mykey.jks, -Pandroid.injected.signing.store.password=mykeystorepassword, -Pandroid.injected.signing.key.alias=myalias, -Pandroid.injected.signing.key.password=mykeypassword , -Pandroid.injected.apk.location=/Users/varun/code/android/workspace/myapp, --init-script, /private/var/folders/vk/z504nlhd6v30p7zvtgjp5sjm0000gn/T/asLocalRepo0.gradle]

Note 1: On OSX the idea.log file can be found at ~/Library/Logs/AndroidStudio2.0

Note 2: If you don't find the password in idea.log, then also look at the files called idea.log.1, idea.log.2 and so on.

Source

Solution 2

On macOS the latest versions of Android Studio (tested on 3.2) store keystore/key passwords in the Keychain under the following items:

  • org.jetbrains.android.exportSignedPackage.KeystoreStep$KeyStorePasswordRequestor
  • org.jetbrains.android.exportSignedPackage.KeystoreStep$KeyPasswordRequestor

The former stores the password of the keystore itself, and the latter – the password to the key.

You can access them using system Keychain Access app. Locate corresponding entry and double-click it. The Account field should contain the path to your keystore or the path to the key alias within the keystore in the following form: KEY_STORE_PASSWORD__/Users/username/keystorename or KEY_STORE_PASSWORD__/Users/username/keystorename__alias

Click Show password and enter your macOS password when requested. That's it!

Solution 3

For anyone attempting keystore password recovery on more recent versions of Android Studio and Ubuntu, it seems that most documented suggestions to recover the password from logs, gradle, etc no longer work. Corneliu's excellent brute force script is great - unless you chose a 16 character password with no dictionary words in it and would like a result some time this month :) Using the Intellij security.xml solution is no longer available to retrieve saved passwords from Android Studio either, as far as I can tell.

However - having dug around a bit, Android Studio 3.1 seems to use the OS keychain in Ubuntu 18.04, so retrieving a saved keystore password is as simple as:

  1. open 'Passwords and Keys' (use super key and search 'password')
  2. filter results by 'android'
  3. look at each entry, they will be something like org.jetbrains.android...KeyPasswordRequestor, and open each one up in turn
  4. expand the password dropdown and select 'Show password', it will look something like: KEY_STORE_PASSWORD__/home/pathto/keystore/keystore-name.jks@mycoolpassword

Find the keystore you're looking for and the bit after @ is your missing password. Hope that helps someone out there!

Solution 4

Gradle stores them within your project directory in a binary file. You can get them like this (from the project directory):

strings .gradle/GRADLE_VERSION/taskArtifacts/taskArtifacts.bin | grep storePassword -A1

(Thanks to https://stackoverflow.com/a/33624636/1982087 for the taskArtifacts.bin pointer)

Solution 5

look for the log file from the date which you had signed your apk and you can find your key info there like below.

-Pandroid.injected.signing.store.password=[store_password], 
-Pandroid.injected.signing.key.alias=[alias], 
-Pandroid.injected.signing.key.password=[key_password]

you can find your log files under

C:\Users\username.AndroidStudio[versionNum]\system\log\

Share:
22,484
user2692264
Author by

user2692264

Updated on December 15, 2021

Comments

  • user2692264
    user2692264 over 2 years

    The new Android Studio allows us to save keystore passwords for later use. Where are these passwords stored on my computer (OSX), and is there a way to retrieve the saved values?

    enter image description here

    EDIT I am looking for the Alias password, not the Keystore password

  • Dean Wild
    Dean Wild over 8 years
    worked a treat, I was about to start using github.com/MaxCamillo/android-keystore-password-recover to brute force my keystore - you saved my bacon
  • Leos Literak
    Leos Literak about 8 years
    Password is masked but I found correct keystore location :-)
  • Newtz
    Newtz about 8 years
    On OSX the log files for the latest version of Android Studio (currently 2.0) can be found at ~/Library/Logs/AndroidStudio2.0. I found the password in idea.log.1 so you may need to check a couple of files before you find what you're after
  • Appyx
    Appyx about 8 years
    Thank you so much! This is a better solution than bruteforcing :D If anyone can't find the log file on OSX like me: In Studio: Help->Show Log in Finder->open file and search ;)
  • Shajeel Afzal
    Shajeel Afzal over 7 years
    It would be much better if you could show how to use that method as well.
  • Shajeel Afzal
    Shajeel Afzal over 7 years
    What is "Pandroid.injected.signing.key.password" here? Is it your app package name?
  • Varun
    Varun over 7 years
    @ShajeelAfzal : This is the name of the key which stores your keystore password.
  • Loc Phan
    Loc Phan about 7 years
    The default log file on Windows: C:\Users\UserName\.AndroidStudio2.3\system\log\
  • GabLeRoux
    GabLeRoux almost 7 years
    I didn't have anything in the logs, but when you attempt to Generate a signed apk, it will write it again in the logs. Almost sounds like a security issue, but at least, you need your master password for it to write to logs. If you see the password and remember password is checked, you can always retrieve it this way. No need for the keystore file. Tested on AndroidStudio2.3 cat ~/Library/Logs/AndroidStudio2.3/idea.log | grep password.
  • Ohad Cohen
    Ohad Cohen over 6 years
    as of android studio 3.0 with gradle 4.1, they are masked (passwords stored as ******)
  • Luke
    Luke over 6 years
    This doesn't seem to work on AS 3.0 on Ubuntu, there are asterisks in place of password characters in logs.
  • Deepak Patil
    Deepak Patil almost 6 years
    if there are multiple GRADLE_VERSION's try on all of them ..it worked for me on 2.2.1 ..didn't work for 2.4
  • Idolon
    Idolon over 5 years
    Doesn't work for Android Studio 3.x. The passwords are masked with asterisks (as it should be from the very beginning). Check below working solutions for macOS and Ubuntu
  • Melardev
    Melardev over 5 years
    This works, in Windows the default location I had was C:\Users\melardev\X where X depends on Android Studio Version it may be: .AndroidStudio2.1 or .AndroidStudio3.2 or .AndroidStudioPreview3.0 or other value. The command I used was $ grep -n --color -P "signing\.(store|key)" ./.AndroidStudio2.1/system/log/* using git bash, It showed up the files containing the passwords
  • Idolon
    Idolon over 5 years
    @Melardev As many others already commented, this does not work on newer versions of Android Studio. It worked for you because you were using AndroidStudio 2.1
  • Priyanka Singhal
    Priyanka Singhal over 5 years
    If they marked as ***** how can we get them in android studio 3.0 and above
  • allgood
    allgood over 5 years
    doesn't work anymore, solution from @BasicPleasureModel worked for me.
  • Kamen Dobrev
    Kamen Dobrev almost 5 years
    Great! It worked on OSX also. Open keychain access and filter on android
  • Idolon
    Idolon almost 5 years
    @KamenDobrev Yep, For OSX I described the details in an answer here: stackoverflow.com/questions/18701932/…
  • Simon Crane
    Simon Crane over 4 years
    Worked for me on windows when none of the other methods did, thanks a lot!
  • varun
    varun over 4 years
    You are a live saver. Thanks!!
  • Le Roi Beukes
    Le Roi Beukes about 4 years
    Please explain how to get to this on windows ?
  • Carlos Galeano
    Carlos Galeano about 3 years
    Thanks Mac for secure my passwords... Thanks to you cuz' you show the correct path :)
  • Mini Chip
    Mini Chip about 3 years
    @LeosLiterak And what;s that correct location? Because I can see the password in masked :(
  • Leos Literak
    Leos Literak about 3 years
    Sorry, this question is 5 years old and I quit Android development years ago.
  • Jay
    Jay over 2 years
    You are a life save. Thanks!!
  • Dany Balian
    Dany Balian over 2 years
    worked for me; you made me also go to the original question and upvote it too :)
  • Jakub Licznerski
    Jakub Licznerski over 2 years
    this was an expolit... it was fixed. Please edit answer
  • Austin
    Austin about 2 years
    In 2022, this is the only answer that worked from my Windows 10 PC. Android Studio has plugged a lot of the holes that previously allowed you to read raw passwords in logs. However, the plugin you created worked flawlessly. You saved my app from relisting!
  • Shashi
    Shashi about 2 years
    Working answer in 2022
  • angel.teran
    angel.teran about 2 years
    Great, works for me too! (Windows 11, Android Studio Chipmunk 2021.2.1 Patch 1)
  • Anuj Raghuvanshi
    Anuj Raghuvanshi almost 2 years
    Worked for me too July 2022 - Mac OS