Prerequisites
Steps to reproduce
I am currently experiencing an issue with Get-AuthenticodeSignature where when checking the signature with a direct file path the signature is valid, however when converting the same file into a byte array and attempting to run Get-AuthenticodeSignature against it, it reports no valid signature.
Get-AuthenticodeSignature -FilePath "~\Repos\Strapper\Strapper\Strapper.psm1"
<#
SignerCertificate Status StatusMessage Path
----------------- ------ ------------- ----
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF Valid Signature verified. Strapper.psm1
#>
Get-AuthenticodeSignature -Content (Get-Content -Path "~\Repos\Strapper\Strapper\Strapper.psm1" -AsByteStream) -SourcePathOrExtension psm1
<#
SignerCertificate Status StatusMessage Path
----------------- ------ ------------- ----
NotSigned The file psm1 is no… psm1
#>
I assumed that this could have been a file extension issue, and it does appear to be replicated with even simple files, but changing the extension doesn't appear to fix the issue:
Get-AuthenticodeSignature -FilePath "~\Downloads\Get-Host.psm1"
<#
SignerCertificate Status StatusMessage Path
----------------- ------ ------------- ----
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF Valid Signature verified. Get-Host.psm1
#>
Get-AuthenticodeSignature -Content (Get-Content "~\Downloads\Get-Host.psm1" -AsByteStream) -SourcePathOrExtension psm1
<#
SignerCertificate Status StatusMessage Path
----------------- ------ ------------- ----
NotSigned The file psm1 is no… psm1
#>
Get-AuthenticodeSignature -FilePath "~\Downloads\Get-Host.ps1"
<#
SignerCertificate Status StatusMessage Path
----------------- ------ ------------- ----
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF Valid Signature verified. Get-Host.ps1
#>
Get-AuthenticodeSignature -Content (Get-Content "~\Downloads\Get-Host.ps1" -AsByteStream) -SourcePathOrExtension ps1
<#
SignerCertificate Status StatusMessage Path
----------------- ------ ------------- ----
NotSigned The file ps1 is not… ps1
#>
Get-Host.psm1
Get-Host
# SIG # Begin signature block
# MIInbwYJKoZIhvcN...
# SIG # End signature block
Expected behavior
PS> Get-AuthenticodeSignature -Content (Get-Content -Path "~\Repos\Strapper\Strapper\Strapper.psm1" -AsByteStream) -SourcePathOrExtension psm1
SignerCertificate Status StatusMessage Path
----------------- ------ ------------- ----
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF Valid Signature verified. Strapper.psm1
Actual behavior
PS> Get-AuthenticodeSignature -Content (Get-Content -Path "~\Repos\Strapper\Strapper\Strapper.psm1" -AsByteStream) -SourcePathOrExtension psm1
SignerCertificate Status StatusMessage Path
----------------- ------ ------------- ----
NotSigned The file psm1 is no… psm1
Error details
No response
Environment data
PS> $PSVersionTable
Name Value
---- -----
PSVersion 7.3.0
PSEdition Core
GitCommitId 7.3.0
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals

Prerequisites
Steps to reproduce
I am currently experiencing an issue with
Get-AuthenticodeSignaturewhere when checking the signature with a direct file path the signature is valid, however when converting the same file into a byte array and attempting to runGet-AuthenticodeSignatureagainst it, it reports no valid signature.I assumed that this could have been a file extension issue, and it does appear to be replicated with even simple files, but changing the extension doesn't appear to fix the issue:
Get-Host.psm1Expected behavior
Actual behavior
Error details
No response
Environment data
Visuals