31

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

Idolon
  • 26,581
  • 12
  • 93
  • 121
user2692264
  • 348
  • 1
  • 3
  • 7
  • 1
    Solution from @BasicPleasureModel is the only one that works on Linux. Need to look if there is something related for OSX and Windows – allgood Feb 10 '19 at 13:43
  • @allgood The solution for OSX is right here: https://stackoverflow.com/questions/18701932/how-can-i-retrieve-a-saved-keystore-password-from-android-studio/53746927#53746927 – Idolon Jul 29 '19 at 18:56

6 Answers6

42

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

Varun
  • 1,841
  • 14
  • 16
  • 1
    worked a treat, I was about to start using https://github.com/MaxCamillo/android-keystore-password-recover to brute force my keystore - you saved my bacon – Dean Wild Nov 26 '15 at 12:00
  • 2
    Password is masked but I found correct keystore location :-) – Leos Literak Mar 28 '16 at 11:16
  • 2
    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 – Newtz May 02 '16 at 10:43
  • 6
    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 ;) – Appyx Jun 06 '16 at 16:08
  • What is "Pandroid.injected.signing.key.password" here? Is it your app package name? – Shajeel Afzal Sep 29 '16 at 20:37
  • @ShajeelAfzal : This is the name of the key which stores your keystore password. – Varun Nov 29 '16 at 16:29
  • The default log file on Windows: C:\Users\UserName\.AndroidStudio2.3\system\log\ – Loc Phan May 31 '17 at 12:55
  • 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`. – GabLeRoux Sep 22 '17 at 13:04
  • 9
    This doesn't seem to work on AS 3.0 on Ubuntu, there are asterisks in place of password characters in logs. – Luke Mar 21 '18 at 22:27
  • 1
    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](https://stackoverflow.com/a/53746927/648313) and [Ubuntu](https://stackoverflow.com/a/52190529/648313) – Idolon Dec 12 '18 at 16:07
  • 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 – Melardev Dec 18 '18 at 19:04
  • @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 – Idolon Jan 05 '19 at 19:47
  • doesn't work anymore, solution from @BasicPleasureModel worked for me. – allgood Feb 10 '19 at 13:42
28

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!

Idolon
  • 26,581
  • 12
  • 93
  • 121
18

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!

  • 2
    Great! It worked on OSX also. Open keychain access and filter on android – Kamen Dobrev Jul 02 '19 at 11:11
  • 1
    @KamenDobrev Yep, For OSX I described the details in an answer here: https://stackoverflow.com/questions/18701932/how-can-i-retrieve-a-saved-keystore-password-from-android-studio/53746927#53746927 – Idolon Jul 29 '19 at 18:57
13

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)

Community
  • 1
  • 1
James Nick Sears
  • 912
  • 9
  • 16
9

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\

Mohamed Nageh
  • 1,741
  • 1
  • 15
  • 27
5

I had the same problem!

it makes me crazy but I found a little script that it´s saves me: https://github.com/corneliudascalu/intellij-decrypt

I think it could help you. Good Look

juanram0n
  • 326
  • 3
  • 17