Skip to content

Commit

Permalink
Force-allow TLS 1.2 on .NET 4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Feb 23, 2018
1 parent de628b7 commit fc00de2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Cmdline/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// License: CC-BY 4.0, LGPL, or MIT (your choice)

using System;
using System.Net;
using System.Diagnostics;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -50,6 +51,10 @@ public static int Main(string[] args)
Logging.Initialize();
log.Info("CKAN started.");

// Force-allow TLS 1.2 for HTTPS URLs, because GitHub requires it.
// This is on by default in .NET 4.6, but not in 4.5.
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;

// If we're starting with no options then invoke the GUI instead.
if (args.Length == 0)
{
Expand Down
5 changes: 5 additions & 0 deletions Netkan/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Net;
using System.Diagnostics;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -31,6 +32,10 @@ public static int Main(string[] args)
{
ProcessArgs(args);

// Force-allow TLS 1.2 for HTTPS URLs, because GitHub requires it.
// This is on by default in .NET 4.6, but not in 4.5.
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;

// If we see the --version flag, then display our build info
// and exit.
if (Options.Version)
Expand Down

0 comments on commit fc00de2

Please sign in to comment.