snippetjavaCritical
How to check certificate name and alias in keystore files?
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):
If you are looking for a specific alias (for example foo), you can also specify it in the command:
If the alias is not found, it will display an exception:
keytool error: java.lang.Exception: Alias does not exist
keytool -v -list -keystore /path/to/keystoreIf 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 fooIf 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/keystorekeytool -list -keystore /path/to/keystore -alias fooContext
Stack Overflow Q#12893995, score: 1265
Revisions (0)
No revisions yet.