Libcurl support for HTTPS server-to-client authentication

Source: Internet
Author: User


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.