GNURLOPT_PROXY_SSLKEY(3)

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

πŸŽ€ NAME πŸŽ€

okay bestie, this is GNURLOPT_PROXY_SSLKEY(3), one of the curl_easy_setopt options, and the main character is CURLOPT_PROXY_SSLKEY β€” specify private keyfile for TLS and SSL proxy client cert. It's giving "my HTTPS proxy has a private key and she's ready to be introduced" energy. πŸ’…


✨ SYNOPSIS ✨

#include <gnurl/curl.h>

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

πŸ’– DESCRIPTION πŸ’–

Pass a pointer to a null-terminated string as parameter β€” yes, that's the whole assignment. That string should be the file name of your private key used for connecting to the HTTPS proxy. πŸ”‘

The default format is "PEM" and can be changed with CURLOPT_PROXY_SSLKEYTYPE(3) β€” no cap.

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. πŸ™ˆ

And the bestie-friendly part: the application does not have to keep the string around after setting this option. So you can let it go, bestie. πŸ¦‹


🌈 DEFAULT 🌈

NULL β€” iconic, empty, no keyfile until you say so. πŸ’€


πŸ¦‹ PROTOCOLS πŸ¦‹

All β€” literally every protocol is invited to the party. πŸŽ‰


πŸ“ EXAMPLE πŸ“

Here's the little glow-up in code form, exactly as it's meant to go:

CURL *curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
  curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy");
  curl_easy_setopt(curl, CURLOPT_PROXY_SSLCERT, "client.pem");
  curl_easy_setopt(curl, CURLOPT_PROXY_SSLKEY, "key.pem");
  curl_easy_setopt(curl, CURLOPT_PROXY_KEYPASSWD, "s3cret");
  ret = curl_easy_perform(curl);
  curl_easy_cleanup(curl);
}

πŸ‘‘ AVAILABILITY πŸ‘‘

Added in 7.52.0 β€” yes, she's been around. πŸ’…

If built TLS enabled.


πŸ”₯ 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. So like, if TLS is a no, you get the unknown-option vibe; if memory says "not today", you get the out-of-memory one. 😭


🫢 SEE ALSO 🫢


πŸ’– that's the whole tea, brought to you by libcurl 7.52.0, dated 16 Nov 2016 β€” catch you in the group chat, bestie! GNURLOPT_PROXY_SSLKEY(3) out. πŸŽ€βœ¨

πŸ“¦ where this page comes from