GNURLOPT_KEYPASSWD(3)
β¨ GNURLOPT_KEYPASSWD(3) β¨
okay so bestie, welcome to the GNURLOPT_KEYPASSWD page π
β this one lives in the curl_easy_setopt options manual, and honestly? it's giving "small but mighty". it's all about handing curl the passphrase for your private key. no cap, you're gonna want this one β¨
π NAME π
CURLOPT_KEYPASSWD β set passphrase to private key π
π¦ SYNOPSIS π¦
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_KEYPASSWD, char *pwd);
π DESCRIPTION π
so basically, you pass a pointer to a null-terminated string as the parameter, and that string is literally the password required to use your CURLOPT_SSLKEY(3) or CURLOPT_SSH_PRIVATE_KEYFILE(3) private key π₯
the glow-up explanation: you never needed a pass phrase to load a certificate, but you do need one to load your private key. that's just how it is, periodt π
and the good news β the application does not have to keep the string around after setting this option π«Ά set it and forget it, icon behavior.
πΈ DEFAULT πΈ
NULL
π§ PROTOCOLS π§
all the TLS based protocols, bestie: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. π like, the whole secure squad.
β EXAMPLE β
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem");
curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem");
curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "superman");
ret = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
not the passphrase being "superman" π main character energy fr fr. anyway β copy this exactly, don't get cute with it.
π AVAILABILITY π
history lesson, bestie, and it's kind of a name-change arc π:
- this option was known as
CURLOPT_SSLKEYPASSWDup to 7.16.4 - and also as
CURLOPT_SSLCERTPASSWDup to 7.9.2
so if you're reading ancient code and see those old names? that's the same girl, different era π
π₯ RETURN VALUE π₯
CURLE_OKβ if TLS enabled, slay βCURLE_UNKNOWN_OPTIONβ if not, oop πCURLE_OUT_OF_MEMORYβ if there was insufficient heap space π
π SEE ALSO π
β οΈ friendly reminder that this is the passphrase for your private key β treat it like a secret, because it literally is one π«Ά
and that's the whole page, bestie π this one came from libcurl 7.37.0, dated 17 Jun 2014 β vintage but still iconic β¨ mwah π
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms