1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.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)
10Protocol:
11  - TLS
12TLS-backend:
13  - OpenSSL
14  - GnuTLS
15Added-in: 7.21.4
16---
17
18# NAME
19
20CURLOPT_TLSAUTH_USERNAME - username to use for TLS authentication
21
22# SYNOPSIS
23
24~~~c
25#include <curl/curl.h>
26
27CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TLSAUTH_USERNAME, char *user);
28~~~
29
30# DESCRIPTION
31
32Pass a char pointer as parameter, which should point to the null-terminated
33username to use for the TLS authentication method specified with the
34CURLOPT_TLSAUTH_TYPE(3) option. Requires that the CURLOPT_TLSAUTH_PASSWORD(3)
35option also be set.
36
37The application does not have to keep the string around after setting this
38option.
39
40Using this option multiple times makes the last set string override the
41previous ones. Set it to NULL to disable its use again.
42
43This feature relies on TLS SRP which does not work with TLS 1.3.
44
45# DEFAULT
46
47NULL
48
49# %PROTOCOLS%
50
51# EXAMPLE
52
53~~~c
54int 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
73Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
74CURLE_OUT_OF_MEMORY if there was insufficient heap space.
75