5 namespace NaGet.SubCommands.SubTask
7 public class SecurityProtocolConfigSubTask : NaGetSubTask
9 public SecurityProtocolConfigSubTask()
13 public override void Run()
16 RaiseTaskSetEvent(TaskEventType.STARTED, "セキュリティプロトコル設定の確認", 0);
19 if ((ServicePointManager.SecurityProtocol & SecurityProtocolType.Ssl3) != 0) {
20 ServicePointManager.SecurityProtocol &= ~SecurityProtocolType.Ssl3;
21 RaiseTaskSetEvent(TaskEventType.PING, string.Empty, 33);
25 ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls;
28 ServicePointManager.SecurityProtocol |= (SecurityProtocolType)768; // SecurityProtocolType.Tls11
29 RaiseTaskSetEvent(TaskEventType.PING, string.Empty, 66);
30 } catch (NotSupportedException) {
31 RaiseTaskSetEvent(TaskEventType.INFO, "TLSv1.1は有効ではありません", 66);
35 ServicePointManager.SecurityProtocol |= (SecurityProtocolType)3072; // SecurityProtocolType.Tls12
36 RaiseTaskSetEvent(TaskEventType.PING, string.Empty, 99);
37 } catch (NotSupportedException) {
38 RaiseTaskSetEvent(TaskEventType.INFO, "TLSv1.2は有効ではありません", 99);
41 RaiseTaskSetEvent(TaskEventType.COMPLETED, "セキュリティプロトコル設定の確認", 100);