1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_CAINFO_BLOB 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_CAINFO (3) 9 - CURLOPT_CAPATH (3) 10 - CURLOPT_SSL_VERIFYHOST (3) 11 - CURLOPT_SSL_VERIFYPEER (3) 12--- 13 14# NAME 15 16CURLOPT_CAINFO_BLOB - Certificate Authority (CA) bundle in PEM format 17 18# SYNOPSIS 19 20~~~c 21#include <curl/curl.h> 22 23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CAINFO_BLOB, 24 struct curl_blob *stblob); 25~~~ 26 27# DESCRIPTION 28 29Pass a pointer to a curl_blob structure, which contains information (pointer 30and size) about a memory block with binary data of PEM encoded content holding 31one or more certificates to verify the HTTPS server with. 32 33If the blob is initialized with the flags member of struct curl_blob set to 34CURL_BLOB_COPY, the application does not have to keep the buffer around after 35setting this. 36 37If CURLOPT_SSL_VERIFYPEER(3) is zero and you avoid verifying the 38server's certificate, CURLOPT_CAINFO_BLOB(3) is not needed. 39 40This option overrides CURLOPT_CAINFO(3). 41 42# DEFAULT 43 44NULL 45 46# PROTOCOLS 47 48All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. 49 50# EXAMPLE 51 52~~~c 53#include <string.h> 54 55int main(void) 56{ 57 char *strpem; /* strpem must point to a PEM string */ 58 CURL *curl = curl_easy_init(); 59 if(curl) { 60 CURLcode res; 61 struct curl_blob blob; 62 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 63 blob.data = strpem; 64 blob.len = strlen(strpem); 65 blob.flags = CURL_BLOB_COPY; 66 curl_easy_setopt(curl, CURLOPT_CAINFO_BLOB, &blob); 67 res = curl_easy_perform(curl); 68 curl_easy_cleanup(curl); 69 } 70} 71~~~ 72 73# AVAILABILITY 74 75Added in 7.77.0. 76 77This option is supported by the BearSSL (since 7.79.0), mbedTLS (since 787.81.0), rustls (since 7.82.0), wolfSSL (since 8.2.0), OpenSSL, Secure 79Transport and Schannel backends. 80 81# RETURN VALUE 82 83Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or 84CURLE_OUT_OF_MEMORY if there was insufficient heap space. 85