CURLOPT_TLSAUTH_PASSWORD.md (1726B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_TLSAUTH_PASSWORD 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_PROXY_TLSAUTH_PASSWORD (3) 9 - CURLOPT_TLSAUTH_TYPE (3) 10 - CURLOPT_TLSAUTH_USERNAME (3) 11 Protocol: 12 - TLS 13 TLS-backend: 14 - OpenSSL 15 - GnuTLS 16 Added-in: 7.21.4 17 --- 18 19 # NAME 20 21 CURLOPT_TLSAUTH_PASSWORD - password to use for TLS authentication 22 23 # SYNOPSIS 24 25 ~~~c 26 #include <curl/curl.h> 27 28 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TLSAUTH_PASSWORD, char *pwd); 29 ~~~ 30 31 # DESCRIPTION 32 33 Pass a char pointer as parameter, which should point to the null-terminated 34 password to use for the TLS authentication method specified with the 35 CURLOPT_TLSAUTH_TYPE(3) option. Requires that the CURLOPT_TLSAUTH_USERNAME(3) 36 option also be set. 37 38 The application does not have to keep the string around after setting this 39 option. 40 41 Using this option multiple times makes the last set string override the 42 previous ones. Set it to NULL to disable its use again. 43 44 This feature relies on TLS SRP which does not work with TLS 1.3. 45 46 # DEFAULT 47 48 NULL 49 50 # %PROTOCOLS% 51 52 # EXAMPLE 53 54 ~~~c 55 int main(void) 56 { 57 CURL *curl = curl_easy_init(); 58 if(curl) { 59 CURLcode res; 60 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 61 curl_easy_setopt(curl, CURLOPT_TLSAUTH_TYPE, "SRP"); 62 curl_easy_setopt(curl, CURLOPT_TLSAUTH_USERNAME, "user"); 63 curl_easy_setopt(curl, CURLOPT_TLSAUTH_PASSWORD, "secret"); 64 res = curl_easy_perform(curl); 65 curl_easy_cleanup(curl); 66 } 67 } 68 ~~~ 69 70 # %AVAILABILITY% 71 72 # RETURN VALUE 73 74 curl_easy_setopt(3) returns a CURLcode indicating success or error. 75 76 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 77 libcurl-errors(3).