• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_PROXY_ISSUERCERT_BLOB
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_ISSUERCERT_BLOB (3)
9  - CURLOPT_PROXY_SSL_VERIFYHOST (3)
10  - CURLOPT_PROXY_SSL_VERIFYPEER (3)
11  - CURLOPT_SSL_VERIFYHOST (3)
12  - CURLOPT_SSL_VERIFYPEER (3)
13---
14
15# NAME
16
17CURLOPT_PROXY_ISSUERCERT_BLOB - proxy issuer SSL certificate from memory blob
18
19# SYNOPSIS
20
21~~~c
22#include <curl/curl.h>
23
24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_ISSUERCERT_BLOB,
25                          struct curl_blob *blob);
26~~~
27
28# DESCRIPTION
29
30Pass a pointer to a curl_blob struct, which contains information (pointer and
31size) about a memory block with binary data of a CA certificate in PEM
32format. If the option is set, an additional check against the peer certificate
33is performed to verify the issuer of the HTTPS proxy is indeed the one
34associated with the certificate provided by the option. This additional check
35is useful in multi-level PKI where one needs to enforce that the peer
36certificate is from a specific branch of the tree.
37
38This option should be used in combination with the
39CURLOPT_PROXY_SSL_VERIFYPEER(3) option. Otherwise, the result of the
40check is not considered as failure.
41
42A specific error code (CURLE_SSL_ISSUER_ERROR) is defined with the option,
43which is returned if the setup of the SSL/TLS session has failed due to a
44mismatch with the issuer of peer certificate
45(CURLOPT_PROXY_SSL_VERIFYPEER(3) has to be set too for the check to fail).
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
51This option is an alternative to CURLOPT_PROXY_ISSUERCERT(3) which
52instead expects a filename as input.
53
54# DEFAULT
55
56NULL
57
58# PROTOCOLS
59
60All TLS-based protocols
61
62# EXAMPLE
63
64~~~c
65
66extern char *certificateData; /* point to the data */
67size_t filesize; /* size of the data */
68
69int main(void)
70{
71  CURL *curl = curl_easy_init();
72  if(curl) {
73    CURLcode res;
74    struct curl_blob blob;
75    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
76    /* using an HTTPS proxy */
77    curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost:443");
78    blob.data = certificateData;
79    blob.len = filesize;
80    blob.flags = CURL_BLOB_COPY;
81    curl_easy_setopt(curl, CURLOPT_PROXY_ISSUERCERT_BLOB, &blob);
82    res = curl_easy_perform(curl);
83    curl_easy_cleanup(curl);
84  }
85}
86~~~
87
88# AVAILABILITY
89
90Added in 7.71.0. This option is supported by the OpenSSL 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