--- /dev/null
+using System;
+using System.Net;
+using NaGet.Tasks;
+
+namespace NaGet.SubCommands.SubTask
+{
+ public class SecurityProtocolConfigSubTask : NaGetSubTask
+ {
+ public SecurityProtocolConfigSubTask()
+ {
+ }
+
+ public override void Run()
+ {
+ NotifyStarted();
+ RaiseTaskSetEvent(TaskEventType.STARTED, "セキュリティプロトコル設定の確認", 0);
+
+ if ((ServicePointManager.SecurityProtocol & SecurityProtocolType.Ssl3) != 0) {
+ ServicePointManager.SecurityProtocol &= ~SecurityProtocolType.Ssl3;
+ RaiseTaskSetEvent(TaskEventType.PING, string.Empty, 33);
+ }
+
+ try {
+ ServicePointManager.SecurityProtocol |= (SecurityProtocolType)768; // SecurityProtocolType.Tls11
+ RaiseTaskSetEvent(TaskEventType.PING, string.Empty, 66);
+ } catch (NotSupportedException) {
+ RaiseTaskSetEvent(TaskEventType.WARNING, "TLSv1.1は有効ではありません", 66);
+ }
+
+ try {
+ ServicePointManager.SecurityProtocol |= (SecurityProtocolType)3072; // SecurityProtocolType.Tls12
+ RaiseTaskSetEvent(TaskEventType.PING, string.Empty, 99);
+ } catch (NotSupportedException) {
+ RaiseTaskSetEvent(TaskEventType.WARNING, "TLSv1.2は有効ではありません", 99);
+ }
+
+ RaiseTaskSetEvent(TaskEventType.COMPLETED, "セキュリティプロトコル設定の確認", 100);
+ NotifyCompleted();
+ }
+ }
+}
// taskセットの初期化
initSubTask();
+ registSubTask("セキュリティプロトコル設定の確認",
+ new SecurityProtocolConfigSubTask());
foreach (Installation inst in installations) {
DownloadSubTask dlSTask = new DownloadSubTask(inst.InstallerURL, inst.InstallerFile);
VirusScanSubTask scanSTask = new VirusScanSubTask(scanner, inst.InstallerFile, inst.InstallerURL);
{
// taskセットの初期化
initSubTask();
+ registSubTask("セキュリティプロトコル設定の確認",
+ new SecurityProtocolConfigSubTask());
foreach (Installation inst in installations) {
VirusScanSubTask scanSTask = new VirusScanSubTask(scanner, inst.InstallerFile, inst.InstallerURL);
// taskセットの初期化
initSubTask();
+ registSubTask("セキュリティプロトコル設定の確認",
+ new SecurityProtocolConfigSubTask());
if (this.downloadPackageLists) {
// repos.list.xmlがあるとき、そこからよみとる。
repoList = NaGet.Utils.GetDeserializedObject<RepositoriesList>(NaGet.Env.RepositoriesListFile);
<Compile Include="NaGet.SubCommands.SubTask\DownloadSubTask.cs" />\r
<Compile Include="NaGet.SubCommands.SubTask\LocalUpdateSubTask.cs" />\r
<Compile Include="NaGet.SubCommands.SubTask\NaGetSubTask.cs" />\r
+ <Compile Include="NaGet.SubCommands.SubTask\SecurityProtocolConfigSubTask.cs" />\r
<Compile Include="NaGet.SubCommands.SubTask\VerifyInstallerFileSubTask.cs" />\r
<Compile Include="NaGet.SubCommands.SubTask\VirusScanSubTask.cs" />\r
<Compile Include="NaGet.SubCommands\NaGetDownloadToCache2.cs" />\r