Skip to content

Commit

Permalink
Add signature verification to Regcool
Browse files Browse the repository at this point in the history
  • Loading branch information
emtuls committed Apr 10, 2024
1 parent bd7fcf7 commit 241df52
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/regcool.vm/regcool.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>regcool.vm</id>
<version>2.0.0.20240408</version>
<version>0.0.0.20240410</version>
<authors>Kurt Zimmermann</authors>
<description>In addition to all the features that you can find in RegEdit and RegEdt32, RegCool adds many powerful features that allow you to work faster and more efficiently with registry related tasks</description>
<dependencies>
Expand Down
34 changes: 32 additions & 2 deletions packages/regcool.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,38 @@ Import-Module vm.common -Force -DisableNameChecking

$toolName = 'RegCool'
$category = 'Registry'
$toolDir = Join-Path ${Env:RAW_TOOLS_DIR} $toolName

$zipUrl = 'https://kurtzimmermann.com/files/RegCoolX64.zip'
$zipSha256 = '7bf7ba799059b4ec4035c504de6ea27ea2e9440379b4ec25d09cb58f17ce609b'

VM-Install-From-Zip $toolName $category $zipUrl -zipSha256 $zipSha256 -consoleApp $false -innerFolder $false
try {
# Download zip
$packageArgs = @{
packageName = $env:ChocolateyPackageName
file = Join-Path ${Env:TEMP} $toolName
url = $zipUrl
}
$filePath = Get-ChocolateyWebFile @packageArgs

# Extract zip
Get-ChocolateyUnzip -FileFullPath $filePath -Destination $toolDir

# Check signature of all unzip files
Get-ChildItem -Path "$toolDir\*.{exe,dll}" | ForEach-Object {
VM-Assert-Signature $_.FullName
}
} catch {
# Remove files with invalid signature
Remove-Item $toolDir -Recurse -Force -ea 0 | Out-Null
VM-Write-Log-Exception $_
}

try {
$shortcutDir = Join-Path ${Env:TOOL_LIST_DIR} $category
$shortcut = Join-Path $shortcutDir "$toolname.lnk"
$toolPath = Join-Path $toolDir "$toolName.exe"
Install-ChocolateyShortcut -shortcutFilePath $shortcut -targetPath $toolPath
VM-Assert-Path $shortcut
} catch {
VM-Write-Log-Exception $_
}

0 comments on commit 241df52

Please sign in to comment.