1CURLOPT_SSLCERT_BLOB(3) curl_easy_setopt options CURLOPT_SSLCERT_BLOB(3)
2
3
4
6 CURLOPT_SSLCERT_BLOB - SSL client certificate from memory blob
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLCERT_BLOB,
12 struct curl_blob *stblob);
13
15 Pass a pointer to a curl_blob structure, which contains (pointer and
16 size) a client certificate. The format must be "P12" on Secure Trans‐
17 port or Schannel. The format must be "P12" or "PEM" on OpenSSL. The
18 format must be "DER" or "PEM" on mbedTLS. The format must be specified
19 with CURLOPT_SSLCERTTYPE(3).
20
21 If the blob is initialized with the flags member of struct curl_blob
22 set to CURL_BLOB_COPY, the application does not have to keep the buffer
23 around after setting this.
24
25 This option is an alternative to CURLOPT_SSLCERT(3) which instead ex‐
26 pects a file name as input.
27
29 NULL
30
32 All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
33
35 CURL *curl = curl_easy_init();
36 if(curl) {
37 struct curl_blob stblob;
38 stblob.data = certificateData;
39 stblob.len = filesize;
40 stblob.flags = CURL_BLOB_COPY;
41 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
42 curl_easy_setopt(curl, CURLOPT_SSLCERT_BLOB, &stblob);
43 curl_easy_setopt(curl, CURLOPT_SSLCERTTYPE, "P12");
44 curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
45 ret = curl_easy_perform(curl);
46 curl_easy_cleanup(curl);
47 }
48
50 Added in 7.71.0. This option is supported by the OpenSSL, Secure Trans‐
51 port, Schannel and mbedTLS (since 7.78.0) backends.
52
54 Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or
55 CURLE_OUT_OF_MEMORY if there was insufficient heap space.
56
58 CURLOPT_SSLCERTTYPE(3), CURLOPT_SSLKEY(3),
59
60
61
62libcurl 8.0.1 January 02, 2023 CURLOPT_SSLCERT_BLOB(3)