1CURLOPT_SSLVERSION(3) curl_easy_setopt options CURLOPT_SSLVERSION(3)
2
3
4
6 CURLOPT_SSLVERSION - set preferred TLS/SSL version
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLVERSION, long ver‐
12 sion);
13
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
24 options 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
54 CURL_SSLVERSION_ macros with one of the CURL_SSLVERSION_MAX_ macros.
55 The MAX 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
82 CURL_SSLVERSION_DEFAULT
83
85 All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
86
88 CURL *curl = curl_easy_init();
89 if(curl) {
90 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
91
92 /* ask libcurl to use TLS version 1.0 or later */
93 curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
94
95 /* Perform the request */
96 curl_easy_perform(curl);
97 }
98
100 SSLv2 is disabled by default since 7.18.1. Other SSL versions avail‐
101 ability may vary depending on which backend libcurl has been built to
102 use.
103
104 SSLv3 is disabled by default since 7.39.0.
105
107 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
108 if not.
109
111 CURLOPT_USE_SSL(3), CURLOPT_HTTP_VERSION(3), CURLOPT_PROXY_SSLVER‐
112 SION(3), CURLOPT_IPRESOLVE(3)
113
114
115
116libcurl 7.64.0 October 30, 2018 CURLOPT_SSLVERSION(3)