1CURLOPT_SSLKEY_BLOB(3) libcurl CURLOPT_SSLKEY_BLOB(3)
2
3
4
6 CURLOPT_SSLKEY_BLOB - private key for client cert from memory blob
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLKEY_BLOB,
12 struct curl_blob *blob);
13
15 Pass a pointer to a curl_blob structure, which contains information
16 (pointer and size) for a private key. Compatible with OpenSSL. The for‐
17 mat (like "PEM") must be specified with CURLOPT_SSLKEYTYPE(3).
18
19 If the blob is initialized with the flags member of struct curl_blob
20 set to CURL_BLOB_COPY, the application does not have to keep the buffer
21 around after setting this.
22
23 This option is an alternative to CURLOPT_SSLKEY(3) which instead ex‐
24 pects a file name as input.
25
27 NULL
28
30 All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
31
33 CURL *curl = curl_easy_init();
34 if(curl) {
35 struct curl_blob blob;
36 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
37 blob.data = certificateData;
38 blob.len = filesize;
39 blob.flags = CURL_BLOB_COPY;
40 curl_easy_setopt(curl, CURLOPT_SSLCERT_BLOB, &blob);
41 curl_easy_setopt(curl, CURLOPT_SSLCERTTYPE, "PEM");
42
43 blob.data = privateKeyData;
44 blob.len = privateKeySize;
45 curl_easy_setopt(curl, CURLOPT_SSLKEY_BLOB, &blob);
46 curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
47 curl_easy_setopt(curl, CURLOPT_SSLKEYTYPE, "PEM");
48 ret = curl_easy_perform(curl);
49 curl_easy_cleanup(curl);
50 }
51
53 Added in 7.71.0. This option is supported by the OpenSSL backends.
54
56 Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or
57 CURLE_OUT_OF_MEMORY if there was insufficient heap space.
58
60 CURLOPT_SSLKEYTYPE(3), CURLOPT_SSLKEY(3),
61
62
63
64ibcurl 8.2.1 April 26, 2023 CURLOPT_SSLKEY_BLOB(3)