Use new Windows signature APIs from Microsoft.Security.Extensions package (#17159)

Co-authored-by: Anam Navied <anam.naviyou@gmail.com>
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
This commit is contained in:
Paul Higinbotham
2022-04-20 21:26:57 +00:00
committed by GitHub
co-authored by Anam Navied Travis Plunk
parent c2e11e9329
commit 8d453da283
8 changed files with 212 additions and 269 deletions
@@ -0,0 +1,22 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
Describe "Windows platform file signatures" -Tags 'Feature' {
It "Verifies Get-AuthenticodeSignature returns correct signature for catalog signed file" -Skip:(!$IsWindows) {
if ($null -eq $env:windir) {
throw "Expected Windows platform environment path variable '%windir%' not available."
}
$filePath = Join-Path -Path $env:windir -ChildPath 'System32\ntdll.dll'
if (! (Test-Path -Path $filePath)) {
throw "Expected Windows PowerShell platform module path '$filePath' not found."
}
$signature = Get-AuthenticodeSignature -FilePath $filePath
$signature | Should -Not -BeNullOrEmpty
$signature.Status | Should -BeExactly 'Valid'
$signature.SignatureType | Should -BeExactly 'Catalog'
}
}