CURLOPT_TLSAUTH_PASSWORD(3)

πŸ’… CURLOPT_TLSAUTH_PASSWORD πŸ’…

okay bestie, welcome to the Library Functions Manual entry for CURLOPT_TLSAUTH_PASSWORD β€” yes it's a mouthful, but it's literally the password half of TLS auth, and we're gonna slay it.


🌸 NAME 🌸

CURLOPT_TLSAUTH_PASSWORD β€” the password you hand over for TLS authentication. that's the whole vibe.


✨ SYNOPSIS ✨

#include <curl/curl.h>

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

πŸ¦‹ DESCRIPTION πŸ¦‹

so you pass a char * pointer as the parameter, and it should point to the null-terminated password to use for the TLS authentication method you specified with the CURLOPT_TLSAUTH_TYPE(3) option.

it requires that the CURLOPT_TLSAUTH_USERNAME(3) option also be set β€” they're a package deal, no cap.

good news, bestie: the application does not have to keep the string around after setting this option. set it and forget it, icon behavior.

using this option multiple times? the last set string overrides the previous ones. last one wins, periodt.

set it to NULL to disable its use again β€” turning it off is valid too.

⚠️ important caveat: this feature relies on TLS SRP, which does not work with TLS 1.3. so if you're on TLS 1.3, this is giving unavailable, bestie.

πŸŽ€ DEFAULT πŸŽ€

NULL β€” that's the default, and it's giving "no password set."


🌈 PROTOCOLS 🌈

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

but backend-wise? this option works only with the following TLS backends: GnuTLS and OpenSSL. literally only those two, iykyk.


πŸ’– EXAMPLE πŸ’–

here's the iconic little example, copied exactly because code is sacred:

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_TLSAUTH_TYPE, "SRP");
    curl_easy_setopt(curl, CURLOPT_TLSAUTH_USERNAME, "user");
    curl_easy_setopt(curl, CURLOPT_TLSAUTH_PASSWORD, "secret");
    result = curl_easy_perform(curl);
    curl_easy_cleanup(curl);
  }
}

⭐ AVAILABILITY ⭐

added in curl 7.21.4 β€” vintage but still cute.


🫢 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 β€” check libcurl-errors(3) for the details.


πŸ‘‘ SEE ALSO πŸ‘‘


that's the whole page, bestie β€” from the libcurl manual, dated 2026-10-12, and it's CURLOPT_TLSAUTH_PASSWORD(3) all the way down. go set that password and slay πŸ’…βœ¨

πŸ“¦ where this page comes from