CURLOPT_KEYPASSWD.md (1736B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_KEYPASSWD 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_SSH_PRIVATE_KEYFILE (3) 9 - CURLOPT_SSLKEY (3) 10 Protocol: 11 - TLS 12 TLS-backend: 13 - OpenSSL 14 - mbedTLS 15 - Schannel 16 - wolfSSL 17 Added-in: 7.17.0 18 --- 19 20 # NAME 21 22 CURLOPT_KEYPASSWD - passphrase to private key 23 24 # SYNOPSIS 25 26 ~~~c 27 #include <curl/curl.h> 28 29 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_KEYPASSWD, char *pwd); 30 ~~~ 31 32 # DESCRIPTION 33 34 Pass a pointer to a null-terminated string as parameter. It is used as the 35 password required to use the CURLOPT_SSLKEY(3) or 36 CURLOPT_SSH_PRIVATE_KEYFILE(3) private key. You never need a passphrase to 37 load a certificate but you need one to load your private key. 38 39 The application does not have to keep the string around after setting this 40 option. 41 42 Using this option multiple times makes the last set string override the 43 previous ones. Set it to NULL to disable its use again. 44 45 # DEFAULT 46 47 NULL 48 49 # %PROTOCOLS% 50 51 # EXAMPLE 52 53 ~~~c 54 int main(void) 55 { 56 CURL *curl = curl_easy_init(); 57 if(curl) { 58 CURLcode res; 59 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin"); 60 curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem"); 61 curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem"); 62 curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "superman"); 63 res = curl_easy_perform(curl); 64 curl_easy_cleanup(curl); 65 } 66 } 67 ~~~ 68 69 # HISTORY 70 71 This option was known as CURLOPT_SSLKEYPASSWD up to 7.16.4 and 72 CURLOPT_SSLCERTPASSWD up to 7.9.2. 73 74 # %AVAILABILITY% 75 76 # RETURN VALUE 77 78 curl_easy_setopt(3) returns a CURLcode indicating success or error. 79 80 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 81 libcurl-errors(3).