Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a p12 file which apparently contains the server certificate. I need to extract the x509 server certificate from the p12 file so that I can add it to my java trust store, the problem is that I'm not quite sure how to do this.

share|improve this question
add comment

1 Answer

Java's keystore management tool:

keytool -keystore server.p12 -storetype pkcs12 -list

keytool -keystore server.p12 -storetype pkcs12 -exportcert -alias 1 -file server.crt

The output file will contain the X.509 certificate in DER format – but not the private key.


OpenSSL:

openssl pkcs12 -in server.p12 -out server.pem -nodes

The output file will contain both the X.509 certificate and the associated private key, both in PEM (base64) format.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.