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

NAME

6       CURLOPT_SSLCERT - set SSL client certificate
7

SYNOPSIS

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

DESCRIPTION

14       Pass  a  pointer  to  a zero terminated string as parameter. The string
15       should be the file name of your client certificate. The default  format
16       is  "P12"  on  Secure  Transport and "PEM" on other engines, and can be
17       changed with CURLOPT_SSLCERTTYPE(3).
18
19       With NSS or Secure Transport, this can also be the nickname of the cer‐
20       tificate  you  wish to authenticate with as it is named in the security
21       database. If you want to use a file from the current directory,  please
22       precede  it  with "./" prefix, in order to avoid confusion with a nick‐
23       name.
24
25       (Schannel/WinSSL only) Client certificates must be specified by a  path
26       expression  to  a certificate store. (Loading PFX is not supported; you
27       can import it to a store first). You can use  "<store  location>\<store
28       name>\<thumbprint>"  to  refer  to a certificate in the system certifi‐
29       cates          store,          for          example,           "Curren‐
30       tUser\MY\934a7ac6f8a5d579285a74fa61e19f23ddfe8d7a".  Thumbprint is usu‐
31       ally a SHA-1 hex string which you can see in certificate details.  Fol‐
32       lowing  store  locations are supported: CurrentUser, LocalMachine, Cur‐
33       rentService, Services, CurrentUserGroupPolicy, LocalMachineGroupPolicy,
34       LocalMachineEnterprise.
35
36       When using a client certificate, you most likely also need to provide a
37       private key with CURLOPT_SSLKEY(3).
38
39       The application does not have to keep the string around  after  setting
40       this option.
41

DEFAULT

43       NULL
44

PROTOCOLS

46       All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
47

EXAMPLE

49       CURL *curl = curl_easy_init();
50       if(curl) {
51         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
52         curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem");
53         curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem");
54         curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
55         ret = curl_easy_perform(curl);
56         curl_easy_cleanup(curl);
57       }
58

AVAILABILITY

60       If built TLS enabled.
61

RETURN VALUE

63       Returns  CURLE_OK  if  TLS  enabled,  CURLE_UNKNOWN_OPTION  if  not, or
64       CURLE_OUT_OF_MEMORY if there was insufficient heap space.
65

SEE ALSO

67       CURLOPT_SSLCERTTYPE(3), CURLOPT_SSLKEY(3),
68
69
70
71libcurl 7.61.1                  April 18, 2018              CURLOPT_SSLCERT(3)
Impressum