How do I convert my Java KeyStore to a PEM file suitable for cURL?
Up to Table of ContentsThis FAQ applies to: 5.3
Use KeyToolGUI to export your certificate in pkcs12 format (right-click on cert, export, private key, pkcs12). We'll assume this file is called "stephen.p12".
To get a pem file with just your private key:
openssl pkcs12 -in stephen.p12 -out stephen-privatekey.pem -nocerts
To get a pem file with just your cert:
openssl pkcs12 -in stephen.p12 -out stephen-cert.pem -clcerts -nokeys
Then you can use:
curl --cert stephen-cert.pem --key stephen-privatekey.pem -T file-to-upload https://target.com/blah
However, you can do it all in one file:
openssl pkcs12 -in stephen.p12 -out stephen.pem -clcerts
and:
curl --cert stephen.pem -T file-to-upload https://target.com/blah
