HiveBrain v1.2.0
Get Started
← Back to all entries
snippetjavaCritical

How to check certificate name and alias in keystore files?

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
certificatehowcheckandnamefilesaliaskeystore

Problem

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.

Solution

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

keytool -v -list -keystore /path/to/keystore


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

keytool -list -keystore /path/to/keystore -alias foo


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

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

Code Snippets

keytool -v -list -keystore /path/to/keystore
keytool -list -keystore /path/to/keystore -alias foo

Context

Stack Overflow Q#12893995, score: 1265

Revisions (0)

No revisions yet.