Personal tools
You are here: Home GRIA Documentation Documentation 5.3 FAQs How do I convert my Java KeyStore to a PEM file suitable for cURL?

How do I convert my Java KeyStore to a PEM file suitable for cURL?

Up to Table of Contents

This 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