CURLOPT_PROXY_SSLKEY_BLOB(3)

πŸ’– CURLOPT_PROXY_SSLKEY_BLOB(3) πŸ’–

okay bestie, welcome to the libcurl corner of the Library Functions Manual β€” this one's about CURLOPT_PROXY_SSLKEY_BLOB, and yes the header up top is doing that shy CURLOPT_PR...SSLKEY_BLOB(3) thing because the name is lowkey a mouthful. anyway. let's get into it πŸŽ€

✨ NAME ✨

CURLOPT_PROXY_SSLKEY_BLOB β€” the private key for your proxy cert, but like… straight from a memory blob πŸ§ πŸ’…


✨ SYNOPSIS ✨

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSLKEY_BLOB,
                          struct curl_blob *blob);

✨ DESCRIPTION ✨

so basically you pass a pointer to a curl_blob struct that holds the info (the pointer and the size) about the private key you need for connecting to the HTTPS proxy. it's compatible with OpenSSL πŸ¦‹. and the format (like "PEM") has to be specified with CURLOPT_PROXY_SSLKEYTYPE(3) β€” no guessing, bestie, you gotta say it πŸ‘‘

if the blob is initialized with the flags member of struct curl_blob set to CURL_BLOB_COPY, then the application does not have to keep the buffer around after setting this. so curl copies it for you and you can go live your life 🫢 β€” iconic behavior honestly.


✨ DEFAULT ✨

NULL

✨ PROTOCOLS ✨

this functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. the whole squad 🌈

heads up: this option works only with the following TLS backends: OpenSSL. that's the whole list. one (1) backend. no cap πŸ’€

✨ EXAMPLE ✨

extern char *certificateData; /* point to data */
extern size_t filesize; /* size of data */

extern char *privateKeyData; /* point to data */
extern size_t privateKeySize; /* size */

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    struct curl_blob blob;
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
    curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy.example");
    blob.data = certificateData;
    blob.len = filesize;
    blob.flags = CURL_BLOB_COPY;
    curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERT_BLOB, &blob);
    curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERTTYPE, "PEM");

    blob.data = privateKeyData;
    blob.len = privateKeySize;
    curl_easy_setopt(curl, CURLOPT_PROXY_SSLKEY_BLOB, &blob);
    curl_easy_setopt(curl, CURLOPT_PROXY_KEYPASSWD, "s3cret");
    result = curl_easy_perform(curl);
    curl_easy_cleanup(curl);
  }
}

look at that. cert blob, key blob, password "s3cret" β€” she's got the whole fit on πŸ”₯


✨ AVAILABILITY ✨

added in curl 7.71.0 ⭐ (yes she's a relatively recent queen)

✨ RETURN VALUE ✨

curl_easy_setopt(3) returns a CURLcode indicating success or error πŸ’«

CURLE_OK (0) means everything was OK. non-zero means an error occurred β€” go check libcurl-errors(3) and it'll tell you what's up 😭


✨ SEE ALSO ✨


and that's the whole vibe check, bestie οΏ½. this page came to you from libcurl, dated 2026-10-12, filed under CURLOPT_PR...SSLKEY_BLOB(3) β€” go forth and blob your proxy keys responsibly πŸ’œβœ¨πŸŽ€

πŸ“¦ where this page comes from