1CURLOPT_CAPATH(3)                   libcurl                  CURLOPT_CAPATH(3)
2
3
4

NAME

6       CURLOPT_CAPATH - directory holding CA certificates
7

SYNOPSIS

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

DESCRIPTION

14       Pass  a  char  * to a null-terminated string naming a directory holding
15       multiple CA certificates to verify the peer with. If libcurl  is  built
16       against  OpenSSL,  the certificate directory must be prepared using the
17       OpenSSL c_rehash utility.  This makes sense only when used in  combina‐
18       tion with the CURLOPT_SSL_VERIFYPEER(3) option.
19
20       The  CURLOPT_CAPATH(3) function apparently does not work in Windows due
21       to some limitation in OpenSSL.
22
23       The application does not have to keep the string around  after  setting
24       this option.
25
26       The default value for this can be figured out with CURLINFO_CAPATH(3).
27

DEFAULT

29       A default path detected at build time.
30

PROTOCOLS

32       All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
33

EXAMPLE

35       CURL *curl = curl_easy_init();
36       if(curl) {
37         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
38         curl_easy_setopt(curl, CURLOPT_CAPATH, "/etc/cert-dir");
39         ret = curl_easy_perform(curl);
40         curl_easy_cleanup(curl);
41       }
42

AVAILABILITY

44       This  option  is  supported  by  the OpenSSL, GnuTLS and mbedTLS (since
45       7.56.0) backends. The NSS backend provides the option only for backward
46       compatibility.
47

RETURN VALUE

49       CURLE_OK if supported; or an error such as:
50
51       CURLE_NOT_BUILT_IN - Not supported by the SSL backend
52
53       CURLE_UNKNOWN_OPTION
54
55       CURLE_OUT_OF_MEMORY
56

SEE ALSO

58       CURLOPT_CAINFO(3),     CURLOPT_STDERR(3),     CURLOPT_DEBUGFUNCTION(3),
59       CURLINFO_CAPATH(3),
60
61
62
63ibcurl 8.2.1                    April 26, 2023               CURLOPT_CAPATH(3)
Impressum