1CURLOPT_CAINFO(3)          curl_easy_setopt options          CURLOPT_CAINFO(3)
2
3
4

NAME

6       CURLOPT_CAINFO - path to Certificate Authority (CA) bundle
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CAINFO, char *path);
12

DESCRIPTION

14       Pass  a char * to a null-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 ac‐
19       cessible 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)  When  curl uses Secure Transport this option is sup‐
33       ported. If the option is not set, then curl will use  the  certificates
34       in the system and user Keychain to verify the peer.
35
36       (Schannel)  This option is supported for Schannel in Windows 7 or later
37       but we recommend not using it until Windows 8  since  it  works  better
38       starting  then.   If the option is not set, then curl will use the cer‐
39       tificates in the Windows' store of root certificates (the  default  for
40       Schannel).
41
42       The  application  does not have to keep the string around after setting
43       this option.
44

DEFAULT

46       Built-in system specific. When curl is built with Secure  Transport  or
47       Schannel, this option is not set by default.
48

PROTOCOLS

50       All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
51

EXAMPLE

53       CURL *curl = curl_easy_init();
54       if(curl) {
55         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
56         curl_easy_setopt(curl, CURLOPT_CAINFO, "/etc/certs/cabundle.pem");
57         ret = curl_easy_perform(curl);
58         curl_easy_cleanup(curl);
59       }
60

AVAILABILITY

62       For  the  SSL  engines  that  do not support certificate files the CUR‐
63       LOPT_CAINFO option is ignored. Schannel support added in libcurl 7.60.
64

RETURN VALUE

66       Returns CURLE_OK if the option is  supported,  CURLE_UNKNOWN_OPTION  if
67       not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space.
68

SEE ALSO

70       CURLOPT_CAINFO_BLOB(3),  CURLOPT_CAPATH(3),  CURLOPT_SSL_VERIFYPEER(3),
71       CURLOPT_SSL_VERIFYHOST(3),
72
73
74
75libcurl 7.82.0                 November 26, 2021             CURLOPT_CAINFO(3)
Impressum