Skip to content
Permalink
Browse files
Support TLS1.2 on .NET Framework 3.5
  • Loading branch information
Sheile committed May 8, 2020
1 parent 7999999 commit 6626b659e776fd5927595e49722cc57c5fc254f0
Showing 4 changed files with 23 additions and 1 deletion.
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Windows.Forms;

namespace TwitterClient
@@ -12,6 +13,7 @@ static class Program
[STAThread]
static int Main(string[] args)
{
ServicePointManager.SecurityProtocol = SecurityProtocolTypeExtensions.Tls11 | SecurityProtocolTypeExtensions.Tls12;
if (args.Length == 0) return 1;
if (args[0] == "--config")
{
@@ -0,0 +1,10 @@
namespace System.Net
{
using System.Security.Authentication;
public static class SecurityProtocolTypeExtensions
{
public const SecurityProtocolType Tls12 = (SecurityProtocolType)SslProtocolsExtensions.Tls12;
public const SecurityProtocolType Tls11 = (SecurityProtocolType)SslProtocolsExtensions.Tls11;
public const SecurityProtocolType SystemDefault = (SecurityProtocolType)0;
}
}
@@ -0,0 +1,8 @@
namespace System.Security.Authentication
{
public static class SslProtocolsExtensions
{
public const SslProtocols Tls12 = (SslProtocols)0x00000C00;
public const SslProtocols Tls11 = (SslProtocols)0x00000300;
}
}
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TwitterClient</RootNamespace>
<AssemblyName>sstwitter</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
@@ -51,6 +51,8 @@
<Compile Include="OAuthBase.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SecurityProtocolTypeExtensions.cs" />
<Compile Include="SslProtocolsExtensions.cs" />
<Compile Include="Twitter.cs" />
<Compile Include="TwitterToken.cs" />
<Compile Include="WebClient.cs" />

0 comments on commit 6626b65

Please sign in to comment.