Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Get-AuthenticodeSignature Displaying Inconsistent Behavior Between -FilePath and -Content #18773

Copy link
Copy link
@s-nix

Description

@s-nix
Issue body actions

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

image

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.