I am using curl to download data from a https site using public certificate files.
System information:
The command is,
curl -v "https://<ip:<port>" --cert "./cert.pem" --cacert "./cacert.pem" --cert-type PEM * About to connect() to kng.com port 443 (#0) * Trying 11.19.37.123... * Adding handle: conn: 0x8189e68 * Adding handle: send: 0 * Adding handle: recv: 0 * Curl_addHandleToPipeline: length: 1 * - Conn 0 (0x8189e68) send_pipe: 1, recv_pipe: 0 * Connected to fkng.com (11.19.37.123) port 443 (#0) * unable to set private key file: './cert.pem' type PEM * Closing connection 0 curl: (58) unable to set private key file: './cert.pem' type PEM
I have have given all the permission to the .pem
file, still curl is throwing an error.
After reading cURL documentation on the options you used, it looks like the private key of certificate is not in the same file. If it is in different file, you need to mention it using --key file and supply passphrase.
So, please make sure that either cert.pem has private key (along with the certificate) or supply it using --key option.
Also, this documentation mentions that Note that this option assumes a "certificate" file that is the private key and the private certificate concatenated!
How they are concatenated? It is quite easy. Put them one after another in the same file.
You can get more help on this here.
I believe this might help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With