1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_KEYPASSWD
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_SSH_PRIVATE_KEYFILE (3)
9  - CURLOPT_SSLKEY (3)
10---
11
12# NAME
13
14CURLOPT_KEYPASSWD - passphrase to private key
15
16# SYNOPSIS
17
18~~~c
19#include <curl/curl.h>
20
21CURLcode curl_easy_setopt(CURL *handle, CURLOPT_KEYPASSWD, char *pwd);
22~~~
23
24# DESCRIPTION
25
26Pass a pointer to a null-terminated string as parameter. It is used as the
27password required to use the CURLOPT_SSLKEY(3) or
28CURLOPT_SSH_PRIVATE_KEYFILE(3) private key. You never need a pass phrase to
29load a certificate but you need one to load your private key.
30
31The application does not have to keep the string around after setting this
32option.
33
34# DEFAULT
35
36NULL
37
38# PROTOCOLS
39
40All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
41
42# EXAMPLE
43
44~~~c
45int main(void)
46{
47  CURL *curl = curl_easy_init();
48  if(curl) {
49    CURLcode res;
50    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
51    curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem");
52    curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem");
53    curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "superman");
54    res = curl_easy_perform(curl);
55    curl_easy_cleanup(curl);
56  }
57}
58~~~
59
60# AVAILABILITY
61
62This option was known as CURLOPT_SSLKEYPASSWD up to 7.16.4 and
63CURLOPT_SSLCERTPASSWD up to 7.9.2.
64
65# RETURN VALUE
66
67Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or
68CURLE_OUT_OF_MEMORY if there was insufficient heap space.
69