32

recently I added a new alias to my keystore to sign my app.

Now I lost the new generated file with the alias, but remember the password and the alias name and have an older copy the file. Is there a way to recreate the alias using this things?

3
  • 1
    you mean new keystone you lost..
    – pavanmvn
    Nov 21, 2013 at 11:34
  • More or less, yes. If there is no random component in the creation of the alias, i should be able to recreate it.
    – waronin3D
    Nov 21, 2013 at 11:36
  • @waronin3D So finally did you find the solution?
    – TOP
    Sep 12, 2016 at 6:46

5 Answers 5

68

You can list the contents of your keystore with the command:

keytool -list -keystore <name of keystore file>

To do this, you will need to provide the keystore password (not the alias password). This will tell you the aliases in the file, which are self-contained, allowing you to sign. If you wish, you could also extract keys using other options / tools.

6
  • 1
    I know the alias is not in the file. Now looking for a way to recreate it somehow.
    – waronin3D
    Nov 21, 2013 at 11:43
  • Not possible. If it were possible, if I knew your alias name then I could fabricate your signing key to impersonate your signature. The password has no bearing on the contents of the alias, only on the extraction of the signing key for that alias within the keystore. To answer your comment above -- there is, and must be, a random component in the generation, for security needs.
    – mah
    Nov 21, 2013 at 11:48
  • So the alias content is generated random?
    – waronin3D
    Nov 21, 2013 at 11:57
  • The alias is simply a name to help you locate the key. The key is the magic sauce, which is randomly generated. The alias can be changed without any affect on the key... so yes. Isn't this how you would design a system if security were important? If not, there would be no cryptographic strength to the process.
    – mah
    Nov 21, 2013 at 12:19
  • 22
    Use verbose to extract the full key info keytool -list -v -keystore <name of keystore file>.
    – skymook
    Feb 17, 2016 at 3:52
41

Open your key store (.jks) file with text editor. It will display binary form of data. The readable text in the first line is your key alias.

For example, your key alias in the following binary data is the key alias.

þíþí your key alias UYY_ 0‚þ0 +* ‚êa÷í–ØRö}ðžá䶈ùÎL\ô©2‘wå¥H¨V †¸®Àµ£ð×þ7—â;TÁÙcsª”ž˜4ÝÉ'AÀì,’„×S¼ðßÅ'€Õ¡ó‚˜ ö!y’Çåx|(woÁh4u-û†‚‡§Qȸ|ˆ³”ÜæûZ޲a±O­´¢^À.ªbÅ“e†6 Éç§®j§˜y ößÿØ0Çd@ /Ã?®¦ìé¼/§Zq””Ê•©„=~Ùì¢>º}DàO<Ö¹SbpÎŒ@Ø„°^Í^e»>¾ü«nM( "Nbûh·2ðÁ0¯ç¿61êè“[.ÇzeYŽºXkuÄy*ôq¥FSs]:2“ì

2
10

http://tim12332013.blogspot.tw/2014/10/corona-sdk-android-keystore-lost-alias.html

look it may help you

keytool -list -v -keystore X:/XXXX /XXXX.keystore -storepass XXXX

2
  • Thanks Man, this is help me Jul 19, 2016 at 14:06
  • great answer ! helped me a lot !
    – Jeffrey
    Jan 14, 2021 at 20:35
5

This worked for me:

keytool -list -v -keystore "file address"

Copy your alias name and TaDa!!!

1
  • you're a magician 😁 👍
    – highdee
    Jun 20, 2022 at 23:05
1

The default alias in latest android studio version is "key0". You can try this if you haven't changed your alias value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.