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