I need to receive PKCS12 files and obtain X509Certificates from them in order to extract information. How do I do this?

Berin Loritsch

Keytool can read PKCS12 files as generated by Netscape. It will treat them as a keystore. An example would be:

keytool -list -rcs -keystore myfile.p12 -storetype pkcs12 -password foobar
Due to a bug in JSSE, the password MUST be 6 characters or longer or it won't be able to decrypt the PKCS12 file.

You can use keytool to export the X509 certificate portion--but you can't export the private key. You also can't import a PKCS12 file into a JKS format keystore.