1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_PROXY_CAINFO_BLOB
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_CAINFO (3)
9  - CURLOPT_CAINFO_BLOB (3)
10  - CURLOPT_CAPATH (3)
11  - CURLOPT_PROXY_CAINFO (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)
17Protocol:
18  - TLS
19TLS-backend:
20  - OpenSSL
21  - rustls
22  - Secure Transport
23  - Schannel
24---
25
26# NAME
27
28CURLOPT_PROXY_CAINFO_BLOB - proxy Certificate Authority (CA) bundle in PEM format
29
30# SYNOPSIS
31
32~~~c
33#include <curl/curl.h>
34
35CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_CAINFO_BLOB,
36                          struct curl_blob *stblob);
37~~~
38
39# DESCRIPTION
40
41This option is for connecting to an HTTPS proxy, not an HTTPS server.
42
43Pass a pointer to a curl_blob structure, which contains information (pointer
44and size) about a memory block with binary data of PEM encoded content holding
45one or more certificates to verify the HTTPS proxy with.
46
47If the blob is initialized with the flags member of struct curl_blob set to
48CURL_BLOB_COPY, the application does not have to keep the buffer around after
49setting this.
50
51If CURLOPT_PROXY_SSL_VERIFYPEER(3) is zero and you avoid verifying the
52server's certificate, CURLOPT_PROXY_CAINFO_BLOB(3) is not needed.
53
54This option overrides CURLOPT_PROXY_CAINFO(3).
55
56# DEFAULT
57
58NULL
59
60# EXAMPLE
61
62~~~c
63#include <string.h> /* for strlen */
64
65extern char *strpem; /* strpem must point to a PEM string */
66int main(void)
67{
68  CURL *curl = curl_easy_init();
69  if(curl) {
70    CURLcode res;
71    struct curl_blob blob;
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    blob.data = strpem;
76    blob.len = strlen(strpem);
77    blob.flags = CURL_BLOB_COPY;
78    curl_easy_setopt(curl, CURLOPT_PROXY_CAINFO_BLOB, &blob);
79    res = curl_easy_perform(curl);
80    curl_easy_cleanup(curl);
81  }
82}
83~~~
84
85# AVAILABILITY
86
87Added in 7.77.0.
88
89This option is supported by the rustls (since 7.82.0), OpenSSL, Secure
90Transport and Schannel backends.
91
92# RETURN VALUE
93
94Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
95CURLE_OUT_OF_MEMORY if there was insufficient heap space.
96