CURLOPT_PROXY_SSLKEY(3)
π CURLOPT_PROXY_SSLKEY β private key file for HTTPS proxy client cert π
okay so this is a page from the libcurl manual (that's the Library Functions Manual, bestie, the curl one), and today's main character is CURLOPT_PROXY_SSLKEY. it's giving "my private key, but for the proxy." let's get into it β¨
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSLKEY, char *keyfile);
π DESCRIPTION π
so you pass a pointer to a null-terminated string as the parameter, right? that string should be the filename of your private key used for connecting to the HTTPS proxy. like, your proxy's personal little secret. π
the default format is "PEM", and if that's not your vibe you can change it with CURLOPT_PROXY_SSLKEYTYPE(3). slay, options.
π heads up: this option is ignored by the Schannel backend, because Schannel expects the private key to already be present in the key chain or in the PKCS#12 file containing the certificate. so don't come for Schannel about it, it just works differently.
the application does not have to keep the string around after setting this option. set it and forget it, no cap. π«Ά
and if you set this option multiple times? the last set string overrides the previous ones. yeah, last one wins, periodt. and setting it to NULL disables its use again. bye bestie π
πΈ DEFAULT πΈ
NULL
(iconic lonely default behavior, honestly)
π¦ PROTOCOLS π¦
this functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. literally all the S-having ones.
this option works only with the following TLS backends: OpenSSL, Schannel, mbedTLS and wolfSSL. vibe check passed for those four only. β
π§ EXAMPLE π§
okay here's the whole thing, copy it exactly because it's perfect:
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy.example");
curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERT, "client.pem");
curl_easy_setopt(curl, CURLOPT_PROXY_SSLKEY, "key.pem");
curl_easy_setopt(curl, CURLOPT_PROXY_KEYPASSWD, "s3cret");
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
}
look at the cert + key + password trio, they ate that. π₯
π AVAILABILITY π
added in curl 7.52.0. vintage but cute. π
π RETURN VALUE π
curl_easy_setopt(3) returns a CURLcode indicating success or error.
CURLE_OK (that's 0) means everything was OK, and non-zero means an error occurred β go check libcurl-errors(3) for the tea. π
π SEE ALSO π
CURLOPT_PROXY_SSLCERT(3)CURLOPT_PROXY_SSLKEYTYPE(3)CURLOPT_SSLCERT(3)CURLOPT_SSLKEY(3)CURLOPT_SSLKEYTYPE(3)
and that's the whole page bestie π
this was brought to you by libcurl, dated 2026-10-12, filed under CURLOPT_PROXY_SSLKEY(3). go forth and secure your proxies, mwah π«Άπβ¨
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms