The Java keytool “list” command

Java “keytool list” FAQ: Can you share some examples of the Java keytool list command, and Java keytool list process?

In a long, earlier article on Java keytool, keystore, and certificates, I demonstrated how to list the contents of a Java keystore file, but to simplify things a little for this tutorial, I'm just going to show how to query a Java keystore file using the keytool list command.

View Java keystore information with "keytool list"

In short, to query the contents of a Java keystore file, you use the keytool list command, like this:

$ keytool -list -v -keystore privateKey.store

In this example, the name of my keystore file is "privateKey.store", and the -list and -v (verbose) options tell the keytool command that I want to "list the contents" of the keystore file.

Assuming you know the password for the Java keystore file named privateKey.store, the complete process, including your input and the list command output, looks like this:

$ keytool -list -v -keystore privateKey.store

Enter keystore password:  ABC123

Keystore type: jks
Keystore provider: SUN

Your keystore contains 2 entries

Alias name: foo
Creation date: Apr 25, 2010
Entry type: keyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Alvin Alexander, OU=Application Development, O=devdaily.com, L=Louisville, ST=KY, C=US
Issuer: CN=Alvin Alexander, OU=Application Development, O=devdaily.com, L=Louisville, ST=KY, C=US
Serial number: 4bd4e793
Valid from: Sun Apr 25 17:08:35 AKDT 2010 until: Sat Jul 24 17:08:35 AKDT 2010
Certificate fingerprints:
	 MD5:  55:20:B2:68:FD:0F:4E:BF:D5:E5:D5:04:47:6C:E3:10
	 SHA1: 25:17:A0:CA:86:CC:3E:6C:2D:C0:4E:8D:E8:33:05:F7:4B:50:FE:E5

*******************************************
*******************************************

Java keytool list output

As you can see, this "keytool list" command shows a lot of information about your keystore. I won't add much to it here, as you can read through those contents. But I will mention this: If your keystore contains more than one alias, the output for each alias would be shown by this list command, and the output for each alias will look just like the output shown above.

Add new comment

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.