if (curl)
{
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_easy_setopt(curl, CURLOPT_CAINFO, certificate_file_path);
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curlErrorBuffer);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "https://ap....");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist* headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, ss.str().c_str());
...
}
我尝试了以下方法:
curl-ca-bundle.crt
curl-ca-bundle-my-site.crt
curl-ca-bundle.pem
curl-ca-bundle-my-site.pem
ca-mysite.crt
ca-mysite.pem
但是:CURLE_SSL_CACERT_BADFILE...
路径:/Users/user/Documents/Test test/CA/ca-any-version.pem/crt