From c950cda072ada8bb2576eb3d4f264f0af94b9d43 Mon Sep 17 00:00:00 2001 From: Andrew Walter Date: Sun, 14 Jan 2018 15:20:13 -0500 Subject: [PATCH] Disable SSL check when downloading mods Following Horcrux's previous workaround described in https://github.com/KSP-CKAN/CKAN/issues/2142, disable SSL certificate verification when downloading mods. PLEASE USE THIS WITH EXTREME CAUTION - SSL CHECKS PROTECT YOUR COMPUTER --- Core/Net/Net.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Core/Net/Net.cs b/Core/Net/Net.cs index ad875b118b..329d7fdd18 100644 --- a/Core/Net/Net.cs +++ b/Core/Net/Net.cs @@ -3,6 +3,7 @@ using System.IO; using System.Linq; using System.Net; +using System.Net.Security; using System.Text; using System.Text.RegularExpressions; using ChinhDo.Transactions; @@ -50,6 +51,22 @@ public static string Download(string url, string filename = null, IUser user = n var agent = MakeDefaultHttpClient(); + // WARNING: this disables all SSL checks. DANGER!!! + // from https://stackoverflow.com/a/1301221 + try + { + //Change SSL checks so that all checks pass + ServicePointManager.ServerCertificateValidationCallback = + new RemoteCertificateValidationCallback( + delegate + { return true; } + ); + } + catch (Exception ex) + { + //ActivityLog.InsertSyncActivity(ex); + } + try { agent.DownloadFile(url, filename);