GNURLOPT_SSLKEYTYPE(3)

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

πŸ’… GNURLOPT_SSLKEYTYPE(3) πŸ’…

okay bestie, this is the GNURLOPT_SSLKEYTYPE(3) page, hanging out in the curl_easy_setopt options manual section β€” and it's here to explain setting the type of your private key file. no cap. ✨


🌸 NAME 🌸

CURLOPT_SSLKEYTYPE β€” set type of the private key file πŸ’–

πŸŽ€ SYNOPSIS πŸŽ€

#include <gnurl/curl.h>

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

πŸ¦‹ DESCRIPTION πŸ¦‹

You pass a pointer to a null-terminated string as parameter β€” that string is, like, the format of your private key. Supported formats are "PEM", "DER" and "ENG". πŸ’…

The format "ENG" enables you to load the private key from a crypto engine. In this case CURLOPT_SSLKEY(3) is used as an identifier passed to the engine. You have to set the crypto engine with CURLOPT_SSLENGINE(3). 🧚

The "DER" format key file currently does not work because of a bug in OpenSSL β€” not the vibe, but that's the tea. πŸ’€

The application does not have to keep the string around after setting this option, so don't stress about keeping it alive afterward. 🫢

✨ DEFAULT ✨

"PEM" β€” that's the default, periodt. πŸ‘‘

🌈 PROTOCOLS 🌈

All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. πŸ’–

πŸ”₯ EXAMPLE πŸ”₯

like, here's the whole vibe:

CURL *curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
  curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem");
  curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem");
  curl_easy_setopt(curl, CURLOPT_SSLKEYTYPE, "PEM");
  curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
  ret = curl_easy_perform(curl);
  curl_easy_cleanup(curl);
}

🧚 AVAILABILITY 🧚

Available if built TLS enabled β€” that's the condition, bestie. ✨

πŸ’œ RETURN VALUE πŸ’œ

Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space. 🫢

πŸ“ SEE ALSO πŸ“


mwah πŸ’‹ β€” this page is from libcurl 7.37.0, dated 17 Jun 2014, and it's still the GNURLOPT_SSLKEYTYPE(3) manual page. byeee bestie 🫢✨

πŸ“¦ where this page comes from