1CURLOPT_SSLVERSION(3)      curl_easy_setopt options      CURLOPT_SSLVERSION(3)
2
3
4

NAME

6       CURLOPT_SSLVERSION - set preferred TLS/SSL version
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode  curl_easy_setopt(CURL  *handle, CURLOPT_SSLVERSION, long ver‐
12       sion);
13

DESCRIPTION

15       Pass a long as parameter to control which version range of SSL/TLS ver‐
16       sions to use.
17
18       The  SSL  and TLS versions have typically developed from the most inse‐
19       cure version to be more and more secure in this order through  history:
20       SSL  v2,  SSLv3,  TLS  v1.0, TLS v1.1, TLS v1.2 and the most recent TLS
21       v1.3.
22
23       Use one of the available defines for this purpose.  The  available  op‐
24       tions are:
25
26              CURL_SSLVERSION_DEFAULT
27                     The default acceptable version range. The minimum accept‐
28                     able version is by default TLS v1.0 since 7.39.0  (unless
29                     the TLS library has a stricter rule).
30
31              CURL_SSLVERSION_TLSv1
32                     TLS v1.0 or later
33
34              CURL_SSLVERSION_SSLv2
35                     SSL v2 (but not SSLv3)
36
37              CURL_SSLVERSION_SSLv3
38                     SSL v3 (but not SSLv2)
39
40              CURL_SSLVERSION_TLSv1_0
41                     TLS v1.0 or later (Added in 7.34.0)
42
43              CURL_SSLVERSION_TLSv1_1
44                     TLS v1.1 or later (Added in 7.34.0)
45
46              CURL_SSLVERSION_TLSv1_2
47                     TLS v1.2 or later (Added in 7.34.0)
48
49              CURL_SSLVERSION_TLSv1_3
50                     TLS v1.3 or later (Added in 7.52.0)
51
52       The  maximum  TLS  version  can be set by using one of the CURL_SSLVER‐
53       SION_MAX_ macros below. It is also possible to OR one of  the  CURL_SS‐
54       LVERSION_  macros with one of the CURL_SSLVERSION_MAX_ macros.  The MAX
55       macros are not supported for WolfSSL.
56
57              CURL_SSLVERSION_MAX_DEFAULT
58                     The flag defines the maximum  supported  TLS  version  by
59                     libcurl,  or  the  default  value from the SSL library is
60                     used. libcurl will use a sensible default maximum,  which
61                     was  TLS  v1.2  up to before 7.61.0 and is TLS v1.3 since
62                     then - assuming the TLS library  support  it.  (Added  in
63                     7.54.0)
64
65              CURL_SSLVERSION_MAX_TLSv1_0
66                     The  flag  defines  maximum  supported TLS version as TLS
67                     v1.0.  (Added in 7.54.0)
68
69              CURL_SSLVERSION_MAX_TLSv1_1
70                     The flag defines maximum supported  TLS  version  as  TLS
71                     v1.1.  (Added in 7.54.0)
72
73              CURL_SSLVERSION_MAX_TLSv1_2
74                     The  flag  defines  maximum  supported TLS version as TLS
75                     v1.2.  (Added in 7.54.0)
76
77              CURL_SSLVERSION_MAX_TLSv1_3
78                     The flag defines maximum supported  TLS  version  as  TLS
79                     v1.3.  (Added in 7.54.0)
80
81       In  versions of curl prior to 7.54 the CURL_SSLVERSION_TLS options were
82       documented to allow only the specified TLS version,  but  behavior  was
83       inconsistent depending on the TLS library.
84
85

DEFAULT

87       CURL_SSLVERSION_DEFAULT
88

PROTOCOLS

90       All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
91

EXAMPLE

93       CURL *curl = curl_easy_init();
94       if(curl) {
95         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
96
97         /* ask libcurl to use TLS version 1.0 or later */
98         curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
99
100         /* Perform the request */
101         curl_easy_perform(curl);
102       }
103

AVAILABILITY

105       SSLv2  is  disabled  by default since 7.18.1. Other SSL versions avail‐
106       ability may vary depending on which backend libcurl has been  built  to
107       use.
108
109       SSLv3 is disabled by default since 7.39.0.
110

RETURN VALUE

112       Returns  CURLE_OK  if the option is supported, and CURLE_UNKNOWN_OPTION
113       if not.
114

SEE ALSO

116       CURLOPT_USE_SSL(3),   CURLOPT_HTTP_VERSION(3),    CURLOPT_PROXY_SSLVER‐
117       SION(3), CURLOPT_IPRESOLVE(3)
118
119
120
121libcurl 7.76.1                 November 04, 2020         CURLOPT_SSLVERSION(3)
Impressum