diff --git a/Arcade.sln b/Arcade.sln
index 3bd9171814a..b2eeb0ff6e2 100644
--- a/Arcade.sln
+++ b/Arcade.sln
@@ -97,8 +97,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Build.Task
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.RemoteExecutor.Tests", "src\Microsoft.DotNet.RemoteExecutor\tests\Microsoft.DotNet.RemoteExecutor.Tests.csproj", "{D6AC20A4-1719-49FE-B112-B2AB564496F8}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestProjects", "TestProjects", "{6F517597-E9E2-43B2-B7E2-757132EA525C}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Build.Tasks.Archives", "src\Microsoft.DotNet.Build.Tasks.Archives\Microsoft.DotNet.Build.Tasks.Archives.csproj", "{5579768A-CC07-477C-ACE4-06FE9B0686A7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.SourceBuild.Tasks", "src\Microsoft.DotNet.SourceBuild\tasks\Microsoft.DotNet.SourceBuild.Tasks.csproj", "{F9D72AF5-9320-43C8-A24F-CBE294FCED0A}"
@@ -129,10 +127,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Build.Task
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Build.Tasks.Templating.Tests", "src\Microsoft.DotNet.Build.Tasks.Templating\test\Microsoft.DotNet.Build.Tasks.Templating.Tests.csproj", "{FB4168D5-6EA6-4777-AD4F-95758C177FE8}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{6DA9F58A-34D5-45A6-998E-5D2B8037C3FE}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Microsoft.DotNet.XUnitAssert", "Microsoft.DotNet.XUnitAssert", "{3C542789-2576-48C8-9772-C9D7575F7E42}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.XUnitAssert", "src\Microsoft.DotNet.XUnitAssert\src\Microsoft.DotNet.XUnitAssert.csproj", "{AB8D5F86-60FA-416A-B047-83B1E9118425}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.XUnitAssert.Tests", "src\Microsoft.DotNet.XUnitAssert\tests\Microsoft.DotNet.XUnitAssert.Tests.csproj", "{14462553-E4E1-4F67-B954-4BF24B1DAAFE}"
@@ -151,9 +145,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Internal.S
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.ArcadeAzureIntegration", "src\Microsoft.DotNet.ArcadeAzureIntegration\Microsoft.DotNet.ArcadeAzureIntegration.csproj", "{CA159C84-CD7D-4364-9121-3842F97D4B60}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.DotNet.MacOsPkg", "src\Microsoft.DotNet.MacOsPkg\Microsoft.DotNet.MacOsPkg.csproj", "{CE0FAEB2-4B8A-4A37-840D-7FF88ECB42A0}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.MacOsPkg", "src\Microsoft.DotNet.MacOsPkg\Microsoft.DotNet.MacOsPkg.csproj", "{CE0FAEB2-4B8A-4A37-840D-7FF88ECB42A0}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.DotNet.MacOsPkg.Tests", "src\Microsoft.DotNet.MacOsPkg.Tests\Microsoft.DotNet.MacOsPkg.Tests.csproj", "{1F5118A8-A5C5-4D18-AF34-FFB60FECCD45}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.MacOsPkg.Tests", "src\Microsoft.DotNet.MacOsPkg.Tests\Microsoft.DotNet.MacOsPkg.Tests.csproj", "{1F5118A8-A5C5-4D18-AF34-FFB60FECCD45}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -1009,13 +1003,10 @@ Global
{B5E9D9D8-59E0-49F8-9C3C-75138A2D452C} = {C53DD924-C212-49EA-9BC4-1827421361EF}
{0B5D3C20-EB58-4A82-A3AA-2E626A17B35D} = {C53DD924-C212-49EA-9BC4-1827421361EF}
{FB4168D5-6EA6-4777-AD4F-95758C177FE8} = {C53DD924-C212-49EA-9BC4-1827421361EF}
- {3C542789-2576-48C8-9772-C9D7575F7E42} = {6DA9F58A-34D5-45A6-998E-5D2B8037C3FE}
- {AB8D5F86-60FA-416A-B047-83B1E9118425} = {3C542789-2576-48C8-9772-C9D7575F7E42}
- {14462553-E4E1-4F67-B954-4BF24B1DAAFE} = {3C542789-2576-48C8-9772-C9D7575F7E42}
+ {14462553-E4E1-4F67-B954-4BF24B1DAAFE} = {C53DD924-C212-49EA-9BC4-1827421361EF}
{650B7526-7B8A-45B5-B14E-C16D828891B2} = {C53DD924-C212-49EA-9BC4-1827421361EF}
{6BA81447-C61D-4F91-BF0F-5B17AF4CFFAC} = {C53DD924-C212-49EA-9BC4-1827421361EF}
- {CE0FAEB2-4B8A-4A37-840D-7FF88ECB42A0} = {6DA9F58A-34D5-45A6-998E-5D2B8037C3FE}
- {1F5118A8-A5C5-4D18-AF34-FFB60FECCD45} = {6DA9F58A-34D5-45A6-998E-5D2B8037C3FE}
+ {1F5118A8-A5C5-4D18-AF34-FFB60FECCD45} = {C53DD924-C212-49EA-9BC4-1827421361EF}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {32B9C883-432E-4FC8-A1BF-090EB033DD5B}
diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.proj b/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.proj
index b4c7aab2df6..aa556444b58 100644
--- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.proj
+++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.proj
@@ -20,6 +20,7 @@
+
@@ -57,6 +58,9 @@
$(NuGetPackageRoot)sn\$(SNVersion)\sn.exe
+
+
+ $(NuGetPackageRoot)microsoft.dotnet.macospkg\$(MicrosoftDotNetMacOsPkgVersion)\tools\$(NetToolCurrent)\any\Microsoft.Dotnet.MacOsPkg.dll
diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.props b/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.props
index 5889e5bacf8..b07c3d4dbc3 100644
--- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.props
+++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.props
@@ -18,11 +18,14 @@
+
+
+
+
+
@@ -60,6 +63,13 @@
+
+
+
+
+
+
+
+
+ <_PkgToolPattern>@(_PkgToolPath->'%(RootDir)%(Directory)')**\*.*
+
+
+ <_PkgToolFiles Include="$(_PkgToolPattern)"/>
+
+
+
+
+
diff --git a/src/Microsoft.DotNet.SignTool.Tests/Resources/NestedPkg.pkg b/src/Microsoft.DotNet.SignTool.Tests/Resources/NestedPkg.pkg
new file mode 100644
index 00000000000..9e72d029f1b
Binary files /dev/null and b/src/Microsoft.DotNet.SignTool.Tests/Resources/NestedPkg.pkg differ
diff --git a/src/Microsoft.DotNet.SignTool.Tests/Resources/WithApp.pkg b/src/Microsoft.DotNet.SignTool.Tests/Resources/WithApp.pkg
new file mode 100644
index 00000000000..ee5974edf8a
Binary files /dev/null and b/src/Microsoft.DotNet.SignTool.Tests/Resources/WithApp.pkg differ
diff --git a/src/Microsoft.DotNet.SignTool.Tests/Resources/filewithoutextension b/src/Microsoft.DotNet.SignTool.Tests/Resources/filewithoutextension
new file mode 100644
index 00000000000..0637880d70d
--- /dev/null
+++ b/src/Microsoft.DotNet.SignTool.Tests/Resources/filewithoutextension
@@ -0,0 +1 @@
+This is a file
diff --git a/src/Microsoft.DotNet.SignTool.Tests/Resources/test.pkg b/src/Microsoft.DotNet.SignTool.Tests/Resources/test.pkg
new file mode 100644
index 00000000000..c7e5584a39f
Binary files /dev/null and b/src/Microsoft.DotNet.SignTool.Tests/Resources/test.pkg differ
diff --git a/src/Microsoft.DotNet.SignTool.Tests/SignToolTests.cs b/src/Microsoft.DotNet.SignTool.Tests/SignToolTests.cs
index e02be9a663f..891853d0003 100644
--- a/src/Microsoft.DotNet.SignTool.Tests/SignToolTests.cs
+++ b/src/Microsoft.DotNet.SignTool.Tests/SignToolTests.cs
@@ -42,6 +42,8 @@ public class SignToolTests : IDisposable
{".vsix", new List{ new SignInfo("VsixSHA2") } },
{".zip", new List{ SignInfo.Ignore } },
{".tgz", new List{ SignInfo.Ignore } },
+ {".pkg", new List{ new SignInfo("MacDeveloperHarden") } }, // lgtm [cs/common-default-passwords] Safe, these are certificate names
+ {".app", new List{ new SignInfo("MacDeveloperHarden") } }, // lgtm [cs/common-default-passwords] Safe, these are certificate names
{".py", new List{ new SignInfo("Microsoft400") } }, // lgtm [cs/common-default-passwords] Safe, these are certificate names
{".nupkg", new List{ new SignInfo("NuGet") } },
{".symbols.nupkg", new List{ SignInfo.Ignore } },
@@ -69,6 +71,8 @@ public class SignToolTests : IDisposable
{ ".vsix", new List{ new SignInfo("VsixSHA2", collisionPriorityId: "123") } },
{ ".zip", new List{ SignInfo.Ignore } },
{ ".tgz", new List{ SignInfo.Ignore } },
+ { ".pkg", new List{ new SignInfo("Microsoft400", collisionPriorityId: "123") } },
+ { ".app", new List{ new SignInfo("Microsoft400", collisionPriorityId: "123") } },
{ ".nupkg", new List{ new SignInfo("NuGet", collisionPriorityId: "123") } },
{ ".symbols.nupkg", new List{ SignInfo.Ignore } },
};
@@ -124,6 +128,14 @@ public class SignToolTests : IDisposable
{ "CertificateName", "None" },
{ SignToolConstants.CollisionPriorityId, "123" }
}),
+ new TaskItem(".pkg", new Dictionary {
+ { "CertificateName", "Microsoft400" },
+ { SignToolConstants.CollisionPriorityId, "123" }
+ }),
+ new TaskItem(".app", new Dictionary {
+ { "CertificateName", "Microsoft400" },
+ { SignToolConstants.CollisionPriorityId, "123" }
+ }),
new TaskItem(".nupkg", new Dictionary {
{ "CertificateName", "NuGet" },
{ SignToolConstants.CollisionPriorityId, "123" }
@@ -270,6 +282,7 @@ private string GetWixToolPath()
private static string s_snPath = Path.Combine(Path.GetDirectoryName(typeof(SignToolTests).Assembly.Location), "tools", "sn", "sn.exe");
private static string s_tarToolPath = Path.Combine(Path.GetDirectoryName(typeof(SignToolTests).Assembly.Location), "tools", "tar", "Microsoft.Dotnet.Tar.dll");
+ private static string s_pkgToolPath = Path.Combine(Path.GetDirectoryName(typeof(SignToolTests).Assembly.Location), "tools", "pkg", "Microsoft.Dotnet.MacOsPkg.dll");
private string GetResourcePath(string name, string relativePath = null)
{
@@ -314,12 +327,12 @@ public void Dispose()
}
private void ValidateGeneratedProject(
- ITaskItem[] itemsToSign,
+ List itemsToSign,
Dictionary> strongNameSignInfo,
Dictionary fileSignInfo,
Dictionary> extensionsSignInfo,
string[] expectedXmlElementsPerSigningRound,
- ITaskItem[] dualCertificates = null,
+ Dictionary> additionalCertificateInfo = null,
string wixToolsPath = null)
{
var buildEngine = new FakeBuildEngine();
@@ -329,10 +342,10 @@ private void ValidateGeneratedProject(
// The path to DotNet will always be null in these tests, this will force
// the signing logic to call our FakeBuildEngine.BuildProjectFile with a path
// to the XML that store the content of the would be Microbuild sign request.
- var signToolArgs = new SignToolArgs(_tmpDir, microBuildCorePath: "MicroBuildCorePath", testSign: true, dotnetPath: null, _tmpDir, enclosingDir: "", "", wixToolsPath: wixToolsPath, tarToolPath: s_tarToolPath);
+ var signToolArgs = new SignToolArgs(_tmpDir, microBuildCorePath: "MicroBuildCorePath", testSign: true, dotnetPath: null, _tmpDir, enclosingDir: "", "", wixToolsPath: wixToolsPath, tarToolPath: s_tarToolPath, pkgToolPath: s_pkgToolPath);
var signTool = new FakeSignTool(signToolArgs, task.Log);
- var configuration = new Configuration(signToolArgs.TempDir, itemsToSign, strongNameSignInfo, fileSignInfo, extensionsSignInfo, dualCertificates, tarToolPath: s_tarToolPath, snPath: s_snPath, task.Log);
+ var configuration = new Configuration(signToolArgs.TempDir, itemsToSign, strongNameSignInfo, fileSignInfo, extensionsSignInfo, additionalCertificateInfo, tarToolPath: s_tarToolPath, pkgToolPath: s_pkgToolPath, snPath: s_snPath, task.Log);
var signingInput = configuration.GenerateListOfFiles();
var util = new BatchSignUtil(
task.BuildEngine,
@@ -366,19 +379,19 @@ private void ValidateGeneratedProject(
}
private void ValidateFileSignInfos(
- ITaskItem[] itemsToSign,
+ List itemsToSign,
Dictionary> strongNameSignInfo,
Dictionary fileSignInfo,
Dictionary> extensionsSignInfo,
string[] expected,
string[] expectedCopyFiles = null,
- ITaskItem[] dualCertificates = null,
+ Dictionary> additionalCertificateInfo = null,
string[] expectedErrors = null,
string[] expectedWarnings = null)
{
var engine = new FakeBuildEngine();
var task = new SignToolTask { BuildEngine = engine };
- var signingInput = new Configuration(_tmpDir, itemsToSign, strongNameSignInfo, fileSignInfo, extensionsSignInfo, dualCertificates, tarToolPath: s_tarToolPath, snPath: s_snPath, task.Log).GenerateListOfFiles();
+ var signingInput = new Configuration(_tmpDir, itemsToSign, strongNameSignInfo, fileSignInfo, extensionsSignInfo, additionalCertificateInfo, tarToolPath: s_tarToolPath, pkgToolPath: s_pkgToolPath, snPath: s_snPath, task.Log).GenerateListOfFiles();
signingInput.FilesToSign.Select(f => f.ToString()).Should().BeEquivalentTo(expected);
signingInput.FilesToCopy.Select(f => $"{f.Key} -> {f.Value}").Should().BeEquivalentTo(expectedCopyFiles ?? Array.Empty());
@@ -507,14 +520,14 @@ private void ValidateProducedRpmContent(
[Fact]
public void EmptySigningList()
{
- var itemsToSign = new ITaskItem[0];
+ var itemsToSign = new List();
var strongNameSignInfo = new Dictionary>();
var fileSignInfo = new Dictionary();
var task = new SignToolTask { BuildEngine = new FakeBuildEngine() };
- var signingInput = new Configuration(_tmpDir, itemsToSign, strongNameSignInfo, fileSignInfo, s_fileExtensionSignInfo, null, tarToolPath: s_tarToolPath, snPath: s_snPath, task.Log).GenerateListOfFiles();
+ var signingInput = new Configuration(_tmpDir, itemsToSign, strongNameSignInfo, fileSignInfo, s_fileExtensionSignInfo, null, tarToolPath: s_tarToolPath, pkgToolPath: s_pkgToolPath, snPath: s_snPath, task.Log).GenerateListOfFiles();
signingInput.FilesToSign.Should().BeEmpty();
signingInput.ZipDataMap.Should().BeEmpty();
@@ -534,7 +547,8 @@ public void EmptySigningListForTask()
DryRun = false,
TestSign = true,
DotNetPath = CreateTestResource("dotnet.fake"),
- SNBinaryPath = CreateTestResource("fake.sn.exe")
+ SNBinaryPath = CreateTestResource("fake.sn.exe"),
+ PkgToolPath = s_pkgToolPath,
};
task.Execute().Should().BeTrue();
@@ -555,6 +569,7 @@ public void SignWhenSnExeIsNotRequired()
DotNetPath = CreateTestResource("dotnet.fake"),
DoStrongNameCheck = false,
SNBinaryPath = null,
+ PkgToolPath = s_pkgToolPath,
};
task.Execute().Should().BeTrue();
@@ -564,18 +579,15 @@ public void SignWhenSnExeIsNotRequired()
public void OnlyContainer()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("ContainerOne.1.0.0.nupkg"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- })
+ new ItemToSign(GetResourcePath("ContainerOne.1.0.0.nupkg"), "")
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "581d91ccdfc4ea9c", new List {new SignInfo("3PartySHA2", "ArcadeStrongTest", "123") } }
+ { "581d91ccdfc4ea9c", new List {new SignInfo(certificate: "3PartySHA2", strongName: "ArcadeStrongTest", collisionPriorityId: "123") } }
};
// Overriding information
@@ -602,15 +614,15 @@ public void OnlyContainer()
public void SkipSigning()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("ContainerOne.1.0.0.nupkg"))
+ new ItemToSign(GetResourcePath("ContainerOne.1.0.0.nupkg"))
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "581d91ccdfc4ea9c", new List {new SignInfo("3PartySHA2", "ArcadeStrongTest") } }
+ { "581d91ccdfc4ea9c", new List {new SignInfo(certificate: "3PartySHA2", strongName: "ArcadeStrongTest") } }
};
// Overriding information
@@ -634,15 +646,16 @@ public void SkipSigning()
public void SkipStrongNamingForAlreadyStrongNamedBinary()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("SignedLibrary.dll"))
+ new ItemToSign(GetResourcePath("SignedLibrary.dll")),
+ new ItemToSign(GetResourcePath("StrongNamedWithEcmaKey.dll"))
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "31bf3856ad364e35", new List {new SignInfo("FooCert", "Blah.snk") } }
+ { "31bf3856ad364e35", new List {new SignInfo(certificate: "FooCert", strongName: "Blah.snk") } }
};
// Overriding information
@@ -655,15 +668,15 @@ public void SkipStrongNamingForAlreadyStrongNamedBinary()
public void DoNotSkipStrongNamingForDelaySignedBinary()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("DelaySigned.dll"))
+ new ItemToSign(GetResourcePath("DelaySigned.dll"))
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "b03f5f7f11d50a3a", new List {new SignInfo("3PartySHA2", "ArcadeStrongTest") } }
+ { "b03f5f7f11d50a3a", new List {new SignInfo(certificate: "3PartySHA2", strongName: "ArcadeStrongTest") } }
};
// Overriding information
@@ -679,15 +692,15 @@ public void DoNotSkipStrongNamingForDelaySignedBinary()
public void SkipStrongNamingForCrossGennedBinary()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("Crossgenned.exe"))
+ new ItemToSign(GetResourcePath("Crossgenned.exe"))
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "b03f5f7f11d50a3a", new List {new SignInfo("3PartySHA2", "ArcadeStrongTest") } }
+ { "b03f5f7f11d50a3a", new List {new SignInfo(certificate: "3PartySHA2", strongName: "ArcadeStrongTest") } }
};
// Overriding information
@@ -703,15 +716,15 @@ public void SkipStrongNamingForCrossGennedBinary()
public void SkipStrongNamingBinaryButDontSkipAuthenticode()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("OpenSigned.dll"))
+ new ItemToSign(GetResourcePath("OpenSigned.dll"))
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "cc7b13ffcd2ddd51", new List {new SignInfo("3PartySHA2", "ArcadeStrongTest") } }
+ { "cc7b13ffcd2ddd51", new List {new SignInfo(certificate: "3PartySHA2", strongName: "ArcadeStrongTest") } }
};
// Overriding information
@@ -731,12 +744,9 @@ public void OnlyAuthenticodeSignByPKT()
var certificateToTest = "3PartySHA2";
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath(fileToTest), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- })
+ new ItemToSign(GetResourcePath(fileToTest), "123")
};
// Default signing information
@@ -767,15 +777,15 @@ public void OnlyAuthenticodeSignByPKT()
public void OnlyContainerAndOverridingByPKT()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath(GetResourcePath("ContainerOne.1.0.0.nupkg")))
+ new ItemToSign(GetResourcePath(GetResourcePath("ContainerOne.1.0.0.nupkg")))
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "581d91ccdfc4ea9c", new List { new SignInfo("3PartySHA2", "ArcadeStrongTest") } }
+ { "581d91ccdfc4ea9c", new List { new SignInfo(certificate: "3PartySHA2", strongName: "ArcadeStrongTest") } }
};
// Overriding information
@@ -809,18 +819,15 @@ public void OnlyContainerAndOverridingByPKT()
public void OnlyContainerAndOverridingByFileName()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("ContainerOne.1.0.0.nupkg"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- })
+ new ItemToSign(GetResourcePath("ContainerOne.1.0.0.nupkg"), "123")
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "581d91ccdfc4ea9c", new List { new SignInfo("ArcadeCertTest", "ArcadeStrongTest", collisionPriorityId: "123") } }
+ { "581d91ccdfc4ea9c", new List { new SignInfo(certificate: "ArcadeCertTest", strongName: "ArcadeStrongTest", collisionPriorityId: "123") } }
};
// Overriding information
@@ -852,9 +859,9 @@ public void OnlyContainerAndOverridingByFileName()
public void EmptyPKT()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("EmptyPKT.dll"))
+ new ItemToSign(GetResourcePath("EmptyPKT.dll"))
};
// Default signing information
@@ -879,23 +886,17 @@ public void EmptyPKT()
public void CrossGenerated()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("CoreLibCrossARM.dll"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(GetResourcePath("AspNetCoreCrossLib.dll"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- })
+ new ItemToSign(GetResourcePath("CoreLibCrossARM.dll"), "123"),
+ new ItemToSign(GetResourcePath("AspNetCoreCrossLib.dll"), "123")
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "7cec85d7bea7798e", new List{ new SignInfo("ArcadeCertTest", "ArcadeStrongTest", "123") } },
- { "adb9793829ddae60", new List{ new SignInfo("Microsoft400", "AspNetCore", "123") } } // lgtm [cs/common-default-passwords] Safe, these are certificate names
+ { "7cec85d7bea7798e", new List{ new SignInfo(certificate: "ArcadeCertTest", strongName: "ArcadeStrongTest", collisionPriorityId: "123") } },
+ { "adb9793829ddae60", new List{ new SignInfo(certificate: "Microsoft400", strongName: "AspNetCore", collisionPriorityId: "123") } } // lgtm [cs/common-default-passwords] Safe, these are certificate names
};
// Overriding information
@@ -925,12 +926,9 @@ public void CrossGenerated()
public void DefaultCertificateForAssemblyWithoutStrongName()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("EmptyPKT.dll"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- })
+ new ItemToSign(GetResourcePath("EmptyPKT.dll"), "123")
};
var strongNameSignInfo = new Dictionary>()
@@ -950,12 +948,9 @@ public void DefaultCertificateForAssemblyWithoutStrongName()
public void CustomTargetFrameworkAttribute()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("CustomTargetFrameworkAttribute.dll"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- })
+ new ItemToSign(GetResourcePath("CustomTargetFrameworkAttribute.dll"), "123")
};
var strongNameSignInfo = new Dictionary>()
@@ -978,9 +973,9 @@ public void CustomTargetFrameworkAttribute()
public void ThirdPartyLibraryMicrosoftCertificate()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("EmptyPKT.dll"))
+ new ItemToSign(GetResourcePath("EmptyPKT.dll"))
};
var strongNameSignInfo = new Dictionary>() { };
@@ -1001,16 +996,10 @@ public void ThirdPartyLibraryMicrosoftCertificate()
public void DoubleNestedContainer()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("PackageWithWix.nupkg"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(GetResourcePath("MsiBootstrapper.exe.wixpack.zip"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- })
+ new ItemToSign(GetResourcePath("PackageWithWix.nupkg"), "123"),
+ new ItemToSign(GetResourcePath("MsiBootstrapper.exe.wixpack.zip"), "123")
};
// Default signing information
@@ -1058,18 +1047,15 @@ public void DoubleNestedContainer()
public void NestedContainer()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("NestedContainer.1.0.0.nupkg"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- })
+ new ItemToSign(GetResourcePath("NestedContainer.1.0.0.nupkg"), "123")
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "581d91ccdfc4ea9c", new List{ new SignInfo("3PartySHA2", "ArcadeStrongTest", "123") } }
+ { "581d91ccdfc4ea9c", new List{ new SignInfo(certificate: "3PartySHA2", strongName: "ArcadeStrongTest", collisionPriorityId: "123") } }
};
// Overriding information
@@ -1139,18 +1125,15 @@ public void NestedContainer()
public void NestedContainerWithCollisions()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("NestedContainer.1.0.0.nupkg"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- })
+ new ItemToSign(GetResourcePath("NestedContainer.1.0.0.nupkg"), "123")
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "581d91ccdfc4ea9c", new List{ new SignInfo("3PartySHA2", "ArcadeStrongTest", "123") } }
+ { "581d91ccdfc4ea9c", new List{ new SignInfo(certificate: "3PartySHA2", strongName: "ArcadeStrongTest", collisionPriorityId: "123") } }
};
// Overriding information. Since ContainerOne.dll collides with ContainerTwo.dll already in the hash mapping
@@ -1225,15 +1208,15 @@ public void NestedContainerWithCollisions()
public void SignZipFile()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("test.zip"))
+ new ItemToSign(GetResourcePath("test.zip"))
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "581d91ccdfc4ea9c", new List{ new SignInfo("ArcadeCertTest", "ArcadeStrongTest") } }
+ { "581d91ccdfc4ea9c", new List{ new SignInfo(certificate: "ArcadeCertTest", strongName: "ArcadeStrongTest") } }
};
// Overriding information
@@ -1273,19 +1256,288 @@ public void SignZipFile()
});
}
+ ///
+ /// Verifies that signing of pkgs can be done on Windows, even though
+ /// we will not unpack or repack them.
+ ///
+ [WindowsOnlyFact]
+ public void SignJustPkgWithoutUnpack()
+ {
+ // List of files to be considered for signing
+ var itemsToSign = new List()
+ {
+ new ItemToSign(GetResourcePath("test.pkg"))
+ };
+
+ // Default signing information
+ var strongNameSignInfo = new Dictionary>()
+ {
+ { "581d91ccdfc4ea9c", new List{ new SignInfo(certificate: "ArcadeCertTest", strongName: "ArcadeStrongTest") } }
+ };
+
+ // Overriding information
+ var fileSignInfo = new Dictionary();
+
+ ValidateFileSignInfos(itemsToSign, strongNameSignInfo, fileSignInfo, s_fileExtensionSignInfo, new[]
+ {
+ "File 'test.pkg' Certificate='MacDeveloperHarden'",
+ });
+
+ // OSX files need to be zipped first before being signed
+ // This is why the .pkgs are listed as .zip files below
+ ValidateGeneratedProject(itemsToSign, strongNameSignInfo, fileSignInfo, s_fileExtensionSignInfo, new[]
+ {
+ $@"
+
+ MacDeveloperHarden
+ ",
+ });
+ }
+
+ [MacOSOnlyFact]
+ public void UnpackAndSignPkg()
+ {
+ // List of files to be considered for signing
+ var itemsToSign = new List()
+ {
+ new ItemToSign(GetResourcePath("test.pkg"))
+ };
+
+ // Default signing information
+ var strongNameSignInfo = new Dictionary>()
+ {
+ { "581d91ccdfc4ea9c", new List{ new SignInfo(certificate: "ArcadeCertTest", strongName: "ArcadeStrongTest") } }
+ };
+
+ // Overriding information
+ var fileSignInfo = new Dictionary();
+
+ ValidateFileSignInfos(itemsToSign, strongNameSignInfo, fileSignInfo, s_fileExtensionSignInfo, new[]
+ {
+ "File 'NativeLibrary.dll' Certificate='Microsoft400'",
+ "File 'SOS.NETCore.dll' TargetFramework='.NETCoreApp,Version=v1.0' Certificate='Microsoft400'",
+ "File 'Nested.NativeLibrary.dll' Certificate='Microsoft400'",
+ "File 'Nested.SOS.NETCore.dll' TargetFramework='.NETCoreApp,Version=v1.0' Certificate='Microsoft400'",
+ "File 'NestedPkg.pkg' Certificate='MacDeveloperHarden'",
+ "File 'test.pkg' Certificate='MacDeveloperHarden'",
+ });
+
+ // OSX files need to be zipped first before being signed
+ // This is why the .pkgs are listed as .zip files below
+ ValidateGeneratedProject(itemsToSign, strongNameSignInfo, fileSignInfo, s_fileExtensionSignInfo, new[]
+ {
+ $@"
+
+ Microsoft400
+
+
+ Microsoft400
+
+
+ Microsoft400
+
+
+ Microsoft400
+
+ ",
+ $@"
+
+ MacDeveloperHarden
+ ",
+ $@"
+
+ MacDeveloperHarden
+ ",
+ });
+ }
+
+ [MacOSOnlyFact]
+ public void SignAndNotarizePkgFile()
+ {
+ // List of files to be considered for signing
+ var itemsToSign = new List()
+ {
+ new ItemToSign(GetResourcePath("test.pkg"))
+ };
+
+ // Default signing information
+ var strongNameSignInfo = new Dictionary>()
+ {
+ { "581d91ccdfc4ea9c", new List{ new SignInfo(certificate: "ArcadeCertTest", strongName: "ArcadeStrongTest") } }
+ };
+
+ // Set up the cert to allow for signing and notarization.
+ var additionalCertificateInfo = new Dictionary>()
+ {
+ { "MacDeveloperHardenWithNotarization",
+ new List() {
+ new AdditionalCertificateInformation() { MacNotarizationAppName = "dotnet", MacSigningOperation = "MacDeveloperHarden" }
+ }
+ }
+ };
+
+ // Overriding information
+ var fileSignInfo = new Dictionary()
+ {
+ { new ExplicitCertificateKey("test.pkg"), "MacDeveloperHardenWithNotarization" }
+ };
+
+ ValidateFileSignInfos(itemsToSign, strongNameSignInfo, fileSignInfo, s_fileExtensionSignInfo, new[]
+ {
+ "File 'NativeLibrary.dll' Certificate='Microsoft400'",
+ "File 'SOS.NETCore.dll' TargetFramework='.NETCoreApp,Version=v1.0' Certificate='Microsoft400'",
+ "File 'Nested.NativeLibrary.dll' Certificate='Microsoft400'",
+ "File 'Nested.SOS.NETCore.dll' TargetFramework='.NETCoreApp,Version=v1.0' Certificate='Microsoft400'",
+ "File 'NestedPkg.pkg' Certificate='MacDeveloperHarden'",
+ "File 'test.pkg' Certificate='MacDeveloperHarden' NotarizationAppName='com.microsoft.dotnet'",
+ }, additionalCertificateInfo: additionalCertificateInfo);
+
+ // OSX files need to be zipped first before being signed
+ // This is why the .pkgs are listed as .zip files below
+ ValidateGeneratedProject(itemsToSign, strongNameSignInfo, fileSignInfo, s_fileExtensionSignInfo, new[]
+ {
+ $@"
+
+ Microsoft400
+
+
+ Microsoft400
+
+
+ Microsoft400
+
+
+ Microsoft400
+
+ ",
+ $@"
+
+ MacDeveloperHarden
+ ",
+ $@"
+
+ MacDeveloperHarden
+
+ ",
+ $@"
+
+ 8020
+ com.microsoft.dotnet
+ ",
+ }, additionalCertificateInfo: additionalCertificateInfo);
+ }
+
+ [MacOSOnlyFact]
+ public void SignNestedPkgFile()
+ {
+ // List of files to be considered for signing
+ var itemsToSign = new List()
+ {
+ new ItemToSign( GetResourcePath("NestedPkg.pkg"))
+ };
+
+ // Default signing information
+ var strongNameSignInfo = new Dictionary>()
+ {
+ { "581d91ccdfc4ea9c", new List{ new SignInfo(certificate: "ArcadeCertTest", strongName: "ArcadeStrongTest") } }
+ };
+
+ // Overriding information
+ var fileSignInfo = new Dictionary();
+
+ ValidateFileSignInfos(itemsToSign, strongNameSignInfo, fileSignInfo, s_fileExtensionSignInfo, new[]
+ {
+ "File 'NativeLibrary.dll' Certificate='Microsoft400'",
+ "File 'SOS.NETCore.dll' TargetFramework='.NETCoreApp,Version=v1.0' Certificate='Microsoft400'",
+ "File 'Nested.SOS.NETCore.dll' TargetFramework='.NETCoreApp,Version=v1.0' Certificate='Microsoft400'",
+ "File 'Nested.NativeLibrary.dll' Certificate='Microsoft400'",
+ "File 'NestedPkg.pkg' Certificate='MacDeveloperHarden'",
+ });
+
+ // OSX files need to be zipped first before being signed
+ // This is why the .pkgs and .apps are listed as .zip files below
+ ValidateGeneratedProject(itemsToSign, strongNameSignInfo, fileSignInfo, s_fileExtensionSignInfo, new[]
+ {
+ $@"
+
+ Microsoft400
+
+
+ Microsoft400
+
+
+ Microsoft400
+
+
+ Microsoft400
+
+ ",
+ $@"
+
+ MacDeveloperHarden
+ "
+ });
+ }
+
+ [MacOSOnlyFact]
+ public void SignPkgFileWithApp()
+ {
+ // List of files to be considered for signing
+ var itemsToSign = new List()
+ {
+ new ItemToSign( GetResourcePath("WithApp.pkg"))
+ };
+
+ // Default signing information
+ var strongNameSignInfo = new Dictionary>()
+ {
+ { "581d91ccdfc4ea9c", new List{ new SignInfo(certificate: "ArcadeCertTest", strongName: "ArcadeStrongTest") } }
+ };
+
+ // Overriding information
+ var fileSignInfo = new Dictionary();
+
+ // When .apps are unpacked from .pkgs, they get zipped so they can be signed
+ ValidateFileSignInfos(itemsToSign, strongNameSignInfo, fileSignInfo, s_fileExtensionSignInfo, new[]
+ {
+ "File 'libexample.dylib' Certificate='DylibCertificate'",
+ "File 'test.app' Certificate='MacDeveloperHarden'",
+ "File 'WithApp.pkg' Certificate='MacDeveloperHarden'",
+ });
+
+ ValidateGeneratedProject(itemsToSign, strongNameSignInfo, fileSignInfo, s_fileExtensionSignInfo, new[]
+ {
+ // This dylib does not go to a zip file because the cert chosen is DylibCertificate.
+ $@"
+
+ DylibCertificate
+
+ ",
+ $@"
+
+ MacDeveloperHarden
+
+ ",
+ $@"
+
+ MacDeveloperHarden
+ "
+ });
+ }
+
[Fact]
public void SignTarGZipFile()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("test.tgz"))
+ new ItemToSign(GetResourcePath("test.tgz"))
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "581d91ccdfc4ea9c", new List{ new SignInfo("ArcadeCertTest", "ArcadeStrongTest") } }
+ { "581d91ccdfc4ea9c", new List{ new SignInfo(certificate: "ArcadeCertTest", strongName: "ArcadeStrongTest") } }
};
// Overriding information
@@ -1329,15 +1581,15 @@ public void SignTarGZipFile()
public void SymbolsNupkg()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("test.symbols.nupkg"))
+ new ItemToSign(GetResourcePath("test.symbols.nupkg"))
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "581d91ccdfc4ea9c", new List{ new SignInfo("ArcadeCertTest", "ArcadeStrongTest") } }
+ { "581d91ccdfc4ea9c", new List{ new SignInfo(certificate: "ArcadeCertTest", strongName: "ArcadeStrongTest") } }
};
// Overriding information
@@ -1381,15 +1633,15 @@ public void SymbolsNupkg()
public void SignedSymbolsNupkg()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("test.symbols.nupkg"))
+ new ItemToSign(GetResourcePath("test.symbols.nupkg"))
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "581d91ccdfc4ea9c", new List{ new SignInfo("ArcadeCertTest", "ArcadeStrongTest") } }
+ { "581d91ccdfc4ea9c", new List{ new SignInfo(certificate: "ArcadeCertTest", strongName: "ArcadeStrongTest") } }
};
// Overriding information
@@ -1435,9 +1687,9 @@ public void SignedSymbolsNupkg()
public void CheckDebSigning()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List
{
- new TaskItem(GetResourcePath("test.deb"))
+ new ItemToSign(GetResourcePath("test.deb"))
};
// Default signing information
@@ -1475,13 +1727,41 @@ public void CheckDebSigning()
ValidateProducedDebContent(Path.Combine(_tmpDir, "test.deb"), expectedFilesOriginalHashes, signableFiles, expectedControlFileContent);
}
+ [WindowsOnlyFact]
+ public void CheckRpmSigningOnWindows()
+ {
+ // List of files to be considered for signing
+ var itemsToSign = new List
+ {
+ new ItemToSign(GetResourcePath("test.rpm"))
+ };
+
+ // Default signing information
+ var strongNameSignInfo = new Dictionary>();
+
+ // Overriding information
+ var fileSignInfo = new Dictionary();
+
+ ValidateFileSignInfos(itemsToSign, strongNameSignInfo, fileSignInfo, s_fileExtensionSignInfo, new[]
+ {
+ "File 'test.rpm' Certificate='LinuxSign'"
+ });
+
+ ValidateGeneratedProject(itemsToSign, strongNameSignInfo, fileSignInfo, s_fileExtensionSignInfo, new[]
+ {
+$@"
+ LinuxSign
+"
+ });
+ }
+
[LinuxOnlyFact]
public void CheckRpmSigning()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List
{
- new TaskItem(GetResourcePath("test.rpm"))
+ new ItemToSign(GetResourcePath("test.rpm"))
};
// Default signing information
@@ -1521,10 +1801,10 @@ public void CheckRpmSigning()
public void VerifyDebIntegrity()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List
{
- new TaskItem(GetResourcePath("SignedDeb.deb")),
- new TaskItem(GetResourcePath("IncorrectlySignedDeb.deb"))
+ new ItemToSign(GetResourcePath("SignedDeb.deb")),
+ new ItemToSign(GetResourcePath("IncorrectlySignedDeb.deb"))
};
// Default signing information
@@ -1553,10 +1833,10 @@ public void VerifyDebIntegrity()
public void CheckPowershellSigning()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("SignedScript.ps1")),
- new TaskItem(GetResourcePath("UnsignedScript.ps1"))
+ new ItemToSign(GetResourcePath("SignedScript.ps1")),
+ new ItemToSign(GetResourcePath("UnsignedScript.ps1"))
};
// Default signing information
@@ -1571,18 +1851,18 @@ public void CheckPowershellSigning()
});
}
-/* These tests return different results on netcoreapp. ie, we can only truly validate nuget integrity when running on framework.
- * NuGet behaves differently on core vs framework
- * - https://github.com/NuGet/NuGet.Client/blob/e88a5a03a1b26099f8be225d3ee3a897b2edb1d0/build/common.targets#L18-L25
- */
+ /* These tests return different results on netcoreapp. ie, we can only truly validate nuget integrity when running on framework.
+ * NuGet behaves differently on core vs framework
+ * - https://github.com/NuGet/NuGet.Client/blob/e88a5a03a1b26099f8be225d3ee3a897b2edb1d0/build/common.targets#L18-L25
+ */
#if NETFRAMEWORK
[Fact]
public void VerifyNupkgIntegrity()
{
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("SignedPackage.1.0.0.nupkg")),
- new TaskItem(GetResourcePath("IncorrectlySignedPackage.1.0.0.nupkg"))
+ new ItemToSign(GetResourcePath("SignedPackage.1.0.0.nupkg")),
+ new ItemToSign(GetResourcePath("IncorrectlySignedPackage.1.0.0.nupkg"))
};
ValidateFileSignInfos(itemsToSign,
@@ -1596,10 +1876,10 @@ public void VerifyNupkgIntegrity()
public void SignNupkgWithUnsignedContents()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("UnsignedContents.nupkg")),
- new TaskItem(GetResourcePath("FakeSignedContents.nupkg"))
+ new ItemToSign(GetResourcePath("UnsignedContents.nupkg")),
+ new ItemToSign(GetResourcePath("FakeSignedContents.nupkg"))
};
// Default signing information
@@ -1621,16 +1901,16 @@ public void SignNupkgWithUnsignedContents()
public void SignMsiEngine()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("MsiBootstrapper.exe")),
- new TaskItem(GetResourcePath("MsiBootstrapper.exe.wixpack.zip"))
+ new ItemToSign(GetResourcePath("MsiBootstrapper.exe")),
+ new ItemToSign(GetResourcePath("MsiBootstrapper.exe.wixpack.zip"))
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "581d91ccdfc4ea9c", new List{ new SignInfo("ArcadeCertTest", "ArcadeStrongTest") } }
+ { "581d91ccdfc4ea9c", new List{ new SignInfo(certificate: "ArcadeCertTest", strongName: "ArcadeStrongTest") } }
};
// Overriding information
@@ -1668,22 +1948,16 @@ public void SignMsiEngine()
public void MsiWithWixpack()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("MsiSetup.msi"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(GetResourcePath("MsiSetup.msi.wixpack.zip"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- })
+ new ItemToSign(GetResourcePath("MsiSetup.msi"), "123"),
+ new ItemToSign(GetResourcePath("MsiSetup.msi.wixpack.zip"), "123")
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "581d91ccdfc4ea9c", new List{ new SignInfo("ArcadeCertTest", "ArcadeStrongTest", "123") } }
+ { "581d91ccdfc4ea9c", new List{ new SignInfo(certificate: "ArcadeCertTest", strongName: "ArcadeStrongTest", collisionPriorityId: "123") } }
};
// Overriding information
@@ -1740,15 +2014,15 @@ public void BadWixToolsetPath()
public void MPackFile()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("test.mpack"))
+ new ItemToSign(GetResourcePath("test.mpack"))
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "581d91ccdfc4ea9c", new List{ new SignInfo("3PartySHA2") } }
+ { "581d91ccdfc4ea9c", new List{ new SignInfo(certificate: "3PartySHA2") } }
};
// Overriding information
@@ -1774,22 +2048,16 @@ public void MPackFile()
public void VsixPackage_DuplicateVsixAfter()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("test.vsix"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(GetResourcePath("PackageWithRelationships.vsix"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- })
+ new ItemToSign(GetResourcePath("test.vsix"), "123"),
+ new ItemToSign(GetResourcePath("PackageWithRelationships.vsix"), "123")
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "581d91ccdfc4ea9c", new List{ new SignInfo("3PartySHA2", "ArcadeStrongTest", "123") } }
+ { "581d91ccdfc4ea9c", new List{ new SignInfo(certificate: "3PartySHA2", strongName: "ArcadeStrongTest", collisionPriorityId: "123") } }
};
// Overriding information
@@ -1841,22 +2109,16 @@ public void VsixPackage_DuplicateVsixAfter()
public void VsixPackage_WithSpaces()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("TestSpaces.vsix"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(GetResourcePath("PackageWithRelationships.vsix"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- })
+ new ItemToSign(GetResourcePath("TestSpaces.vsix"), "123"),
+ new ItemToSign(GetResourcePath("PackageWithRelationships.vsix"), "123")
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "581d91ccdfc4ea9c", new List{ new SignInfo("3PartySHA2", "ArcadeStrongTest", "123") } }
+ { "581d91ccdfc4ea9c", new List{ new SignInfo(certificate: "3PartySHA2", strongName: "ArcadeStrongTest", collisionPriorityId: "123") } }
};
// Overriding information
@@ -1908,16 +2170,16 @@ public void VsixPackage_WithSpaces()
public void VsixPackage_DuplicateVsixBefore()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("PackageWithRelationships.vsix")),
- new TaskItem(GetResourcePath("test.vsix"))
+ new ItemToSign(GetResourcePath("PackageWithRelationships.vsix")),
+ new ItemToSign(GetResourcePath("test.vsix"))
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "581d91ccdfc4ea9c", new List{ new SignInfo("3PartySHA2", "ArcadeStrongTest") } }
+ { "581d91ccdfc4ea9c", new List{ new SignInfo(certificate: "3PartySHA2", strongName: "ArcadeStrongTest") } }
};
// Overriding information
@@ -1965,26 +2227,17 @@ public void VsixPackage_DuplicateVsixBefore()
public void VsixPackage_DuplicateVsixBeforeAndAfter()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("PackageWithRelationships.vsix", relativePath: "A"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(GetResourcePath("test.vsix"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(GetResourcePath("PackageWithRelationships.vsix", relativePath: "B"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- })
+ new ItemToSign(GetResourcePath("PackageWithRelationships.vsix", relativePath: "A"), "123"),
+ new ItemToSign(GetResourcePath("test.vsix"), "123"),
+ new ItemToSign(GetResourcePath("PackageWithRelationships.vsix", relativePath: "B"), "123")
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "581d91ccdfc4ea9c", new List{ new SignInfo("3PartySHA2", "ArcadeStrongTest", "123") } }
+ { "581d91ccdfc4ea9c", new List{ new SignInfo(certificate: "3PartySHA2", strongName: "ArcadeStrongTest", collisionPriorityId: "123") } }
};
// Overriding information
@@ -2036,15 +2289,15 @@ public void VsixPackage_DuplicateVsixBeforeAndAfter()
public void VsixPackageWithRelationships()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("PackageWithRelationships.vsix"))
+ new ItemToSign(GetResourcePath("PackageWithRelationships.vsix"))
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "581d91ccdfc4ea9c", new List{ new SignInfo("3PartySHA2", "ArcadeStrongTest") } }
+ { "581d91ccdfc4ea9c", new List{ new SignInfo(certificate: "3PartySHA2", strongName: "ArcadeStrongTest") } }
};
// Overriding information
@@ -2075,9 +2328,9 @@ public void VsixPackageWithRelationships()
public void ZeroLengthFilesShouldNotBeSigned()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("ZeroLengthPythonFile.py"))
+ new ItemToSign(GetResourcePath("ZeroLengthPythonFile.py"))
};
// Default signing information
var strongNameSignInfo = new Dictionary>();
@@ -2093,36 +2346,15 @@ public void ZeroLengthFilesShouldNotBeSigned()
public void CheckFileExtensionSignInfo()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(CreateTestResource("dynalib.dylib"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(CreateTestResource("javascript.js"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(CreateTestResource("javatest.jar"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(CreateTestResource("power.ps1"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(CreateTestResource("powerc.psc1"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(CreateTestResource("powerd.psd1"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(CreateTestResource("powerm.psm1"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
+ new ItemToSign(CreateTestResource("dynalib.dylib"), "123"),
+ new ItemToSign(CreateTestResource("javascript.js"), "123"),
+ new ItemToSign(CreateTestResource("javatest.jar"), "123"),
+ new ItemToSign(CreateTestResource("power.ps1"), "123"),
+ new ItemToSign(CreateTestResource("powerc.psc1"), "123"),
+ new ItemToSign(CreateTestResource("powerd.psd1"), "123"),
+ new ItemToSign(CreateTestResource("powerm.psm1"), "123"),
};
// Default signing information
@@ -2210,16 +2442,10 @@ public void ValidateParseFileExtensionEntriesForTarGzExtensionPasses()
public void FilesAreUniqueByName()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("SameFiles1.zip"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(GetResourcePath("SameFiles2.zip"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- })
+ new ItemToSign(GetResourcePath("SameFiles1.zip"), "123"),
+ new ItemToSign(GetResourcePath("SameFiles2.zip"), "123"),
};
ValidateFileSignInfos(itemsToSign, new Dictionary>(), new Dictionary(), s_fileExtensionSignInfoWithCollisionId, new[]
@@ -2293,7 +2519,14 @@ public void ValidateSignToolTaskParsing()
{
new TaskItem("DualSignCertificate", new Dictionary
{
- { "DualSigningAllowed", "true" }
+ { "DualSigningAllowed", "true" },
+ { "CollisionPriorityId", "123" }
+ }),
+ new TaskItem("MacDeveloperHardenWithNotarization", new Dictionary
+ {
+ { "MacCertificate", "MacDeveloperHarden" },
+ { "MacNotarizationAppName", "com.microsoft.dotnet" },
+ { "CollisionPriorityId", "123" }
})
};
@@ -2313,6 +2546,7 @@ public void ValidateSignToolTaskParsing()
DoStrongNameCheck = false,
SNBinaryPath = null,
TarToolPath = s_tarToolPath,
+ PkgToolPath = s_pkgToolPath,
};
task.Execute().Should().BeTrue();
@@ -2354,46 +2588,73 @@ private bool runTask(ITaskItem[] itemsToSign = null, ITaskItem[] strongNameSignI
public void ValidateAppendingCertificate()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("SignedLibrary.dll")),
+ new ItemToSign(GetResourcePath("SignedLibrary.dll")),
};
- var dualCertificates = new ITaskItem[]
+ const string dualCertName = "DualCertificateName";
+ var additionalCertInfo = new Dictionary>()
{
- new TaskItem("DualCertificateName"),
+ {dualCertName, new List(){new AdditionalCertificateInformation() { DualSigningAllowed = true } } },
};
var strongNameSignInfo = new Dictionary>()
{
- { "31bf3856ad364e35", new List{ new SignInfo(dualCertificates.First().ItemSpec, null) } }
+ { "31bf3856ad364e35", new List{ new SignInfo(certificate: dualCertName, strongName: null) } }
};
var fileSignInfo = new Dictionary();
ValidateFileSignInfos(itemsToSign, strongNameSignInfo, fileSignInfo, s_fileExtensionSignInfo, new[]
{
- $"File 'SignedLibrary.dll' TargetFramework='.NETCoreApp,Version=v2.0' Certificate='{dualCertificates.First()}'",
+ $"File 'SignedLibrary.dll' TargetFramework='.NETCoreApp,Version=v2.0' Certificate='{dualCertName}'",
},
- dualCertificates: dualCertificates);
+ additionalCertificateInfo: additionalCertInfo);
}
[Fact]
- public void PackageWithZipFile()
+ public void ValidateCertNotAppendedWithNonMatchingCollisionId()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
+ {
+ new ItemToSign(GetResourcePath("SignedLibrary.dll")),
+ };
+
+ const string dualCertName = "DualCertificateName";
+ var additionalCertInfo = new Dictionary>()
{
- new TaskItem( GetResourcePath("PackageWithZip.nupkg"), new Dictionary
+ { dualCertName, new List(){new AdditionalCertificateInformation()
{
- { SignToolConstants.CollisionPriorityId, "123" }
- })
+ DualSigningAllowed = true,
+ CollisionPriorityId = "123"
+ } } },
+ };
+
+ var strongNameSignInfo = new Dictionary>()
+ {
+ { "31bf3856ad364e35", new List{ new SignInfo(certificate: dualCertName, strongName: null) } }
+ };
+
+ var fileSignInfo = new Dictionary();
+
+ ValidateFileSignInfos(itemsToSign, strongNameSignInfo, fileSignInfo, s_fileExtensionSignInfo, new string[] { }, additionalCertificateInfo: additionalCertInfo);
+ }
+
+ [Fact]
+ public void PackageWithZipFile()
+ {
+ // List of files to be considered for signing
+ var itemsToSign = new List()
+ {
+ new ItemToSign( GetResourcePath("PackageWithZip.nupkg"), "123")
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "581d91ccdfc4ea9c", new List{ new SignInfo("ArcadeCertTest", "ArcadeStrongTest", "123") } }
+ { "581d91ccdfc4ea9c", new List{ new SignInfo(certificate: "ArcadeCertTest", strongName: "ArcadeStrongTest", collisionPriorityId: "123") } }
};
// Overriding information
@@ -2417,15 +2678,15 @@ public void PackageWithZipFile()
public void NestedZipFile()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem( GetResourcePath("NestedZip.zip"))
+ new ItemToSign( GetResourcePath("NestedZip.zip"))
};
// Default signing information
var strongNameSignInfo = new Dictionary>()
{
- { "581d91ccdfc4ea9c", new List{ new SignInfo("ArcadeCertTest", "ArcadeStrongTest") } }
+ { "581d91ccdfc4ea9c", new List{ new SignInfo(certificate: "ArcadeCertTest", strongName: "ArcadeStrongTest") } }
};
// Overriding information
@@ -2452,59 +2713,32 @@ public void NestedZipFile()
public void SpecificFileSignInfos()
{
// List of files to be considered for signing
- var itemsToSign = new ITaskItem[]
- {
- new TaskItem(CreateTestResource("test.js"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(CreateTestResource("test.jar"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(CreateTestResource("test.ps1"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(CreateTestResource("test.psd1"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(CreateTestResource("test.psm1"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(CreateTestResource("test.psc1"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(CreateTestResource("test.dylib"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(GetResourcePath("EmptyPKT.dll"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(GetResourcePath("test.vsix"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
- new TaskItem(GetResourcePath("Simple.nupkg"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
+ var itemsToSign = new List()
+ {
+ new ItemToSign(CreateTestResource("test.js"), "123"),
+ new ItemToSign(CreateTestResource("test.jar"), "123"),
+ new ItemToSign(CreateTestResource("test.ps1"), "123"),
+ new ItemToSign(CreateTestResource("test.psd1"), "123"),
+ new ItemToSign(CreateTestResource("test.psm1"), "123"),
+ new ItemToSign(CreateTestResource("test.psc1"), "123"),
+ new ItemToSign(CreateTestResource("test.dylib"), "123"),
+ new ItemToSign(GetResourcePath("EmptyPKT.dll"), "123"),
+ new ItemToSign(GetResourcePath("test.vsix"), "123"),
+ new ItemToSign(GetResourcePath("Simple.nupkg"), "123"),
// This symbols nupkg has the same hash as Simple.nupkg.
// It should still get signed with a different signature.
- new TaskItem(GetResourcePath("Simple.symbols.nupkg"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- }),
+ new ItemToSign(GetResourcePath("Simple.symbols.nupkg"), "123"),
+ // A few extra interesting cases. This has no file extension
+ new ItemToSign(GetResourcePath("filewithoutextension"), "123"),
+ // This will be marked as not having any cert.
+ new ItemToSign(GetResourcePath("SPCNoPKT.dll"), "123"),
+ // This will be marked to have hardening and notarization
+ new ItemToSign(GetResourcePath("Simple.exe"), "1234")
};
var strongNameSignInfo = new Dictionary>()
{
- { "581d91ccdfc4ea9c", new List {new SignInfo("ArcadeCertTest", "StrongNameValue", "123") } },
+ { "581d91ccdfc4ea9c", new List {new SignInfo(certificate: "ArcadeCertTest", strongName: "StrongNameValue", collisionPriorityId: "123") } },
};
// Overriding information
@@ -2526,6 +2760,19 @@ public void SpecificFileSignInfos()
{ new ExplicitCertificateKey("ProjectOne.dll", "581d91ccdfc4ea9c", ".NETFramework,Version=v4.6.1", "123"), "DLLCertificate3" },
{ new ExplicitCertificateKey("ProjectOne.dll", "581d91ccdfc4ea9c", ".NETStandard,Version=v2.0", "123"), "DLLCertificate4" },
{ new ExplicitCertificateKey("ProjectOne.dll", "581d91ccdfc4ea9c", ".NETCoreApp,Version=v2.0", "123"), "DLLCertificate5" },
+ { new ExplicitCertificateKey("filewithoutextension", collisionPriorityId: "123"), "MacDeveloperHarden" },
+ { new ExplicitCertificateKey("SPCNoPKT.dll", collisionPriorityId: "123"), "None" },
+ { new ExplicitCertificateKey("Simple.exe", collisionPriorityId: "1234"), "MacDeveloperHardenWithNotarization" },
+ };
+
+ // Set up the cert to allow for signing and notarization.
+ var certificatesSignInfo = new Dictionary>()
+ {
+ { "MacDeveloperHardenWithNotarization",
+ new List() {
+ new AdditionalCertificateInformation() { MacNotarizationAppName = "dotnet", MacSigningOperation = "MacDeveloperHarden" }
+ }
+ }
};
ValidateFileSignInfos(itemsToSign, strongNameSignInfo, fileSignInfo, s_fileExtensionSignInfo, new[]
@@ -2546,14 +2793,18 @@ public void SpecificFileSignInfos()
"File 'Simple.dll' TargetFramework='.NETCoreApp,Version=v2.1' Certificate='DLLCertificate2'",
"File 'Simple.nupkg' Certificate='NUPKGCertificate'",
"File 'Simple.symbols.nupkg' Certificate='NUPKGCertificate2'",
+ "File 'filewithoutextension' Certificate='MacDeveloperHarden'",
+ "File 'Simple.exe' TargetFramework='.NETCoreApp,Version=v2.1' Certificate='MacDeveloperHarden' NotarizationAppName='dotnet'",
},
+ additionalCertificateInfo: certificatesSignInfo,
expectedWarnings: new[]
{
$@"SIGN004: Signing 3rd party library '{Path.Combine(_tmpDir, "EmptyPKT.dll")}' with Microsoft certificate 'DLLCertificate'. The library is considered 3rd party library due to its copyright: ''.",
$@"SIGN004: Signing 3rd party library '{Path.Combine(_tmpDir, "ContainerSigning", "9", "lib/net461/ProjectOne.dll")}' with Microsoft certificate 'DLLCertificate3'. The library is considered 3rd party library due to its copyright: ''.",
$@"SIGN004: Signing 3rd party library '{Path.Combine(_tmpDir, "ContainerSigning", "10", "lib/netstandard2.0/ProjectOne.dll")}' with Microsoft certificate 'DLLCertificate4'. The library is considered 3rd party library due to its copyright: ''.",
$@"SIGN004: Signing 3rd party library '{Path.Combine(_tmpDir, "ContainerSigning", "16", "Contents/Common7/IDE/PrivateAssemblies/ProjectOne.dll")}' with Microsoft certificate 'DLLCertificate5'. The library is considered 3rd party library due to its copyright: ''.",
- $@"SIGN004: Signing 3rd party library '{Path.Combine(_tmpDir, "ContainerSigning", "23", "Simple.dll")}' with Microsoft certificate 'DLLCertificate2'. The library is considered 3rd party library due to its copyright: ''."
+ $@"SIGN004: Signing 3rd party library '{Path.Combine(_tmpDir, "ContainerSigning", "23", "Simple.dll")}' with Microsoft certificate 'DLLCertificate2'. The library is considered 3rd party library due to its copyright: ''.",
+ $@"SIGN004: Signing 3rd party library '{Path.Combine(_tmpDir, "Simple.exe")}' with Microsoft certificate 'MacDeveloperHarden'. The library is considered 3rd party library due to its copyright: ''."
});
}
@@ -2576,9 +2827,9 @@ public void MissingCertificateName(string extension)
GetResourcePath(resourcePath) :
CreateTestResource("test" + extension);
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(inputFilePath)
+ new ItemToSign(inputFilePath)
};
new Configuration(_tmpDir,
@@ -2586,8 +2837,9 @@ public void MissingCertificateName(string extension)
new Dictionary>(),
new Dictionary(),
new Dictionary>(),
- new ITaskItem[0],
+ new(),
tarToolPath: s_tarToolPath,
+ pkgToolPath: s_pkgToolPath,
snPath: s_snPath,
task.Log)
.GenerateListOfFiles();
@@ -2615,9 +2867,9 @@ public void MissingCertificateNameButExtensionIsIgnored(string extension)
GetResourcePath(value.ResourcePath) :
CreateTestResource("test" + extension);
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(inputFilePath)
+ new ItemToSign(inputFilePath)
};
var extensionSignInfo = new Dictionary>()
@@ -2635,8 +2887,9 @@ public void MissingCertificateNameButExtensionIsIgnored(string extension)
new Dictionary>(),
new Dictionary(),
extensionSignInfo,
- new ITaskItem[0],
+ new(),
tarToolPath: s_tarToolPath,
+ pkgToolPath: s_pkgToolPath,
snPath: s_snPath,
task.Log)
.GenerateListOfFiles();
@@ -2647,12 +2900,9 @@ public void MissingCertificateNameButExtensionIsIgnored(string extension)
[Fact]
public void CrossGeneratedLibraryWithoutPKT()
{
- var itemsToSign = new ITaskItem[]
+ var itemsToSign = new List()
{
- new TaskItem(GetResourcePath("SPCNoPKT.dll"), new Dictionary
- {
- { SignToolConstants.CollisionPriorityId, "123" }
- })
+ new ItemToSign(GetResourcePath("SPCNoPKT.dll"), "123")
};
ValidateFileSignInfos(
diff --git a/src/Microsoft.DotNet.SignTool/src/AdditionalCertificateInformation.cs b/src/Microsoft.DotNet.SignTool/src/AdditionalCertificateInformation.cs
new file mode 100644
index 00000000000..e7e2ed2f4a2
--- /dev/null
+++ b/src/Microsoft.DotNet.SignTool/src/AdditionalCertificateInformation.cs
@@ -0,0 +1,26 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Microsoft.DotNet.SignTool
+{
+ public class AdditionalCertificateInformation
+ {
+ ///
+ /// If true, the certificate name can be used to sign already signed binaries.
+ ///
+ public bool DualSigningAllowed { get; set; }
+ ///
+ /// If the certificate name represents a sign+notarize operation, this is the name of the sign operation.
+ ///
+ public string MacSigningOperation { get; set; }
+ ///
+ /// If the certificate name represents a sign+notarize operation, this is the name of the notarize operation.
+ ///
+ public string MacNotarizationAppName { get; set; }
+ public string CollisionPriorityId { get; set; }
+ }
+}
diff --git a/src/Microsoft.DotNet.SignTool/src/BatchSignUtil.cs b/src/Microsoft.DotNet.SignTool/src/BatchSignUtil.cs
index bab9051aee8..20efc0422a4 100644
--- a/src/Microsoft.DotNet.SignTool/src/BatchSignUtil.cs
+++ b/src/Microsoft.DotNet.SignTool/src/BatchSignUtil.cs
@@ -27,8 +27,6 @@ internal sealed class BatchSignUtil
private readonly int _repackParallelism;
private readonly long _maximumParallelFileSizeInBytes;
- internal bool SkipZipContainerSignatureMarkerCheck { get; set; }
-
internal BatchSignUtil(IBuildEngine buildEngine,
TaskLoggingHelper log,
SignTool signTool,
@@ -126,17 +124,20 @@ private bool SignFiles()
bool signGroup(IEnumerable files, out int signedCount)
{
var filesToSign = files.Where(fileInfo => fileInfo.SignInfo.ShouldSign).ToArray();
+ var filesToNotarize = files.Where(fileInfo => fileInfo.SignInfo.ShouldNotarize).ToArray();
signedCount = filesToSign.Length;
if (filesToSign.Length == 0) return true;
- _log.LogMessage(MessageImportance.High, $"Round {round}: Signing {filesToSign.Length} files.");
+ _log.LogMessage(MessageImportance.High, $"Round {round}: Signing {filesToSign.Length} files" +
+ $"{(filesToNotarize.Length > 0? $", Notarizing {filesToNotarize.Length} files" : "")}");
foreach (var file in filesToSign)
{
string collisionIdInfo = string.Empty;
if(_hashToCollisionIdMap != null)
{
- if(_hashToCollisionIdMap.TryGetValue(file.FileContentKey, out string collisionPriorityId))
+ if(_hashToCollisionIdMap.TryGetValue(file.FileContentKey, out string collisionPriorityId) &&
+ !string.IsNullOrEmpty(collisionPriorityId))
{
collisionIdInfo = $"Collision Id='{collisionPriorityId}'";
}
@@ -153,7 +154,7 @@ bool signGroup(IEnumerable files, out int signedCount)
bool signEngines(IEnumerable