Easy Curl Add the following code
/*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");
Note
1) certificate file location
CA.CRT is stored in the same directory as the user app executable file, otherwise the file open failure will occur.
Error, could not load PEM client certificate, OpenSSL error Error:02001002:system library:fopen:No such file or Directo Ry, (no key found, wrong pass phrase, or wrong file format?)
2) need to use self-signed certificate file CA.CRT as client certificate file
Note: Self-signed certificate file making commands
OpenSSL genrsa-out Ca.key # #生成证书私钥
OpenSSL req-new-key ca.key-out CA.CSR # #生成证书
OpenSSL x509-req-days 365-in ca.csr-signkey ca.key-out ca.crt # #生成自签名证书
Libcurl support for HTTPS server-to-client authentication