开发者

changing SSL certificates to a different location

开发者 https://www.devze.com 2023-01-20 18:49 出处:网络
Currently we read from HTTPS using cURL. Everything works fine. We set up certficates in curl as follows:

Currently we read from HTTPS using cURL. Everything works fine.

We set up certficates in curl as follows:

curl_easy_setopt(curl,CURLOPT_SSLCERTTYPE,"PEM");
curl_easy_setopt(开发者_StackOverflowcurl,CURLOPT_SSLCERT,"/etc/ssl/certs/abc.cert.pem");

curl_easy_setopt(curl,CURLOPT_SSLKEYTYPE,"PEM");
curl_easy_setopt(curl,CURLOPT_SSLKEY,"/etc/ssl/certs/abc.key.pem");

Now we want to move these certificate files to a different directory. Even if I change the path in the commands above it does not work because I think the certificate path is hard coded as /etc/ssl in libcurl.

Based on googling I tried adding first,

curl_easy_setopt(curl, CURLOPT_CAPATH, "/MyDir/");

and then the four lines with the correct relative path. It didnt work.

How to change the path (the directory where the certificates are stored) into something I want. Example or explanation will be appreciated.

Thanks

James


No, there's no hardcoded paths for client certificates at all in libcurl, your theory is incorrect.

But your mixing of the CURLOPT_SSLCERT option (which is for client certificates) and the CURLOPT_CAPATH option (which is for CA certs) in the same question here, might imply that you've misunderstood what the options really are and do.

The capath/bundle has a hardcoded default within libcurl, but you can always set your own preferred one with one of the the CA* options.

0

精彩评论

暂无评论...
验证码 换一张
取 消