1CURLOPT_SSLCERT(3)                  libcurl                 CURLOPT_SSLCERT(3)
2
3
4

NAME

6       CURLOPT_SSLCERT - 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 null-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 only) Client certificates can be specified by a path  expres‐
26       sion to a certificate store. (You can import PFX to a store first). You
27       can use "<store location>\<store name>\<thumbprint>" to refer to a cer‐
28       tificate  in  the  system  certificates  store,  for  example, "Curren‐
29       tUser\MY\934a7ac6f8a5d579285a74fa". The thumbprint is usually  a  SHA-1
30       hex  string  which  you can see in certificate details. Following store
31       locations are  supported:  CurrentUser,  LocalMachine,  CurrentService,
32       Services,  CurrentUserGroupPolicy, LocalMachineGroupPolicy, LocalMachi‐
33       neEnterprise.  Schannel also support P12  certificate  file,  with  the
34       string "P12" specified with CURLOPT_SSLCERTTYPE(3).
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
71ibcurl 8.2.1                    April 26, 2023              CURLOPT_SSLCERT(3)
Impressum