How to view contents in a java keystore file?

keytool -v -list -keystore <keystore-file>

How to extract a certificate from a keystore file?

keytool -export -alias foo -file certfile.cer -keystore <keystore-file>

foo should be replaced with alias name. Alias name can be found using -list command.