1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_TLSAUTH_USERNAME
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_TLSAUTH_PASSWORD (3)
9  - CURLOPT_TLSAUTH_TYPE (3)
10---
11
12# NAME
13
14CURLOPT_TLSAUTH_USERNAME - user name to use for TLS authentication
15
16# SYNOPSIS
17
18~~~c
19#include <curl/curl.h>
20
21CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TLSAUTH_USERNAME, char *user);
22~~~
23
24# DESCRIPTION
25
26Pass a char pointer as parameter, which should point to the null-terminated
27username to use for the TLS authentication method specified with the
28CURLOPT_TLSAUTH_TYPE(3) option. Requires that the
29CURLOPT_TLSAUTH_PASSWORD(3) option also be set.
30
31The application does not have to keep the string around after setting this
32option.
33
34This feature relies in TLS SRP which does not work with TLS 1.3.
35
36# DEFAULT
37
38NULL
39
40# PROTOCOLS
41
42All TLS-based protocols
43
44# EXAMPLE
45
46~~~c
47int main(void)
48{
49  CURL *curl = curl_easy_init();
50  if(curl) {
51    CURLcode res;
52    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
53    curl_easy_setopt(curl, CURLOPT_TLSAUTH_TYPE, "SRP");
54    curl_easy_setopt(curl, CURLOPT_TLSAUTH_USERNAME, "user");
55    curl_easy_setopt(curl, CURLOPT_TLSAUTH_PASSWORD, "secret");
56    res = curl_easy_perform(curl);
57    curl_easy_cleanup(curl);
58  }
59}
60~~~
61
62# AVAILABILITY
63
64Added in 7.21.4, with the OpenSSL and GnuTLS backends only
65
66# RETURN VALUE
67
68Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
69CURLE_OUT_OF_MEMORY if there was insufficient heap space.
70