1CURLOPT_SSLKEY(3) curl_easy_setopt options CURLOPT_SSLKEY(3)
2
3
4
6 CURLOPT_SSLKEY - specify private keyfile 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 zero 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 (iOS and Mac OS X only) This option is ignored if curl was built
19 against Secure Transport. Secure Transport expects the private key to
20 be already present in the keychain or PKCS#12 file containing the cer‐
21 tificate.
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 7.66.0 May 31, 2017 CURLOPT_SSLKEY(3)