GNURLOPT_SSLKEY(3)

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

πŸ’… NAME πŸ’…

okay so welcome to GNURLOPT_SSLKEY(3), the gnurl manual page where CURLOPT_SSLKEY is literally here to specify the private keyfile for TLS and SSL client cert. πŸŽ€ iykyk.

✨ SYNOPSIS ✨

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLKEY, char *keyfile);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so you pass a pointer to a null-terminated string as the parameter, bestie. That string should be the file name of your private key. The default format is "PEM" and can be changed with CURLOPT_SSLKEYTYPE(3). πŸ’–

(iOS and Mac OS X only) this option is ignored if curl was built against Secure Transport. Secure Transport expects the private key to be already present in the keychain or PKCS#12 file containing the certificate. no cap, so check your build before you spiral. 😭

The application does not have to keep the string around after setting this option β€” set it and go, bestie. 🫢

πŸ’œ DEFAULT πŸ’œ

NULL β€” that’s the default. literally.

🌈 PROTOCOLS 🌈

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

πŸ”₯ EXAMPLE πŸ”₯

okay so here’s the example, exactly as it is:

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_KEYPASSWD, "s3cret");
  ret = curl_easy_perform(curl);
  curl_easy_cleanup(curl);
}

🌸 AVAILABILITY 🌸

If built TLS enabled. That’s the whole note. 🌸

πŸŽ€ RETURN VALUE πŸŽ€

  • CURLE_OK β€” if TLS is supported ✨
  • CURLE_UNKNOWN_OPTION β€” if not πŸ™ˆ
  • CURLE_OUT_OF_MEMORY β€” if there was insufficient heap space 😭

🫢 SEE ALSO 🫢

go read these too, bestie:

okay bye bestie β€” this page is serving libcurl 7.37.0 realness, dated 17 Jun 2014. πŸ’–βœ¨

πŸ“¦ where this page comes from