javaandroidkeystore

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.


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