quickjs-tart

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

CURLOPT_ISSUERCERT_BLOB.md (2460B)


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