Getting error in Curl - Peer certificate cannot be authenticated with known CA certificates

curl, openssl, ssl

Solution

By default CURL will generally verify the SSL certificate to see if its valid and issued by an accepted CA. To do this, curl uses a bundled set of CA certificates.

If you'd like to turn off curl's verification of the certificate, use the -k (or --insecure) option. Here's an example:

curl --noproxy -k \* -D - https://127.0.0.1:443/some-secure-endpoint

Problem

I am getting the below error while making ssl connection with self signed certificate. "Peer certificate cannot be authenticated with known CA certificates" It is working fine with CA signed certificate. I am setting the below using `curl_easy_setopt()`. ``` curl_easy_setopt(MyContext, CURLOPT_CAPATH, CA_CERTIFICATE_PATH) curl_easy_setopt(MyContext, CURLOPT_SSL_VERIFYPEER,TRUE); ``` The curl version: ``` libcurl-7.19.7-26 ``` Openssl version is: ``` 0_9_8u ``` Please let me know how to solve this issue.

Original source