CURLOPT_PROXY_ISSUERCERT_BLOB.md (2716B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_PROXY_ISSUERCERT_BLOB 5 Section: 3 6 Source: libcurl 7 See-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 Protocol: 14 - TLS 15 TLS-backend: 16 - OpenSSL 17 Added-in: 7.71.0 18 --- 19 20 # NAME 21 22 CURLOPT_PROXY_ISSUERCERT_BLOB - proxy issuer SSL certificate from memory blob 23 24 # SYNOPSIS 25 26 ~~~c 27 #include <curl/curl.h> 28 29 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_ISSUERCERT_BLOB, 30 struct curl_blob *blob); 31 ~~~ 32 33 # DESCRIPTION 34 35 Pass a pointer to a curl_blob struct, which contains information (pointer and 36 size) about a memory block with binary data of a CA certificate in PEM 37 format. If the option is set, an additional check against the peer certificate 38 is performed to verify the issuer of the HTTPS proxy is indeed the one 39 associated with the certificate provided by the option. This additional check 40 is useful in multi-level PKI where one needs to enforce that the peer 41 certificate is from a specific branch of the tree. 42 43 This option should be used in combination with the 44 CURLOPT_PROXY_SSL_VERIFYPEER(3) option. Otherwise, the result of the 45 check is not considered as failure. 46 47 A specific error code (CURLE_SSL_ISSUER_ERROR) is defined with the option, 48 which is returned if the setup of the SSL/TLS session has failed due to a 49 mismatch with the issuer of peer certificate 50 (CURLOPT_PROXY_SSL_VERIFYPEER(3) has to be set too for the check to fail). 51 52 If the blob is initialized with the flags member of struct curl_blob set to 53 CURL_BLOB_COPY, the application does not have to keep the buffer around after 54 setting this. 55 56 This option is an alternative to CURLOPT_PROXY_ISSUERCERT(3) which 57 instead expects a filename as input. 58 59 # DEFAULT 60 61 NULL 62 63 # %PROTOCOLS% 64 65 # EXAMPLE 66 67 ~~~c 68 69 extern char *certificateData; /* point to the data */ 70 size_t filesize; /* size of the data */ 71 72 int main(void) 73 { 74 CURL *curl = curl_easy_init(); 75 if(curl) { 76 CURLcode res; 77 struct curl_blob blob; 78 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 79 /* using an HTTPS proxy */ 80 curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost:443"); 81 blob.data = certificateData; 82 blob.len = filesize; 83 blob.flags = CURL_BLOB_COPY; 84 curl_easy_setopt(curl, CURLOPT_PROXY_ISSUERCERT_BLOB, &blob); 85 res = curl_easy_perform(curl); 86 curl_easy_cleanup(curl); 87 } 88 } 89 ~~~ 90 91 # %AVAILABILITY% 92 93 # RETURN VALUE 94 95 curl_easy_setopt(3) returns a CURLcode indicating success or error. 96 97 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 98 libcurl-errors(3).