Skip to content

Commit

Permalink
Merge pull request #29 from ricaun-io/develop
Browse files Browse the repository at this point in the history
Version 1.2.0
  • Loading branch information
ricaun authored Apr 4, 2022
2 parents c2ac9c8 + cf74838 commit e016193
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 32 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.2.0] / 2022-04-04
### Features
- Add Sign multiple Timestamp Server

## [1.1.3] / 2022-03-10
### New Features
- Add SignFolder on ISign
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

This package is to simplify the build automation system using [Nuke.Common](https://www.nuget.org/packages/Nuke.Common/).

[![Visual Studio 2019](https://img.shields.io/badge/Visual%20Studio%202019-16.11.7+-blue)](../..)
[![Nuke](https://img.shields.io/badge/Nuke-Build-blue)](https://nuke.build/)
[![License MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Publish](../../actions/workflows/Publish.yml/badge.svg)](../../actions)
[![Develop](../../actions/workflows/Develop.yml/badge.svg)](../../actions)
[![Release](https://img.shields.io/nuget/v/ricaun.Nuke?logo=nuget&label=release&color=blue)](https://www.nuget.org/packages/ricaun.Nuke)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

<PropertyGroup>
<PackageId>ricaun.Nuke.RevitAddin.Example</PackageId>
<Version>1.0.0</Version>
<Version>1.2.0</Version>
<ProjectGuid>{a030741a-2fd6-48c3-9f92-3ab9f35dd17a}</ProjectGuid>
</PropertyGroup>

Expand Down
75 changes: 45 additions & 30 deletions ricaun.Nuke/Extensions/SignExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ public static class SignExtension
#region Sign Util

/// <summary>
/// timestampServer
/// timestampServers
/// </summary>
const string timestampServer = "http://timestamp.digicert.com/";
static readonly string[] timestampServers = {
"http://timestamp.comodoca.com",
"http://timestamp.digicert.com"
};

/// <summary>
/// VerifySignFile
Expand Down Expand Up @@ -63,21 +66,27 @@ public static void SignBinary(string certPath, string certPassword, string binar

Serilog.Log.Information($"Signing: {binaryPath}");

try
{
SignToolTasks.SignTool(x => x
.SetFiles(binaryPath)
.SetFile(certPath)
.SetPassword(certPassword)
.SetTimestampServerUrl(timestampServer)
.SetFileDigestAlgorithm(SignToolDigestAlgorithm.SHA256)
);
}
catch (Exception)
foreach (var timestampServer in timestampServers)
{
Serilog.Log.Error($"Failed to sign file '{binaryPath}");
try
{
SignToolTasks.SignTool(x => x
.SetFiles(binaryPath)
.SetFile(certPath)
.SetPassword(certPassword)
.SetTimestampServerUrl(timestampServer)
.SetFileDigestAlgorithm(SignToolDigestAlgorithm.SHA256)
.EnableQuiet()
);
Serilog.Log.Information($"Signing done with '{timestampServer}");
return;
}
catch (Exception)
{
Serilog.Log.Warning($"Failed to sign file with '{timestampServer}");
}
}

Serilog.Log.Error($"Failed to sign file '{binaryPath}");
}

/// <summary>
Expand All @@ -92,23 +101,29 @@ public static void SignNuGet(string certPath, string certPassword, string binary

Serilog.Log.Information($"Signing: {binaryPath}");

try
foreach (var timestampServer in timestampServers)
{
NuGetTasks.NuGet(
$"sign \"{binaryPath}\"" +
$" -CertificatePath {certPath}" +
$" -CertificatePassword {certPassword}" +
$" -Timestamper {timestampServer} -NonInteractive",
logOutput: false,
logInvocation: false
); // don't print to std out/err
}
catch (Exception)
{
// Exception doesn't say anything useful generally and don't want to expose it if it does
// so don't log it
Serilog.Log.Error($"Failed to sign nuget package '{binaryPath}");
try
{
NuGetTasks.NuGet(
$"sign \"{binaryPath}\"" +
$" -CertificatePath {certPath}" +
$" -CertificatePassword {certPassword}" +
$" -Timestamper {timestampServer} -NonInteractive",
logOutput: false,
logInvocation: false
); // don't print to std out/err

Serilog.Log.Information($"Signing done with '{timestampServer}");
return;
}
catch (Exception)
{
Serilog.Log.Warning($"Failed to sign file with '{timestampServer}");
}
}

Serilog.Log.Error($"Failed to sign nuget package '{binaryPath}");
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion ricaun.Nuke/ricaun.Nuke.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<PropertyGroup>
<PackageId>ricaun.Nuke</PackageId>
<Version>1.1.3</Version>
<Version>1.2.0</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down

0 comments on commit e016193

Please sign in to comment.