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?

waronin3D
  • 325
  • 1
  • 3
  • 6

5 Answers5

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.

Brandon Minnick
  • 13,342
  • 15
  • 65
  • 123
mah
  • 39,056
  • 9
  • 76
  • 93
  • 1
    I know the alias is not in the file. Now looking for a way to recreate it somehow. – waronin3D Nov 21 '13 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 '13 at 11:48
  • So the alias content is generated random? – waronin3D Nov 21 '13 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 '13 at 12:19
  • Works like a charm, I had the file and the password but required the alias! Thanks! – Francois Jan 20 '16 at 07:02
  • 22
    Use verbose to extract the full key info `keytool -list -v -keystore `. – skymook Feb 17 '16 at 03:52
42

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“ì

Nagaraju Gajula
  • 560
  • 5
  • 12
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

Nagaraju Gajula
  • 560
  • 5
  • 12
TimChang
  • 2,249
  • 13
  • 25
5

This worked for me:

keytool -list -v -keystore "file address"

Copy your alias name and TaDa!!!

Carlos Galeano
  • 384
  • 5
  • 13
1

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

Rakesh K S
  • 11
  • 1