1CURLOPT_CAINFO(3) curl_easy_setopt options CURLOPT_CAINFO(3)
2
3
4
6 CURLOPT_CAINFO - path to Certificate Authority (CA) bundle
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CAINFO, char *path);
12
14 Pass a char * to a zero terminated string naming a file holding one or
15 more certificates to verify the peer with.
16
17 If CURLOPT_SSL_VERIFYPEER(3) is zero and you avoid verifying the
18 server's certificate, CURLOPT_CAINFO(3) need not even indicate an
19 accessible file.
20
21 This option is by default set to the system path where libcurl's cacert
22 bundle is assumed to be stored, as established at build time.
23
24 If curl is built against the NSS SSL library, the NSS PEM PKCS#11 mod‐
25 ule (libnsspem.so) needs to be available for this option to work prop‐
26 erly. Starting with curl-7.55.0, if both CURLOPT_CAINFO(3) and CUR‐
27 LOPT_CAPATH(3) are unset, NSS-linked libcurl tries to load libnss‐
28 ckbi.so, which contains a more comprehensive set of trust information
29 than supported by nss-pem, because libnssckbi.so also includes informa‐
30 tion about distrusted certificates.
31
32 (iOS and macOS only) If curl is built against Secure Transport, then
33 this option is supported for backward compatibility with other SSL
34 engines, but it should not be set. If the option is not set, then curl
35 will use the certificates in the system and user Keychain to verify the
36 peer, which is the preferred method of verifying the peer's certificate
37 chain.
38
39 (Schannel only) This option is supported for Schannel in Windows 7 or
40 later with libcurl 7.60 or later. This option is supported for backward
41 compatibility with other SSL engines; instead it is recommended to use
42 Windows' store of root certificates (the default for Schannel).
43
44 The application does not have to keep the string around after setting
45 this option.
46
48 Built-in system specific
49
51 All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
52
54 CURL *curl = curl_easy_init();
55 if(curl) {
56 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
57 curl_easy_setopt(curl, CURLOPT_CAINFO, "/etc/certs/cabundle.pem");
58 ret = curl_easy_perform(curl);
59 curl_easy_cleanup(curl);
60 }
61
63 For SSL engines that don't support certificate files the CURLOPT_CAINFO
64 option is ignored. Refer to https://curl.haxx.se/docs/ssl-compared.html
65
67 Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if
68 not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space.
69
71 CURLOPT_CAPATH(3), CURLOPT_SSL_VERIFYPEER(3), CURLOPT_SSL_VERIFY‐
72 HOST(3),
73
74
75
76libcurl 7.64.0 January 29, 2019 CURLOPT_CAINFO(3)