-
-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tools: Backport windows code signing
- Loading branch information
Showing
5 changed files
with
65 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace NAPS2.Tools.Project.Packaging; | ||
|
||
public static class WindowsSigning | ||
{ | ||
public static void SignContents(PackageInfo packageInfo) | ||
{ | ||
// Exclude resource DLLs from signing as that saves 40% time/space and doesn't really provide any value. | ||
// TODO: Maybe reevaluate this | ||
foreach (var batch in packageInfo.Files.Where(file => !file.FileName.EndsWith(".resources.dll")).Chunk(10)) | ||
{ | ||
var files = string.Join(" ", | ||
batch | ||
.Where(file => Path.GetExtension(file.FileName) is ".exe" or ".dll") | ||
.Select(file => $"\"{file.SourcePath}\"")); | ||
if (files.Length > 0) | ||
{ | ||
Cli.Run("signtool", | ||
$"sign /tr http://timestamp.globalsign.com/tsa/r6advanced1 /td sha256 /fd sha256 /a {files}"); | ||
} | ||
} | ||
} | ||
|
||
public static void SignFile(string path) | ||
{ | ||
Cli.Run("signtool", | ||
$"sign /tr http://timestamp.globalsign.com/tsa/r6advanced1 /td sha256 /fd sha256 /a \"{path}\""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters