This document describes how to use curl with both custom and official CA SSL certificates.
You would need first to install curl , see http://curl.haxx.se/docs/install.html. Using a package manager such as yum, brew, ... for your platform should be the easiest though.
Example for Mac OS:
brew install curl --with-openssl
brew link curl --force
curl --version
Create a CA directory which will contain all your CA certificates in the .pem format (ex: /etc/pki/ssl/ca).
Note that this step is only necessary, if you don't already have your custom CA in pem format.
If you open a SSL protected webpage in the firefox browser:
- click on the lock on the left of the url
- Then "more information ..."/Security/"View certificate"/Details/"Export ..."/"X.509 Certificate (PEM)"
Export the .pem file in your CA directory
In you CA directory:
curl http://curl.haxx.se/ca/cacert.pem -o firefox.pem
In you CA directory:
cat *.pem > ca-all.pem
From now on, you should be able configure curl to use your merged CA:
curl --cacert /etc/pki/ssl/ca/ca-all.pem https://mycustomapi.com
You may prefer to update .curlrc by adding the line:
cacert /etc/pki/ssl/ca/ca-all.pem