1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-14 03:15:49 +02:00

Add TLS 1.3 to default security protocols

This commit is contained in:
chylex 2022-07-02 22:51:59 +02:00
parent b5bffdb95b
commit 2927097e8e
Signed by: chylex
GPG Key ID: 4DE42C8F19A80548

View File

@ -10,10 +10,10 @@ public static class WebUtils {
private static bool hasMicrosoftBeenBroughtTo2008Yet;
private static bool hasSystemProxyBeenEnabled;
private static void EnsureTLS12() {
private static void EnsureModernTLS() {
if (!hasMicrosoftBeenBroughtTo2008Yet) {
#pragma warning disable CS0618
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13;
ServicePointManager.SecurityProtocol &= ~(SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11);
#pragma warning restore CS0618
hasMicrosoftBeenBroughtTo2008Yet = true;
@ -30,7 +30,7 @@ public static void EnableSystemProxy() {
}
public static WebClient NewClient(string? userAgent = null) {
EnsureTLS12();
EnsureModernTLS();
WebClient client = new WebClient();