quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CURLOPT_PROXY_SSLKEY_BLOB.md (2124B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_PROXY_SSLKEY_BLOB
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLOPT_SSLKEY (3)
      9   - CURLOPT_SSLKEYTYPE (3)
     10   - CURLOPT_SSLKEY_BLOB (3)
     11 Protocol:
     12   - TLS
     13 TLS-backend:
     14   - OpenSSL
     15 Added-in: 7.71.0
     16 ---
     17 
     18 # NAME
     19 
     20 CURLOPT_PROXY_SSLKEY_BLOB - private key for proxy cert from memory blob
     21 
     22 # SYNOPSIS
     23 
     24 ~~~c
     25 #include <curl/curl.h>
     26 
     27 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSLKEY_BLOB,
     28                           struct curl_blob *blob);
     29 ~~~
     30 
     31 # DESCRIPTION
     32 
     33 Pass a pointer to a curl_blob structure that contains information (pointer and
     34 size) about the private key for connecting to the HTTPS proxy. Compatible with
     35 OpenSSL. The format (like "PEM") must be specified with
     36 CURLOPT_PROXY_SSLKEYTYPE(3).
     37 
     38 If the blob is initialized with the flags member of struct curl_blob set to
     39 CURL_BLOB_COPY, the application does not have to keep the buffer around after
     40 setting this.
     41 
     42 # DEFAULT
     43 
     44 NULL
     45 
     46 # %PROTOCOLS%
     47 
     48 # EXAMPLE
     49 
     50 ~~~c
     51 
     52 extern char *certificateData; /* point to data */
     53 extern size_t filesize; /* size of data */
     54 
     55 extern char *privateKeyData; /* point to data */
     56 extern size_t privateKeySize; /* size */
     57 
     58 int main(void)
     59 {
     60   CURL *curl = curl_easy_init();
     61   if(curl) {
     62     CURLcode res;
     63     struct curl_blob blob;
     64     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
     65     curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
     66     blob.data = certificateData;
     67     blob.len = filesize;
     68     blob.flags = CURL_BLOB_COPY;
     69     curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERT_BLOB, &blob);
     70     curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERTTYPE, "PEM");
     71 
     72     blob.data = privateKeyData;
     73     blob.len = privateKeySize;
     74     curl_easy_setopt(curl, CURLOPT_PROXY_SSLKEY_BLOB, &blob);
     75     curl_easy_setopt(curl, CURLOPT_PROXY_KEYPASSWD, "s3cret");
     76     res = curl_easy_perform(curl);
     77     curl_easy_cleanup(curl);
     78   }
     79 }
     80 ~~~
     81 
     82 # %AVAILABILITY%
     83 
     84 # RETURN VALUE
     85 
     86 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     87 
     88 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     89 libcurl-errors(3).