Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check certificate name and alias in keystore files?

I have a bunch of .keystore files and need to find one with specific CN and alias. Is there a way to do it with keytool, jarsigner or some other tool? I found a way to check if specific keystore was used to sign a specific apk, but I also need to get the alias and certificate name in each of the files.

like image 328
Malthan Avatar asked Oct 15 '12 10:10

Malthan


People also ask

What is alias name in keystore?

An alias is specified when you add an entity to the keystore using the -genseckey command to generate a secret key, -genkeypair command to generate a key pair (public and private key) or the -importcert command to add a certificate or certificate chain to the list of trusted certificates.


2 Answers

You can run the following command to list the content of your keystore file (and alias name):

keytool -v -list -keystore .keystore 

If you are looking for a specific alias, you can also specify it in the command:

keytool -list -keystore .keystore -alias foo 

If the alias is not found, it will display an exception:

keytool error: java.lang.Exception: Alias does not exist

like image 99
Romain Linsolas Avatar answered Sep 28 '22 22:09

Romain Linsolas


In order to get all the details I had to add the -v option to romaintaz answer:

keytool -v -list -keystore <FileName>.keystore 
like image 43
enkara Avatar answered Sep 28 '22 22:09

enkara