Skip to content

Information missing from the Set-AuthenticodeSignature and Get-AuthenticodeSignature topics #3408

Closed

Description

Missing from Set-AuthenticodeSignature:

  • Parameter -Content is technically available, but the underlying functionality is not implemented, as also indicated by the source code; that is, you get error Set-AuthenticodeSignature : The method or operation is not implemented.

Missing from Get-AuthenticodeSignature:

  • Parameter -Content only properly processes a byte array if the bytes represent "Unicode" (UTF-16LE)-encoded characters. That is, passing the bytes of a file that uses any other encoding (UTF-8, "ANSI", ...) is not supported, and obscurely reports the input as NotSigned.

  • Description of parameter -SourcePathOrExtension is lacking:

Path to the file or file type of the content, on which digital signature is retrieved.

I can see wanting to supply the file path of the originating script, but when would you use the OrExtension ("file type of the content") part?

A comment in the source code cryptically states:

/// Gets or sets the file type of the byte array containing the content with
/// digital signature.

Also note that only values ending in .ps1, psm1, ... (irrespective of whether they refer to existing files) result in the output object properly reporting the signature status; any other values cause a fixed NotSigned status, irrespective of whether the bytes themselves represent code with a valid signature.

In general, it would help if the topics stated what the typical use case for -Content + -SourcePathOrExtension is.

Version(s) of document impacted

  • Impacts 6.next document
  • Impacts 6 document
  • Impacts 5.1 document
  • Impacts 5.0 document
  • Impacts 4.0 document
  • Impacts 3.0 document

Reason(s) for not selecting all version of documents

  • The documented feature was introduced in selected version of PowerShell
  • This issue only shows up in selected version of the document

Activity

  1. added
    area-security
    on Dec 12, 2018
  2. abatishchev commented on Dec 12, 2018

    @abatishchev

    I'd like to note that I spent a week on this issue. And only thanks to Michael Klement (@mklement0) I got an explanation what's going on. Ping me internally at alexbat for more details, if you'd like.

    Description of parameter -SourcePathOrExtension is lacking:

    Path to the file or file type of the content, on which digital signature is retrieved.

    From the documentation, it's absolutely unclear indeed what is the purpose and the intended use of this parameter. I passed both $_.Name and [System.IO.Path]::GetExtension($_.Name) and both surprisingly worked.

  3. abatishchev commented on Sep 3, 2019

    @abatishchev

    Bump. Would like to see any update or progress on this issue.

  4. abatishchev commented on Sep 13, 2019

    @abatishchev

    Bump.

  5. added
    review-shiproom
    on Apr 9, 2020
  6. added a commit that references this issue on Apr 10, 2020
    c2474eb
  7. removed
    review-shiproom
    on Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-security

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions