-
Notifications
You must be signed in to change notification settings - Fork 5.3k
add TLS 1.3 support to WinHttp #58590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Tagging subscribers to this area: @dotnet/ncl Issue DetailsWinHttp now has and the flag and it seems to work right on Windows 11 #define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_3 0x00002000.NET Framework 4.8 now supports Tls13 as well somebody can use it with casting
|
|
BTW Here is local test run: and 4.8 Framework all tests are passing on Windows 11. |
ManickaP
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| handler.SslProtocols = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12 | SslProtocols.Tls13; | ||
| #else | ||
| handler.SslProtocols = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12; | ||
| handler.SslProtocols = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12 | (SslProtocols)12288; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| handler.SslProtocols = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12 | (SslProtocols)12288; | |
| handler.SslProtocols = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12 | (SslProtocols)0x3000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the reason for 12288 is that's what we use in the definition:
| Tls13 = 12288, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that is rather ugly. I wonder why? Perhaps it was auto-generated at some point?
I would still consider that hex values are more developer-friendly for reading ...
BTW: Definition is technically hex-defined:
runtime/src/libraries/System.Net.Primitives/src/System/Net/SecureProtocols/SslEnumTypes.cs
Line 18 in 57bfe47
| Tls13 = Interop.SChannel.SP_PROT_TLS1_3, |
runtime/src/libraries/Common/src/Interop/Windows/SChannel/Interop.SchProtocols.cs
Lines 31 to 33 in 57bfe47
| public const int SP_PROT_TLS1_3_SERVER = 0x00001000; | |
| public const int SP_PROT_TLS1_3_CLIENT = 0x00002000; | |
| public const int SP_PROT_TLS1_3 = (SP_PROT_TLS1_3_SERVER | SP_PROT_TLS1_3_CLIENT); |
|
|
||
| private void SetSessionHandleTlsOptions(SafeWinHttpHandle sessionHandle) | ||
| { | ||
| const SslProtocols Tls13 = (SslProtocols)12288; // enum is missing in .NET Standard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const SslProtocols Tls13 = (SslProtocols)12288; // enum is missing in .NET Standard | |
| const SslProtocols Tls13 = (SslProtocols)0x3000; // enum is missing in .NET Standard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took the value from documentation. But I don't really care. It seems like the SP_PROT is platform specific mapping that happens to be the same on Windows.
It feels like this is really matter of personal preference.
|
Related test failures: I assume we need to check OS version if the option is supported or not, prior to setting it.
|
|
Once we have it working, we should consider porting it to 6.0 -- that way we will avoid backporting it to servicing once Win11 ships officially. |
|
/backport to release/6.0 |
|
Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1205541997 |
WinHttp now has and the flag and it seems to work right on Windows 11
.NET Framework 4.8 now supports Tls13 as well somebody can use it with casting
intlike the test change.It really does not matter as long as running on supported OS and WinHttp as all the work is done by native code.
blocking #58570
fixes #58587