将SSL证书更改为其他位置 [英] changing SSL certificates to a different location
问题描述
目前我们使用cURL从HTTPS读取。一切工作正常。
Currently we read from HTTPS using cURL. Everything works fine.
我们在curl中设置certficates如下:
We set up certficates in curl as follows:
curl_easy_setopt(curl,CURLOPT_SSLCERTTYPE,"PEM");
curl_easy_setopt(curl,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");
现在我们要将这些证书文件移动到不同的目录。即使我改变上面的命令的路径,它不工作,因为我认为证书路径硬编码为/ etc / ssl在libcurl。
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.
基于googling我尝试添加第一个,
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.
感谢
James
推荐答案
不,libcurl中没有客户端证书的硬编码路径,你的理论是不正确的。
No, there's no hardcoded paths for client certificates at all in libcurl, your theory is incorrect.
混合 CURLOPT_SSLCERT 选项(用于客户端证书)和 CURLOPT_CAPATH 选项(这是针对CA证书)在同一个问题,可能意味着你'
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.
capath / bundle在libcurl中有一个硬编码的默认值,但你总是可以设置自己喜欢的一个CA *选项。
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.
这篇关于将SSL证书更改为其他位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!