我正在使用 libCurl 从远程服务器下载文件。该远程服务器需要客户端证书。以下是我尝试过的选项:
curl_easy_setopt(pCurl, CURLOPT_URL, url);
curl_easy_setopt(pCurl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_easy_setopt(pCurl, CURLOPT_SSL_VERIFYHOST, 2);
curl_easy_setopt(pCurl, CURLOPT_VERBOSE, 1);
curl_easy_setopt(pCurl, CURLOPT_CERTINFO, 1L);
curl_easy_setopt(pCurl, CURLOPT_SSL_VERIFYPEER, 1);
//the following two lines specify the path to my valid client certificate
curl_easy_setopt(pCurl, CURLOPT_CAINFO, "c:\\Delta.p12");
curl_easy_setopt(pCurl, CURLOPT_CAPATH, "c:\\Delta.p12");
当我发出 Https 请求时,我收到一个 403: Forbidden 错误,表示我没有指定所需的凭据。该证书通过浏览器工作,所以我知道该证书是有效的。
感谢您对完成这项工作的任何帮助。谢谢!