Finding an imported certificate’s alias in a java keystore

Click here if you need to create a keystore. I started with a p12.

When you need your certificate out of a keystore you will need to know the alias of the certificate.
First list the keystore’s contents:
> keytool -list -keystore keystore.jks

You should expect output like this:
My websites’s comodo ca limited id, Jan 1, 2014, PrivateKeyEntry,
Certificate fingerprint (SHA1): 45:32:13:3D:F2:1D:F7:DA:84:6A:43:DF:1E:86:B3:64CB:4B:3D

The alias is everything before the first comma:
My websites’s comodo ca limited id

Verify the alias:
> keytool -list -keystore keystore.jks -alias “My websites’s comodo ca limited id

If it worked it should list the above certificate info, and now you have the alias.

Leave a Reply

Your email address will not be published. Required fields are marked *