GNURLOPT_SSLKEY(3)
π 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
- 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