forked from dotnet/aspnetcore
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
sign.installers.ps1
26 lines (22 loc) · 955 Bytes
/
sign.installers.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
if ($env:CI -eq "true") {
exit 0
}
$cert = Get-ChildItem -Path Cert:\CurrentUser\My -CodeSigningCert | Select-Object -First 1
if ($null -eq $cert) {
Write-Host "No code signing certificate found in MY store. Exit."
exit 1
}
Write-Host "Certificate found. Sign the assemblies."
$signtool = Get-ChildItem -Path "${env:ProgramFiles(x86)}\Windows Kits" -Recurse -Filter "signtool.exe" | Select-Object -First 1 -ExpandProperty FullName
Write-Host "Verify digital signature."
$files = Get-ChildItem .\artifacts\installers\Release\* -Include ('*.msi') -File
$files | ForEach-Object {
& $signtool sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /d "Http Platform Handler v2" /a $_.FullName 2>&1 | Write-Debug
& $signtool verify /pa /q $_.FullName 2>&1 | Write-Debug
if ($LASTEXITCODE -ne 0)
{
Write-Host "$_.FullName is not signed. Exit."
exit $LASTEXITCODE
}
}
Write-Host "Verification finished."