Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/136.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用.CER和curl\u easy\u setopt 我想在C++中使用.CURL API的.CEL文件。我正在探索一些选项,如中所述。 下面是我试过的代码片段 curl_easy_setopt(curl1, CURLOPT_CUSTOMREQUEST, "GET"); curl_easy_setopt(curl1, CURLOPT_URL, "https://test.com/?AppID=DB"); curl_easy_setopt(curl1, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(curl1, CURLOPT_DEFAULT_PROTOCOL, "https"); struct curl_slist *headers = NULL; curl_easy_setopt(curl1, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl1, CURLOPT_SSLCERTTYPE, "CER"); curl_easy_setopt(curl1, CURLOPT_SSLCERT, "/cacert.cer"); res = curl_easy_perform(curl1);_C++_Ssl_Libcurl - Fatal编程技术网

如何使用.CER和curl\u easy\u setopt 我想在C++中使用.CURL API的.CEL文件。我正在探索一些选项,如中所述。 下面是我试过的代码片段 curl_easy_setopt(curl1, CURLOPT_CUSTOMREQUEST, "GET"); curl_easy_setopt(curl1, CURLOPT_URL, "https://test.com/?AppID=DB"); curl_easy_setopt(curl1, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(curl1, CURLOPT_DEFAULT_PROTOCOL, "https"); struct curl_slist *headers = NULL; curl_easy_setopt(curl1, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl1, CURLOPT_SSLCERTTYPE, "CER"); curl_easy_setopt(curl1, CURLOPT_SSLCERT, "/cacert.cer"); res = curl_easy_perform(curl1);

如何使用.CER和curl\u easy\u setopt 我想在C++中使用.CURL API的.CEL文件。我正在探索一些选项,如中所述。 下面是我试过的代码片段 curl_easy_setopt(curl1, CURLOPT_CUSTOMREQUEST, "GET"); curl_easy_setopt(curl1, CURLOPT_URL, "https://test.com/?AppID=DB"); curl_easy_setopt(curl1, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(curl1, CURLOPT_DEFAULT_PROTOCOL, "https"); struct curl_slist *headers = NULL; curl_easy_setopt(curl1, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl1, CURLOPT_SSLCERTTYPE, "CER"); curl_easy_setopt(curl1, CURLOPT_SSLCERT, "/cacert.cer"); res = curl_easy_perform(curl1);,c++,ssl,libcurl,C++,Ssl,Libcurl,但在这里我得到了错误的说法 失败:SSL对等证书或SSH远程密钥不正常 提前感谢您的帮助。设置客户端证书,它应该与CURLOPT\u SSLKEY结合使用 要设置服务器(CA)证书,请使用 尽管它只接受PEM格式 您可以使用OpenSSL等将DER转换为PEM openssl x509 -inform der -in cacert.cer -out cacert.pem

但在这里我得到了错误的说法 失败:SSL对等证书或SSH远程密钥不正常

提前感谢您的帮助。

设置客户端证书,它应该与
CURLOPT\u SSLKEY
结合使用

要设置服务器(CA)证书,请使用

尽管它只接受
PEM
格式

您可以使用OpenSSL等将DER转换为PEM

openssl x509 -inform der -in cacert.cer -out cacert.pem