GNURLOPT_TLSAUTH_TYPE(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸ’… GNURLOPT_TLSAUTH_TYPE(3) β€” like, the TLS auth one

okay so bestie, this is a page out of the curl_easy_setopt options manual (yes that's the manual name, i didn't make it up πŸ’€) and it's all about CURLOPT_TLSAUTH_TYPE. it's shorter than my attention span so we'll be done in a sec 🫢


✨ NAME ✨

CURLOPT_TLSAUTH_TYPE β€” sets the TLS authentication method, no cap 🌸


✨ SYNOPSIS ✨

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TLSAUTH_TYPE, char
*type);

✨ DESCRIPTION ✨

so you pass a pointer to a null-terminated string as the parameter, and that string is literally the method of TLS authentication you want. the supported method is "SRP". that's it. that's the list. one (1) method. iconic minimalism πŸ’…

  • SRP β€” this is TLS-SRP authentication. Secure Remote Password auth for TLS is defined in RFC5054 and it gives you mutual authentication if both sides have a shared secret (mutual = both directions, we love a two-way street 🫢). to actually use TLS-SRP you also have to set the CURLOPT_TLSAUTH_USERNAME(3) and CURLOPT_TLSAUTH_PASSWORD(3) options β€” don't forget, it's giving "forgot my keys" energy otherwise πŸ”‘

good news: the application does not have to keep the string around after setting this option. set it and yeet it, the string's job is done ✨

🚨 heads up: TLS SRP doesn't work with TLS 1.3. like, at all. not me finding out the hard way 😭

✨ DEFAULT ✨

blank. empty. nothing. the void πŸ•³οΈ


✨ PROTOCOLS ✨

All TLS-based protocols β€” every single one that does TLS 🌈


✨ EXAMPLE ✨

here's the whole vibe in code, copy-paste ready fr fr πŸŽ€

CURL *curl = curl_easy_init();
if(curl) {
  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");
  ret = curl_easy_perform(curl);
  curl_easy_cleanup(curl);
}

✨ AVAILABILITY ✨

for this to work you need to build libcurl with GnuTLS or OpenSSL with TLS-SRP support. no SRP build, no SRP slay, sorry babe πŸ™ˆ

added in 7.21.4 β€” vintage but still cute ⭐


✨ RETURN VALUE ✨

  • returns CURLE_OK if the option is supported βœ…
  • returns CURLE_UNKNOWN_OPTION if it's not πŸ’€

✨ SEE ALSO ✨


and that's the whole page bestie, go forth and authenticate securely πŸ’–

🧚 sign-off: this lil page is from libcurl 7.37.0, dated 19 Jun 2014 β€” yes she's an elder but she still ate πŸ‘‘
πŸ“¦ where this page comes from