Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Add TLS1.3 support to ServicePointManager
Browse files Browse the repository at this point in the history
  • Loading branch information
caesay committed Dec 24, 2021
1 parent edf346e commit d53c4da
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Squirrel/Internal/Utility.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.Contracts;
Expand Down Expand Up @@ -111,10 +111,13 @@ public static string CalculateStreamSHA1(Stream file)
}
}

// https://source.dot.net/#System.Net.Primitives/Interop.SchProtocols.cs,acd9ff17ab451613
private const int SP_PROT_TLS1_3_SERVER = 0x00001000;
private const int SP_PROT_TLS1_3_CLIENT = 0x00002000;
private const int SP_PROT_TLS1_3 = (SP_PROT_TLS1_3_SERVER | SP_PROT_TLS1_3_CLIENT);
public static WebClient CreateWebClient()
{
// WHY DOESNT IT JUST DO THISSSSSSSS
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
ServicePointManager.SecurityProtocol = (SecurityProtocolType) SP_PROT_TLS1_3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

var ret = new WebClient();
var wp = WebRequest.DefaultWebProxy;
Expand Down

0 comments on commit d53c4da

Please sign in to comment.