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