标签:
Easy curl增加以下代码
/*curl_easy_setopt(ptCurlItem->curl, CURLOPT_CAPATH, "/etc/pki/tls/private");*/
curl_easy_setopt(ptCurlItem->curl, CURLOPT_SSLCERT, "ca.crt");
curl_easy_setopt(ptCurlItem->curl, CURLOPT_SSLCERTPASSWD, "changeit");
curl_easy_setopt(ptCurlItem->curl, CURLOPT_SSLCERTTYPE, "PEM");
注
1) 证书文件位置
ca.crt存放在user app可执行文件相同目录下,否则会出现文件打开失败
error 58, could not load PEM client certificate, OpenSSL error error:02001002:system library:fopen:No such file or directory, (no key found, wrong pass phrase, or wrong file format?)
2)需要使用自签名证书文件ca.crt作为客户端证书文件
附注:自签名证书文件制作命令
openssl genrsa -out ca.key 1024 ##生成证书私钥
openssl req -new -key ca.key -out ca.csr ##生成证书
openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt ##生成自签名证书
libcurl支持https SERVER对CLIENT认证
标签:
原文地址:http://www.cnblogs.com/flyfish163/p/5457218.html