CURLOPT_PROXY_KEYPASSWD(3)

πŸ’… CURLOPT_PROXY_KEYPASSWD(3)

okay bestie, welcome to another iconic page from the libcurl Library Functions Manual ✨ this one is about CURLOPT_PROXY_KEYPASSWD, and it's lowkey a lifesaver the moment you're doing proxy TLS stuff. sit with me, we've got this 🫢


🌸 NAME

CURLOPT_PROXY_KEYPASSWD β€” the passphrase for your proxy's private key πŸ”‘


✨ SYNOPSIS

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_KEYPASSWD, char *pwd);

πŸ’– DESCRIPTION

okay so first things first, the vibe check: this option is for connecting to an HTTPS proxy, not an HTTPS server. literally different thing, don't mix them up πŸ™ˆ

You pass a pointer to a null-terminated string as the parameter. That string is used as the password required to use the CURLOPT_PROXY_SSLKEY(3) private key. And here's the tea bestie: you never need a passphrase to load a certificate, but you do need one to load your private key. that's just how it is πŸ’€

The application does not have to keep the string around after setting this option β€” so you can let it go, she's free, main character energy 🌈

Use this option multiple times and it's giving "last one wins" β€” the last set string overrides the previous ones. Set it to NULL to disable its use again. periodt πŸ‘‘


πŸŽ€ DEFAULT

NULL


πŸ¦‹ PROTOCOLS

This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. so basically the whole secure squad πŸ’œ

This option works only with the following TLS backends: OpenSSL, Schannel, mbedTLS and wolfSSL. no cap, that's the list.


⭐ EXAMPLE

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
    curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy.example:443");
    curl_easy_setopt(curl, CURLOPT_PROXY_KEYPASSWD, "superman");
    result = curl_easy_perform(curl);
    curl_easy_cleanup(curl);
  }
}

the way this snippet just works 😭 "superman" as the passphrase is such an icon, honestly.


🧚 AVAILABILITY

Added in curl 7.52.0 β€” vintage but still slaying πŸ’«


πŸ”₯ RETURN VALUE

curl_easy_setopt(3) returns a CURLcode indicating success or error. CURLE_OK (0) means everything was OK, and non-zero means an error occurred β€” see libcurl-errors(3) for the whole lineup πŸ“


πŸ‘‘ SEE ALSO


aaaaand that's the page, bestie πŸ’… mwah πŸ’– this was libcurl, dated 2026-10-12, and yes she's still CURLOPT_PROXY_KEYPASSWD(3) at heart. go forth and passphrase responsibly πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from