1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_PROXY_CAINFO
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_CAINFO (3)
9  - CURLOPT_CAINFO_BLOB (3)
10  - CURLOPT_CAPATH (3)
11  - CURLOPT_PROXY_CAINFO_BLOB (3)
12  - CURLOPT_PROXY_CAPATH (3)
13  - CURLOPT_PROXY_SSL_VERIFYHOST (3)
14  - CURLOPT_PROXY_SSL_VERIFYPEER (3)
15  - CURLOPT_SSL_VERIFYHOST (3)
16  - CURLOPT_SSL_VERIFYPEER (3)
17---
18
19# NAME
20
21CURLOPT_PROXY_CAINFO - path to proxy Certificate Authority (CA) bundle
22
23# SYNOPSIS
24
25~~~c
26#include <curl/curl.h>
27
28CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_CAINFO, char *path);
29~~~
30
31# DESCRIPTION
32
33This option is for connecting to an HTTPS proxy, not an HTTPS server.
34
35Pass a char pointer to a null-terminated string naming a file holding one or
36more certificates to verify the HTTPS proxy with.
37
38If CURLOPT_PROXY_SSL_VERIFYPEER(3) is zero and you avoid verifying the
39server's certificate, CURLOPT_PROXY_CAINFO(3) need not even indicate an
40accessible file.
41
42This option is by default set to the system path where libcurl's CA
43certificate bundle is assumed to be stored, as established at build time.
44
45(iOS and macOS only) If curl is built against Secure Transport, then this
46option is supported for backward compatibility with other SSL engines, but it
47should not be set. If the option is not set, then curl uses the certificates
48in the system and user Keychain to verify the peer, which is the preferred
49method of verifying the peer's certificate chain.
50
51The application does not have to keep the string around after setting this
52option.
53
54The default value for this can be figured out with CURLINFO_CAINFO(3).
55
56# DEFAULT
57
58Built-in system specific
59
60# PROTOCOLS
61
62Used with HTTPS proxy
63
64# EXAMPLE
65
66~~~c
67int main(void)
68{
69  CURL *curl = curl_easy_init();
70  if(curl) {
71    CURLcode res;
72    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
73    /* using an HTTPS proxy */
74    curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost:443");
75    curl_easy_setopt(curl, CURLOPT_PROXY_CAINFO, "/etc/certs/cabundle.pem");
76    res = curl_easy_perform(curl);
77    curl_easy_cleanup(curl);
78  }
79}
80~~~
81
82# AVAILABILITY
83
84Added in 7.52.0
85
86For TLS backends that do not support certificate files, the
87CURLOPT_PROXY_CAINFO(3) option is ignored. Refer to
88https://curl.se/docs/ssl-compared.html
89
90# RETURN VALUE
91
92Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
93CURLE_OUT_OF_MEMORY if there was insufficient heap space.
94