Getting (58) unable to use client certificate (no key found or wrong pass phrase?) from curl

Adding a pass phrase to my private key solved my problem.

I used the following command to add the passphrase:

ssh-keygen -p -f mykey.key

Before I could run that command successfully, I needed to change the permissions on the key file. 777 is not restrictive enough, and ssh-keygen would not touch it. Changing the permissions to 600 fixed that.

chmod 600 mykey.key

After adding the passphrase, I recreated the .pem file. Now I can successfully make curl calls with it using this command:

curl -X GET --cert mycertandkey.pem:mypassphrase -H 'Accept-Encoding: gzip,deflate' -H 'Content-Type: application/json' https://api.URL.com