1CURLOPT_SSLKEY(3)          curl_easy_setopt options          CURLOPT_SSLKEY(3)
2
3
4

NAME

6       CURLOPT_SSLKEY - specify private keyfile for TLS and SSL client cert
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLKEY, char *keyfile);
12

DESCRIPTION

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       (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

DEFAULT

27       NULL
28

PROTOCOLS

30       All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
31

EXAMPLE

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

AVAILABILITY

44       If built TLS enabled.
45

RETURN VALUE

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

SEE ALSO

51       CURLOPT_SSLKEYTYPE(3), CURLOPT_SSLCERT(3),
52
53
54
55libcurl 7.76.1                 November 04, 2020             CURLOPT_SSLKEY(3)
Impressum