Skip to content

0.4 Release Prep #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
name: Pull Request

permissions:
contents: read

on:
pull_request:

jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
name: Checkout
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0'
- run: dotnet test

dependency-review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout
- uses: actions/setup-dotnet@v1
- uses: actions/dependency-review-action@v4
name: Dependency Review
with:
dotnet-version: '3.1.100'
- run: dotnet test
allow-licenses: MIT, Apache-2.0, BSD-2-Clause
fail-on-scopes: development, runtime, unknown
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ bin/
obj/
.vs/
.vscode/
out/
70 changes: 70 additions & 0 deletions build/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# PowerShell < 7 does not handle ZIP files correctly.
if ($PSVersionTable.PSVersion.Major -lt 7) {
throw "This script requires PowerShell 7 or higher."
}

$rootDir = $MyInvocation.MyCommand.Path

if (!$rootDir) {
$rootDir = $psISE.CurrentFile.Fullpath
}

if ($rootDir) {
foreach($i in 1..2) {
$rootDir = Split-Path $rootDir -Parent
}
}
else {
throw 'Could not determine root directory of project.'
}

if (![bool](Get-Command -ErrorAction Stop -Type Application dotnet)) {
throw 'dotnet SDK could not be found.'
}

$winKitDir = Get-ItemPropertyValue 'HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots' 'KitsRoot10'

if (!$winKitDir -or !(Test-Path -Path $winKitDir)) {
throw 'Windows SDK path is not found.'
}

$sdkVersion = Get-ChildItem -Path 'HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots' | Sort-Object Name -Descending | Select-Object -ExpandProperty PSChildName -First 1
$sdkPath = Join-Path -Path $winKitDir -ChildPath 'bin'
$sdkPath = Join-Path -Path $sdkPath -ChildPath $sdkVersion

$architecture = [System.Environment]::GetEnvironmentVariable("PROCESSOR_ARCHITECTURE")
$archDirName = switch ($architecture) {
'ARM64' { 'arm64' }
'x86' { 'x86' }
'AMD64' { 'x64' }
Default { throw 'Unknown architecture' }
}

$sdkBinPath = Join-Path -Path $sdkPath -ChildPath $archDirName
$objDir = Join-Path -Path $rootDir -ChildPath 'obj'
$outDir = Join-Path -Path $rootDir -ChildPath 'out'

pushd $rootDir

Remove-Item -Path $objDir -Recurse -Force -ErrorAction SilentlyContinue
New-Item -Path $objDir -ItemType Directory

Remove-Item -Path $outDir -Recurse -Force -ErrorAction SilentlyContinue
New-Item -Path $outDir -ItemType Directory

dotnet pack -p:OutputFileNamesWithoutVersion=true -p:ContinuousIntegrationBuild=true -c Release -o $objDir src\AuthenticodeExaminer\AuthenticodeExaminer.csproj

Expand-Archive -Path $objDir\AuthenticodeExaminer.nupkg -DestinationPath $objDir\AuthenticodeExaminer.nupkg.dir

Remove-Item -Path $objDir\AuthenticodeExaminer.nupkg

& "$sdkBinPath\signtool.exe" sign /d "AuthenticodeExaminer" /sha1 73f0844a95e35441a676cd6be1e79a3cd51d00b4 /fd SHA384 /td SHA384 /tr "http://timestamp.digicert.com" /du "https://github.com/vcsjones/AuthenticodeExaminer" "$objDir\AuthenticodeExaminer.nupkg.dir\lib\netstandard2.0\AuthenticodeExaminer.dll"
& "$sdkBinPath\signtool.exe" sign /d "AuthenticodeExaminer" /sha1 73f0844a95e35441a676cd6be1e79a3cd51d00b4 /fd SHA384 /td SHA384 /tr "http://timestamp.digicert.com" /du "https://github.com/vcsjones/AuthenticodeExaminer" "$objDir\AuthenticodeExaminer.nupkg.dir\lib\net462\AuthenticodeExaminer.dll"

Compress-Archive -Path "$objDir\AuthenticodeExaminer.nupkg.dir\*" -DestinationPath "$objDir\AuthenticodeExaminer.nupkg"

dotnet nuget sign --certificate-fingerprint 68821304869e065c24e0684eb43bf974e124642f3437f2ff494a93bb371d029a --hash-algorithm SHA384 --timestamper "http://timestamp.digicert.com" --overwrite "$objDir\AuthenticodeExaminer.nupkg"

Copy-Item -Path "$objDir\AuthenticodeExaminer.nupkg" -Destination "$outDir\AuthenticodeExaminer.nupkg"

popd
2 changes: 1 addition & 1 deletion sample/sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

Expand Down
10 changes: 5 additions & 5 deletions src/AuthenticodeExaminer/AuthenticodeExaminer.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net46;net461</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Authors>Kevin Jones</Authors>
<PackageTags>authenticode;codesign</PackageTags>
<PackageProjectUrl>https://github.com/vcsjones/AuthenticodeExaminer</PackageProjectUrl>
<PackageVersion>0.3.0</PackageVersion>
<Version>0.4.0</Version>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
Expand All @@ -16,14 +16,14 @@
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="4.7.0" />
<PackageReference Include="System.Security.Cryptography.Xml" Version="4.7.0" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="8.0.1" />
<PackageReference Include="System.Security.Cryptography.Xml" Version="8.0.1" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
<Reference Include="System.Security" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Memory" Version="4.5.3" />
<PackageReference Include="System.Memory" Version="4.6.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net46</TargetFrameworks>
<TargetFrameworks>net8.0;net472</TargetFrameworks>
<IsPackable>false</IsPackable>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="xunit.v3" Version="2.0.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../../src/AuthenticodeExaminer/AuthenticodeExaminer.csproj" />
Expand Down