Re-implement missing TLS version hack.

Accidentally dropped it when making the current launcher.
This commit is contained in:
Pieter-Jan Briers
2019-08-30 18:11:44 +02:00
parent b40a96f545
commit 12e635a411

View File

@@ -49,6 +49,8 @@ namespace SS14.Launcher
public static void Main(string[] args) public static void Main(string[] args)
{ {
FixTlsVersions();
LiteLoader.Run(() => new Program().Run(), new InitialWindowParameters LiteLoader.Run(() => new Program().Run(), new InitialWindowParameters
{ {
Size = (500, 250), Size = (500, 250),
@@ -303,6 +305,20 @@ namespace SS14.Launcher
return $"SS14.Client_{platform}_x64.zip"; return $"SS14.Client_{platform}_x64.zip";
} }
[Conditional("NET_FRAMEWORK")]
private static void FixTlsVersions()
{
// So, supposedly .NET Framework 4.7 is supposed to automatically select sane TLS versions.
// Yet, it does not for some people. This causes it to try to connect to our servers with
// SSL 3 or TLS 1.0, neither of which are accepted for security reasons.
// (The minimum our servers accept is TLS 1.2)
// So, ONLY on Windows (Mono is fine) and .NET Framework we manually tell it to use TLS 1.2
// I assume .NET Core does not have this issue being disconnected from the OS and all that.
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls12;
}
}
private class LauncherInterface private class LauncherInterface
{ {