CURLOPT_PROXY_SSLCERT_BLOB.md (2174B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_PROXY_SSLCERT_BLOB 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_PROXY_SSLCERT (3) 9 - CURLOPT_PROXY_SSLCERTTYPE (3) 10 - CURLOPT_PROXY_SSLKEY (3) 11 - CURLOPT_SSLCERT_BLOB (3) 12 Protocol: 13 - TLS 14 TLS-backend: 15 - OpenSSL 16 - Schannel 17 Added-in: 7.71.0 18 --- 19 20 # NAME 21 22 CURLOPT_PROXY_SSLCERT_BLOB - SSL proxy client 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_SSLCERT_BLOB, 30 struct curl_blob *blob); 31 ~~~ 32 33 # DESCRIPTION 34 35 Pass a pointer to a curl_blob structure, which contains information (pointer 36 and size) about a memory block with binary data of the certificate used to 37 connect to the HTTPS proxy. The format must be "P12" on Schannel. The format 38 must be "P12" or "PEM" on OpenSSL. The string "P12" or "PEM" must be specified 39 with CURLOPT_PROXY_SSLCERTTYPE(3). 40 41 If the blob is initialized with the flags member of struct curl_blob set to 42 CURL_BLOB_COPY, the application does not have to keep the buffer around after 43 setting this. 44 45 This option is an alternative to CURLOPT_PROXY_SSLCERT(3) which instead 46 expects a filename as input. 47 48 # DEFAULT 49 50 NULL 51 52 # %PROTOCOLS% 53 54 # EXAMPLE 55 56 ~~~c 57 58 extern char *certificateData; /* point to data */ 59 extern size_t filesize; /* size of the data */ 60 61 int main(void) 62 { 63 CURL *curl = curl_easy_init(); 64 if(curl) { 65 CURLcode res; 66 struct curl_blob blob; 67 blob.data = certificateData; 68 blob.len = filesize; 69 blob.flags = CURL_BLOB_COPY; 70 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 71 curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy"); 72 curl_easy_setopt(curl, CURLOPT_PROXY_SSLKEY, "key.pem"); 73 curl_easy_setopt(curl, CURLOPT_PROXY_KEYPASSWD, "s3cret"); 74 curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERT_BLOB, &blob); 75 res = curl_easy_perform(curl); 76 curl_easy_cleanup(curl); 77 } 78 } 79 ~~~ 80 81 # %AVAILABILITY% 82 83 # RETURN VALUE 84 85 curl_easy_setopt(3) returns a CURLcode indicating success or error. 86 87 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 88 libcurl-errors(3).