Skip to content

Commit d30157d

Browse files
authored
Add initial support for TLS 1.3 to .NET Core
* TLS 1.3 connections have been tested on Ubuntu 18.10 (OpenSSL 1.1.1). * There's no public version of Windows with TLS 1.3 enabled. * There's no public version of macOS with TLS 1.3 enabled out of the box. When making use of SslProtocols.None (system default) TLS 1.3 is already working on Ubuntu 18.10, this change mainly makes it so that EncryptionPolicy.None is better handled, and that we can restrict-to and report TLS 1.3.
1 parent ee0f9aa commit d30157d

File tree

26 files changed

+124
-14
lines changed

26 files changed

+124
-14
lines changed

src/Common/src/Interop/Unix/System.Net.Http.Native/Interop.Easy.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ internal enum CurlSslVersion
166166
CURL_SSLVERSION_TLSv1_0 = 4, /* TLS 1.0 */
167167
CURL_SSLVERSION_TLSv1_1 = 5, /* TLS 1.1 */
168168
CURL_SSLVERSION_TLSv1_2 = 6, /* TLS 1.2 */
169+
CURL_SSLVERSION_TLSv1_3 = 7, /* TLS 1.3 */
169170
};
170171

171172
// Enum for constants defined for the enum CURLINFO in curl.h

src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,27 @@ internal static SafeSslHandle AllocateSslContext(SslProtocols protocols, SafeX50
6464
throw CreateSslException(SR.net_allocate_ssl_context_failed);
6565
}
6666

67+
// TLS 1.3 uses different ciphersuite restrictions than previous versions.
68+
// It has no equivalent to a NoEncryption option.
69+
if (policy == EncryptionPolicy.NoEncryption)
70+
{
71+
if (protocols == SslProtocols.None)
72+
{
73+
protocols = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12;
74+
}
75+
else
76+
{
77+
protocols &= ~SslProtocols.Tls13;
78+
79+
if (protocols == SslProtocols.None)
80+
{
81+
throw new SslException(
82+
SR.Format(SR.net_ssl_encryptionpolicy_notsupported, policy));
83+
}
84+
}
85+
}
86+
87+
6788
// Configure allowed protocols. It's ok to use DangerousGetHandle here without AddRef/Release as we just
6889
// create the handle, it's rooted by the using, no one else has a reference to it, etc.
6990
Ssl.SetProtocolOptions(innerContext.DangerousGetHandle(), protocols);

src/Common/src/Interop/Windows/SChannel/Interop.SchProtocols.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,14 @@ internal static partial class SChannel
2929
public const int SP_PROT_TLS1_2_CLIENT = 0x00000800;
3030
public const int SP_PROT_TLS1_2 = (SP_PROT_TLS1_2_SERVER | SP_PROT_TLS1_2_CLIENT);
3131

32+
public const int SP_PROT_TLS1_3_SERVER = 0x00001000;
33+
public const int SP_PROT_TLS1_3_CLIENT = 0x00002000;
34+
public const int SP_PROT_TLS1_3 = (SP_PROT_TLS1_3_SERVER | SP_PROT_TLS1_3_CLIENT);
35+
3236
public const int SP_PROT_NONE = 0;
3337

3438
// These two constants are not taken from schannel.h.
35-
public const int ClientProtocolMask = (SP_PROT_SSL2_CLIENT | SP_PROT_SSL3_CLIENT | SP_PROT_TLS1_0_CLIENT | SP_PROT_TLS1_1_CLIENT | SP_PROT_TLS1_2_CLIENT);
36-
public const int ServerProtocolMask = (SP_PROT_SSL2_SERVER | SP_PROT_SSL3_SERVER | SP_PROT_TLS1_0_SERVER | SP_PROT_TLS1_1_SERVER | SP_PROT_TLS1_2_SERVER);
39+
public const int ClientProtocolMask = (SP_PROT_SSL2_CLIENT | SP_PROT_SSL3_CLIENT | SP_PROT_TLS1_0_CLIENT | SP_PROT_TLS1_1_CLIENT | SP_PROT_TLS1_2_CLIENT | SP_PROT_TLS1_3_CLIENT);
40+
public const int ServerProtocolMask = (SP_PROT_SSL2_SERVER | SP_PROT_SSL3_SERVER | SP_PROT_TLS1_0_SERVER | SP_PROT_TLS1_1_SERVER | SP_PROT_TLS1_2_SERVER | SP_PROT_TLS1_3_SERVER);
3741
}
3842
}

src/Common/src/System/Net/SecurityProtocol.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ namespace System.Net
88
{
99
internal static class SecurityProtocol
1010
{
11-
public const SslProtocols DefaultSecurityProtocols = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12;
11+
public const SslProtocols DefaultSecurityProtocols =
12+
#if !netstandard && !netfx
13+
SslProtocols.Tls13 |
14+
#endif
15+
SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12;
1216

1317
public const SslProtocols SystemDefaultSecurityProtocols = SslProtocols.None;
1418
}

src/Common/tests/System/Net/Http/LoopbackServer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,11 @@ public class Options
350350
public IPAddress Address { get; set; } = IPAddress.Loopback;
351351
public int ListenBacklog { get; set; } = 1;
352352
public bool UseSsl { get; set; } = false;
353-
public SslProtocols SslProtocols { get; set; } = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12;
353+
public SslProtocols SslProtocols { get; set; } =
354+
#if !netstandard
355+
SslProtocols.Tls13 |
356+
#endif
357+
SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12;
354358
public bool WebSocketEndpoint { get; set; } = false;
355359
public Func<Stream, Stream> StreamWrapper { get; set; }
356360
public string Username { get; set; }

src/Common/tests/System/Net/SslProtocolSupport.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ namespace System.Net.Test.Common
1111
{
1212
public class SslProtocolSupport
1313
{
14-
public const SslProtocols DefaultSslProtocols = SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls;
14+
public const SslProtocols DefaultSslProtocols =
15+
#if !netstandard
16+
SslProtocols.Tls13 |
17+
#endif
18+
SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls;
1519

1620
public static SslProtocols SupportedSslProtocols
1721
{
@@ -26,6 +30,13 @@ public static SslProtocols SupportedSslProtocols
2630
supported |= SslProtocols.Ssl3;
2731
}
2832
#pragma warning restore 0618
33+
#if !netstandard
34+
// TLS 1.3 is new
35+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && PlatformDetection.OpenSslVersion >= new Version(1, 1, 1))
36+
{
37+
supported |= SslProtocols.Tls13;
38+
}
39+
#endif
2940
return supported;
3041
}
3142
}

src/CoreFx.Private.TestUtilities/ref/CoreFx.Private.TestUtilities.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public static partial class PlatformDetection
102102
public static bool IsUbuntu1710 { get { throw null; } }
103103
public static bool IsUbuntu1710OrHigher { get { throw null; } }
104104
public static bool IsUbuntu1804 { get { throw null; } }
105+
public static bool IsUbuntu1810OrHigher { get { throw null; } }
105106
public static bool IsWindows { get { throw null; } }
106107
public static bool IsWindows10Version1607OrGreater { get { throw null; } } // >= Windows 10 Anniversary Update
107108
public static bool IsWindows10Version1703OrGreater { get { throw null; } } // >= Windows 10 Creators Update

src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Unix.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public static partial class PlatformDetection
3838
public static bool IsUbuntu1710 => IsDistroAndVersion("ubuntu", 17, 10);
3939
public static bool IsUbuntu1710OrHigher => IsDistroAndVersionOrHigher("ubuntu", 17, 10);
4040
public static bool IsUbuntu1804 => IsDistroAndVersion("ubuntu", 18, 04);
41+
public static bool IsUbuntu1810OrHigher => IsDistroAndVersionOrHigher("ubuntu", 18, 10);
4142
public static bool IsTizen => IsDistroAndVersion("tizen");
4243
public static bool IsFedora => IsDistroAndVersion("fedora");
4344
public static bool IsWindowsNanoServer => false;
@@ -213,10 +214,10 @@ private static bool VersionEquivalentToOrHigher(int major, int minor, int build,
213214
return
214215
VersionEquivalentTo(major, minor, build, revision, actualVersionId) ||
215216
(actualVersionId.Major > major ||
216-
(actualVersionId.Major == major && actualVersionId.Minor > minor ||
217-
(actualVersionId.Minor == minor && actualVersionId.Build > build ||
218-
(actualVersionId.Build == build && actualVersionId.Revision > revision ||
219-
(actualVersionId.Revision == revision)))));
217+
(actualVersionId.Major == major && (actualVersionId.Minor > minor ||
218+
(actualVersionId.Minor == minor && (actualVersionId.Build > build ||
219+
(actualVersionId.Build == build && (actualVersionId.Revision > revision ||
220+
(actualVersionId.Revision == revision))))))));
220221
}
221222

222223
private static Version GetOSXProductVersion()

src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Windows.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public static partial class PlatformDetection
2929
public static bool IsUbuntu1710 => false;
3030
public static bool IsUbuntu1710OrHigher => false;
3131
public static bool IsUbuntu1804 => false;
32+
public static bool IsUbuntu1810OrHigher => false;
3233
public static bool IsTizen => false;
3334
public static bool IsNotFedoraOrRedHatFamily => true;
3435
public static bool IsFedora => false;

src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ssl.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#include "pal_ssl.h"
66
#include <dlfcn.h>
77

8+
// TLS 1.3 is only defined with 10.13 headers, but we build on 10.12
9+
#define kTLSProtocol13_ForwardDef 10
10+
811
// 10.13.4 introduced public API but linking would fail on all prior versions.
912
// For that reason we use function pointers instead of direct call.
1013
// This can be revisited after we drop support for 10.12.
@@ -31,6 +34,8 @@ static SSLProtocol PalSslProtocolToSslProtocol(PAL_SslProtocol palProtocolId)
3134
{
3235
switch (palProtocolId)
3336
{
37+
case PAL_SslProtocol_Tls13:
38+
return kTLSProtocol13_ForwardDef;
3439
case PAL_SslProtocol_Tls12:
3540
return kTLSProtocol12;
3641
case PAL_SslProtocol_Tls11:
@@ -419,7 +424,9 @@ int32_t AppleCryptoNative_SslGetProtocolVersion(SSLContextRef sslContext, PAL_Ss
419424
{
420425
PAL_SslProtocol matchedProtocol = PAL_SslProtocol_None;
421426

422-
if (protocol == kTLSProtocol12)
427+
if (protocol == kTLSProtocol13_ForwardDef)
428+
matchedProtocol = PAL_SslProtocol_Tls13;
429+
else if (protocol == kTLSProtocol12)
423430
matchedProtocol = PAL_SslProtocol_Tls12;
424431
else if (protocol == kTLSProtocol11)
425432
matchedProtocol = PAL_SslProtocol_Tls11;

src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ssl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ enum
3535
PAL_SslProtocol_Tls10 = 192,
3636
PAL_SslProtocol_Tls11 = 768,
3737
PAL_SslProtocol_Tls12 = 3072,
38+
PAL_SslProtocol_Tls13 = 12288,
3839
};
3940
typedef int32_t PAL_SslProtocol;
4041

src/Native/Unix/System.Security.Cryptography.Native/pal_ssl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@ void CryptoNative_SetProtocolOptions(SSL_CTX* ctx, SslProtocols protocols)
147147
#ifndef SSL_OP_NO_TLSv1_3
148148
#define SSL_OP_NO_TLSv1_3 0x20000000U
149149
#endif
150-
protocolOptions |= SSL_OP_NO_TLSv1_3;
150+
if ((protocols & PAL_SSL_TLS13) != PAL_SSL_TLS13)
151+
{
152+
protocolOptions |= SSL_OP_NO_TLSv1_3;
153+
}
151154

152155
// OpenSSL 1.0 calls this long, OpenSSL 1.1 calls it unsigned long.
153156
#pragma clang diagnostic push

src/Native/Unix/System.Security.Cryptography.Native/pal_ssl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ typedef enum
1616
PAL_SSL_SSL3 = 48,
1717
PAL_SSL_TLS = 192,
1818
PAL_SSL_TLS11 = 768,
19-
PAL_SSL_TLS12 = 3072
19+
PAL_SSL_TLS12 = 3072,
20+
PAL_SSL_TLS13 = 12288,
2021
} SslProtocols;
2122

2223
/*

src/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
<ILLinkClearInitLocals>true</ILLinkClearInitLocals>
1212
<Configurations>net461-Windows_NT-Debug;net461-Windows_NT-Release;netfx-Windows_NT-Debug;netfx-Windows_NT-Release;netstandard-Debug;netstandard-Release;netstandard-Windows_NT-Debug;netstandard-Windows_NT-Release</Configurations>
1313
</PropertyGroup>
14+
<PropertyGroup Condition="'$(TargetGroup)' == 'net461'">
15+
<DefineConstants>$(DefineConstants);netfx</DefineConstants>
16+
</PropertyGroup>
1417
<Import Project="System.Net.Http.WinHttpHandler.msbuild" Condition="'$(TargetsWindows)' == 'true'" />
1518
<ItemGroup Condition="'$(TargetGroup)' == 'net46' OR '$(TargetGroup)' == 'net461'">
1619
<!-- Need to compile it here since the NET46 target here is building against System.Runtime whereas the
@@ -61,4 +64,4 @@
6164
<Reference Include="System.Threading" />
6265
<Reference Include="System.Threading.Tasks" />
6366
</ItemGroup>
64-
</Project>
67+
</Project>

src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,17 @@ private void SetSessionHandleTlsOptions(SafeWinHttpHandle sessionHandle)
979979
optionData |= Interop.WinHttp.WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2;
980980
}
981981

982+
// As of Win10RS5 there's no public constant for WinHTTP + TLS 1.3
983+
// This library builds against netstandard, which doesn't define the Tls13 enum field.
984+
985+
// If only unknown values (e.g. TLS 1.3) were asked for, report ERROR_INVALID_PARAMETER.
986+
if (optionData == 0)
987+
{
988+
throw WinHttpException.CreateExceptionUsingError(
989+
unchecked((int)Interop.WinHttp.ERROR_INVALID_PARAMETER),
990+
nameof(SetSessionHandleTlsOptions));
991+
}
992+
982993
SetWinHttpOption(sessionHandle, Interop.WinHttp.WINHTTP_OPTION_SECURE_PROTOCOLS, ref optionData);
983994
}
984995

src/System.Net.Http/src/System/Net/Http/CurlHandler/CurlHandler.SslProvider.Linux.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,12 @@ private static void SetSslOptionsForUnsupportedBackend(EasyRequest easy, ClientC
233233
case SslProtocols.Tls12:
234234
curlSslVersion = Interop.Http.CurlSslVersion.CURL_SSLVERSION_TLSv1_2;
235235
break;
236+
case SslProtocols.Tls13:
237+
curlSslVersion = Interop.Http.CurlSslVersion.CURL_SSLVERSION_TLSv1_3;
238+
break;
236239

237240
case SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12:
241+
case SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12 | SslProtocols.Tls13:
238242
curlSslVersion = Interop.Http.CurlSslVersion.CURL_SSLVERSION_TLSv1;
239243
break;
240244

src/System.Net.Http/src/System/Net/Http/CurlHandler/CurlHandler.SslProvider.OSX.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,12 @@ private static void SetSslVersion(EasyRequest easy)
125125
case SslProtocols.Tls12:
126126
curlSslVersion = Interop.Http.CurlSslVersion.CURL_SSLVERSION_TLSv1_2;
127127
break;
128+
case SslProtocols.Tls13:
129+
curlSslVersion = Interop.Http.CurlSslVersion.CURL_SSLVERSION_TLSv1_3;
130+
break;
128131

129132
case SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12:
133+
case SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12 | SslProtocols.Tls13:
130134
curlSslVersion = Interop.Http.CurlSslVersion.CURL_SSLVERSION_TLSv1;
131135
break;
132136

src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.AcceptAllCerts.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public void SingletonReturnsTrue()
2929
[InlineData(SslProtocols.Tls, true)]
3030
[InlineData(SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls, false)]
3131
[InlineData(SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls, true)]
32+
[InlineData(SslProtocols.Tls13 | SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls, false)]
33+
[InlineData(SslProtocols.Tls13 | SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls, true)]
3234
[InlineData(SslProtocols.None, false)]
3335
[InlineData(SslProtocols.None, true)]
3436
public async Task SetDelegate_ConnectionSucceeds(SslProtocols acceptedProtocol, bool requestOnlyThisProtocol)

src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.SslProtocols.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ public void DefaultProtocols_MatchesExpected()
3737
[InlineData(SslProtocols.Tls11 | SslProtocols.Tls12)]
3838
[InlineData(SslProtocols.Tls | SslProtocols.Tls12)]
3939
[InlineData(SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12)]
40+
#if !netstandard
41+
[InlineData(SslProtocols.Tls13)]
42+
[InlineData(SslProtocols.Tls11 | SslProtocols.Tls13)]
43+
[InlineData(SslProtocols.Tls12 | SslProtocols.Tls13)]
44+
[InlineData(SslProtocols.Tls | SslProtocols.Tls13)]
45+
[InlineData(SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12 | SslProtocols.Tls13)]
46+
#endif
4047
public void SetGetProtocols_Roundtrips(SslProtocols protocols)
4148
{
4249
using (HttpClientHandler handler = CreateHttpClientHandler())
@@ -97,6 +104,14 @@ public static IEnumerable<object[]> GetAsync_AllowedSSLVersion_Succeeds_MemberDa
97104
yield return new object[] { SslProtocols.Ssl2, true };
98105
}
99106
#pragma warning restore 0618
107+
#if !netstandard
108+
// These protocols are new, and might not be enabled everywhere yet
109+
if (PlatformDetection.IsUbuntu1810OrHigher)
110+
{
111+
yield return new object[] { SslProtocols.Tls13, false };
112+
yield return new object[] { SslProtocols.Tls13, true };
113+
}
114+
#endif
100115
}
101116

102117
[Theory]

src/System.Net.Primitives/ref/System.Net.Primitives.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ public enum SslProtocols
508508
Tls = 192,
509509
Tls11 = 768,
510510
Tls12 = 3072,
511+
Tls13 = 12288,
511512
[Obsolete("This value has been deprecated. It is no longer supported. https://go.microsoft.com/fwlink/?linkid=14202")]
512513
Default = Ssl3 | Tls
513514
}

src/System.Net.Primitives/src/System/Net/SecureProtocols/SslEnumTypes.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public enum SslProtocols
1616
Tls = Interop.SChannel.SP_PROT_TLS1_0,
1717
Tls11 = Interop.SChannel.SP_PROT_TLS1_1,
1818
Tls12 = Interop.SChannel.SP_PROT_TLS1_2,
19+
Tls13 = Interop.SChannel.SP_PROT_TLS1_3,
1920
Default = Ssl3 | Tls
2021
}
2122

src/System.Net.Security/src/System/Net/Security/SslConnectionInfo.Unix.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ private SslProtocols MapProtocolVersion(string protocolVersion)
5959
return SslProtocols.Tls11;
6060
case "TLSv1.2":
6161
return SslProtocols.Tls12;
62+
case "TLSv1.3":
63+
return SslProtocols.Tls13;
6264
default:
6365
return SslProtocols.None;
6466
}

src/System.Net.Security/src/System/Net/Security/SslState.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,11 @@ internal SslProtocols SslProtocol
376376
ret |= SslProtocols.Tls12;
377377
}
378378

379+
if ((proto & SslProtocols.Tls13) != 0)
380+
{
381+
ret |= SslProtocols.Tls13;
382+
}
383+
379384
return ret;
380385
}
381386
}

src/System.Net.ServicePoint/ref/System.Net.ServicePoint.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,6 @@ public enum SecurityProtocolType
6262
Tls = System.Security.Authentication.SslProtocols.Tls,
6363
Tls11 = System.Security.Authentication.SslProtocols.Tls11,
6464
Tls12 = System.Security.Authentication.SslProtocols.Tls12,
65+
Tls13 = System.Security.Authentication.SslProtocols.Tls13,
6566
}
6667
}

src/System.Net.ServicePoint/src/System/Net/SecurityProtocolType.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ public enum SecurityProtocolType
1616
Tls = SslProtocols.Tls,
1717
Tls11 = SslProtocols.Tls11,
1818
Tls12 = SslProtocols.Tls12,
19+
Tls13 = SslProtocols.Tls13,
1920
}
2021
}

src/System.Net.ServicePoint/src/System/Net/ServicePointManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static SecurityProtocolType SecurityProtocol
3636

3737
private static void ValidateSecurityProtocol(SecurityProtocolType value)
3838
{
39-
SecurityProtocolType allowed = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
39+
SecurityProtocolType allowed = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13;
4040
if ((value & ~allowed) != 0)
4141
{
4242
throw new NotSupportedException(SR.net_securityprotocolnotsupported);

0 commit comments

Comments
 (0)