1CURLOPT_CAPATH(3) curl_easy_setopt options CURLOPT_CAPATH(3)
2
3
4
6 CURLOPT_CAPATH - specify directory holding CA certificates
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CAPATH, char *capath);
12
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
27 NULL
28
30 All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
31
33 CURL *curl = curl_easy_init();
34 if(curl) {
35 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
36 curl_easy_setopt(curl, CURLOPT_CAPATH, "/etc/cert-dir");
37 ret = curl_easy_perform(curl);
38 curl_easy_cleanup(curl);
39 }
40
42 This option is supported by the OpenSSL, GnuTLS and mbedTLS (since
43 7.56.0) backends. The NSS backend provides the option only for backward
44 compatibility.
45
47 CURLE_OK if supported; or an error such as:
48
49 CURLE_NOT_BUILT_IN - Not supported by the SSL backend
50
51 CURLE_UNKNOWN_OPTION
52
53 CURLE_OUT_OF_MEMORY
54
56 CURLOPT_CAINFO(3), CURLOPT_STDERR(3), CURLOPT_DEBUGFUNCTION(3),
57
58
59
60libcurl 7.71.1 June 25, 2020 CURLOPT_CAPATH(3)