1CURLOPT_SSLKEY(3) curl_easy_setopt options CURLOPT_SSLKEY(3)
2
3
4
6 CURLOPT_SSLKEY - private key file for TLS and SSL client cert
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLKEY, char *keyfile);
12
14 Pass a pointer to a null-terminated string as parameter. The string
15 should be the file name of your private key. The default format is
16 "PEM" and can be changed with CURLOPT_SSLKEYTYPE(3).
17
18 (Windows, iOS and Mac OS X) This option is ignored by Secure Transport
19 and Schannel SSL backends because they expect the private key to be al‐
20 ready present in the key-chain or PKCS#12 file containing the certifi‐
21 cate.
22
23 The application does not have to keep the string around after setting
24 this option.
25
27 NULL
28
30 All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
31
33 CURL *curl = curl_easy_init();
34 if(curl) {
35 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
36 curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem");
37 curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem");
38 curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
39 ret = curl_easy_perform(curl);
40 curl_easy_cleanup(curl);
41 }
42
44 If built TLS enabled.
45
47 Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or
48 CURLE_OUT_OF_MEMORY if there was insufficient heap space.
49
51 CURLOPT_SSLKEYTYPE(3), CURLOPT_SSLCERT(3),
52
53
54
55libcurl 8.0.1 January 02, 2023 CURLOPT_SSLKEY(3)