liveBook · Manning

Digital signature

As explained in Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools

A digital signature is cryptographic metadata attached to a file that authenticates its signer and detects changes to the signed content.

A digital signature attaches certificate identity information and a content hash to a PowerShell script. The private key creates the signature; the public key verifies the signer and detects any change. section 21.2 section 21.4

Use signatures as a practical safety check:

  • Protect the certificate’s private key, ideally with password protection in the Windows certificate store. section 21.2
  • Check a script with Get-AuthenticodeSignature before running it. section 21.4.4
  • Treat a broken signature as a reason to investigate, then re-sign only after confirming the change. section 21.4.4
PS C:\scripts> Get-AuthenticodeSignature .\psvm.ps1
    Directory: C:\scripts
SignerCertificate                         Status                  Path
-----------------                         ------                  ----
9D16AF2573AC6C01A33752CA5135F3700A6FE9CF  Valid               psvm.ps1

A compact PowerShell listing shows a valid Authenticode status for a signed script. section 21.4.4

How Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools covers it

How deep it goes
Explains key pairs, hashes, verification, testing, execution policy, and tamper errors, while deferring detailed PKI theory.
Examples
Uses a signed psvm.ps1 script, Get-AuthenticodeSignature output, trusted-publisher prompts, and an altered-file failure.
What it assumes
Assumes basic PowerShell usage and introduces certificate key pairs without requiring detailed PKI knowledge.
What you can do after
Diagnose/debug with Get-AuthenticodeSignature and recognize when a changed script must be investigated or re-signed.
How it connects
Connects digital signatures with certificates, public-key cryptography, PKI, Authenticode, and execution policy.

Also explained in

Compare how 8 books explain digital signature →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools. The section links point to the parts of the book it draws on.