OSDN Git Service

Windows 7 で TLS1.1/TLS1.2 が有効にならない不具合を修正
authorKimura Youichi <kim.upsilon@bucyou.net>
Tue, 12 Jun 2018 01:22:04 +0000 (10:22 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Tue, 12 Jun 2018 01:22:32 +0000 (10:22 +0900)
通常は SecurityProtocolType.SystemDefault を使用するが、Windows 7 のみTLSのバージョンをハードコーディングする必要がある

OpenTween/Connection/Networking.cs
OpenTween/Resources/ChangeLog.txt

index b0699a6..dc377c6 100644 (file)
@@ -70,6 +70,15 @@ namespace OpenTween.Connection
             }
         }
 
+        private static bool IsWindows7
+        {
+            get
+            {
+                var os = Environment.OSVersion;
+                return os.Platform == PlatformID.Win32NT && os.Version.Major == 6 && os.Version.Minor == 1;
+            }
+        }
+
         /// <summary>
         /// Webプロキシの設定が変更された場合に発生します
         /// </summary>
@@ -95,6 +104,10 @@ namespace OpenTween.Connection
             Networking.initialized = true;
 
             ServicePointManager.Expect100Continue = false;
+
+            // Win7 では SystemDefault が SSL3.0 または TLS1.0 のため、明示的にバージョンを引き上げる必要がある
+            if (IsWindows7)
+                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
         }
 
         public static void SetWebProxy(ProxyType proxyType, string proxyAddress, int proxyPort,
index b0e72fb..4df8dfd 100644 (file)
@@ -2,6 +2,7 @@
 
 ==== Ver 2.0.1-dev(2018/xx/xx)
  * FIX: 起動時に .NET Framework 4.7.2 のバージョンチェックが正しく行われるように修正
+ * FIX: Windows 7 で TLS1.1/TLS1.2 が有効にならない不具合を修正
 
 ==== Ver 2.0.0(2018/06/11)
  * このバージョン以降のOpenTweenは .NET Framework 4.7.2 以上が必須になります