Using curl with certificate that has no password

curl, ssl

Solution

You can make use of the `--pass` switch:

--pass <phrase>                  (SSL/SSH) Passphrase for the private key

To pass an empty passphrase you can use:

--pass ''

Problem

I have my own CA and client certificate that I have been using successfully with cURL using the normal format: ``` curl --cacert /etc/myca.crt --cert /etc/myclient.pem:mypassword --cert-type PEM --get https://myhost.com ``` Now, for reasons outside the scope of this question, I have the same client certificate but the password has been removed using openssl. Using openssl I have verified that the new certificate is correct and I can use it to make SSL connections using applications other than cURL, but I cannot get it to work with cURL. If I don't enter a password: ``` curl --cacert /etc/myca.crt --cert /etc/myclient.pem --cert-type PEM --get https://example.com ``` I get an error saying "curl: (58) unable to use client certificate (no key found or wrong pass phrase?)" I have also tried: ``` curl --cacert /etc/myca.crt --cert /etc/myclient.pem: --cert-type PEM --get https://example.com ``` but I get the same error. I am making the call to cURL from within a Perl script, so I need to find a way that will not prompt me for the password. I am using cURL 7.15.5 on RHEL 5. Thank you.

Original source