OSDN Git Service

na-get-lib,TLS関連のエラーメッセージを修復。TLSv1.0は現時点では有効とする v1.4.6b2
authorttp <ttp@users.sourceforge.jp>
Mon, 9 Oct 2017 15:32:30 +0000 (00:32 +0900)
committerttp <ttp@users.sourceforge.jp>
Mon, 9 Oct 2017 15:32:30 +0000 (00:32 +0900)
na-get-lib/NaGet.SubCommands.SubTask/DownloadSubTask.cs
na-get-lib/NaGet.SubCommands.SubTask/SecurityProtocolConfigSubTask.cs

index c1ff3e4..a0b4552 100644 (file)
@@ -171,10 +171,14 @@ namespace NaGet.SubCommands.SubTask
                                
                                RaiseTaskSetEvent(TaskEventType.COMPLETED, "ダウンロード終了", 100);
                        } catch (System.Net.WebException e) {
                                
                                RaiseTaskSetEvent(TaskEventType.COMPLETED, "ダウンロード終了", 100);
                        } catch (System.Net.WebException e) {
-                               if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()) {
+                               if ((e.InnerException != null) &&
+                                   (e.InnerException.InnerException != null) &&
+                                   (e.InnerException.InnerException is System.Security.Authentication.AuthenticationException)) {
+                                       RaiseTaskSetEvent(TaskEventType.WARNING, "接続を試みましたが、認証またはTLS(SSL)接続に失敗しました。", -1);
+                               } else if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()) {
                                        RaiseTaskSetEvent(TaskEventType.WARNING, "ネットワークに接続されていません。", -1);
                                } else {
                                        RaiseTaskSetEvent(TaskEventType.WARNING, "ネットワークに接続されていません。", -1);
                                } else {
-                                       RaiseTaskSetEvent(TaskEventType.WARNING, "ã\83\8dã\83\83ã\83\88ã\83¯ã\83¼ã\82¯ã\81«æ\8e¥ç¶\9aã\81§ã\81\8dã\81¾ã\81\9bã\82\93ã\81§ã\81\97ã\81\9fã\80\82ã\83\8dã\83\83ã\83\88ã\83¯ã\83¼ã\82¯ã\81\8cå\88\87æ\96­ã\81\95ã\82\8cã\81¦ã\81\84ã\82\8bか、ファイアウォールによって遮断された可能性があります。", -1);
+                                       RaiseTaskSetEvent(TaskEventType.WARNING, "ã\82µã\83¼ã\83\90ã\81«æ\8e¥ç¶\9aã\81§ã\81\8dã\81¾ã\81\9bã\82\93ã\81§ã\81\97ã\81\9fã\80\82å\88\87æ\96­ã\81\95ã\82\8cã\81\9fか、ファイアウォールによって遮断された可能性があります。", -1);
                                }
                                throw new System.Net.WebException(e.Message, e);
                        } finally {
                                }
                                throw new System.Net.WebException(e.Message, e);
                        } finally {
index fdfc096..ec04e9b 100644 (file)
@@ -15,11 +15,15 @@ namespace NaGet.SubCommands.SubTask
                        NotifyStarted();
                        RaiseTaskSetEvent(TaskEventType.STARTED, "セキュリティプロトコル設定の確認", 0);
                        
                        NotifyStarted();
                        RaiseTaskSetEvent(TaskEventType.STARTED, "セキュリティプロトコル設定の確認", 0);
                        
+                       // SSLv3無効化
                        if ((ServicePointManager.SecurityProtocol & SecurityProtocolType.Ssl3) != 0) {
                                ServicePointManager.SecurityProtocol &= ~SecurityProtocolType.Ssl3;
                                RaiseTaskSetEvent(TaskEventType.PING, string.Empty, 33);
                        }
                        
                        if ((ServicePointManager.SecurityProtocol & SecurityProtocolType.Ssl3) != 0) {
                                ServicePointManager.SecurityProtocol &= ~SecurityProtocolType.Ssl3;
                                RaiseTaskSetEvent(TaskEventType.PING, string.Empty, 33);
                        }
                        
+                       // TLSv1.0有効化
+                       ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls;
+                       
                        try {
                                ServicePointManager.SecurityProtocol |= (SecurityProtocolType)768; // SecurityProtocolType.Tls11
                                RaiseTaskSetEvent(TaskEventType.PING, string.Empty, 66);
                        try {
                                ServicePointManager.SecurityProtocol |= (SecurityProtocolType)768; // SecurityProtocolType.Tls11
                                RaiseTaskSetEvent(TaskEventType.PING, string.Empty, 66);