我有一个托管在 Azure 上的 Web 服务,它通过自签名证书在 SSL 下得到保护。
我正在尝试使用以下代码连接到它
CURL *curl;
CURLcode res;
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, "https://XXXXXXXX.cloudapp.net/XXXXXX.svc/getFilms");
curl_easy_setopt(curl, CURLOPT_CAPATH, "C:\\Users\\Jordan\\Desktop\\Jordan-8.pem");
curl_easy_setopt(curl, CURLOPT_CAINFO, "C:\\Users\\Jordan\\Desktop\\Jordan-8.pem");
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_perform(curl);
然后我收到以下错误
* Connected to XXXXXXXXX.cloudapp.net
* successfully set certificate verify locations:
* CAfile: C:\Users\Jordan\Desktop\Jordan-8.pem
CApath: C:\Users\Jordan\Desktop\Jordan-8.pem
* SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
* Closing connection #0
* Peer certificate cannot be authenticated with known CA certificates
有什么我做错了吗?我已经在网上研究了很长一段时间,但一无所获。