Skip to content

Commit 6d175ea

Browse files
Add automatic AuthRoot cache
Add a portable AuthRoot cache resolver with stale refresh and environment overrides, wire it into portable trust verification, and align the PowerShell module cache behavior. Normalize exact duplicate certificates in Authenticode SignedData certificate bags so Windows-valid Azure Artifact Signing signatures parse in the strict Rust CMS stack. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0eddd27 commit 6d175ea

21 files changed

Lines changed: 881 additions & 69 deletions

Cargo.lock

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PowerShell/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ New-PSDrive -Name certs -PSProvider PortableCertStore -Root ./project-certs
9595

9696
## Trust Model
9797

98-
By default, `Get-PsignSignature` automatically downloads and caches the Microsoft AuthRoot CAB (~350KB) for trust evaluation. The cache lives at `~/.psign/authroot/`.
98+
By default, `Get-PsignSignature`, `Test-PsignFileCatalog`, and `Test-PsignModule` automatically download and cache the Microsoft AuthRoot CAB for trust evaluation when no explicit trust anchors are supplied. The cache lives at `~/.psign/authroot/` and is refreshed when it is older than 7 days. Set `PSIGN_AUTHROOT_MAX_AGE_DAYS`, `PSIGN_AUTHROOT_CACHE_DIR`, or `PSIGN_AUTHROOT_URL` to override the stale window, cache directory, or source URL.
9999

100100
```powershell
101101
# Disable auto-trust

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ cargo build -p psign --bin psign-tool --locked
8686
# Portable PE signing with a local RSA key:
8787
# psign-tool portable sign-pe --cert cert.der --key key.pk8 --output signed.exe unsigned.exe
8888
# Existing PE signatures are replaced by default; add --append-signature to match signtool /as.
89-
# Portable trust verification with explicit anchors:
89+
# Portable trust verification downloads/caches Microsoft AuthRoot automatically when no anchors are supplied:
90+
# psign-tool portable trust-verify-pe signed.exe
91+
# Explicit anchors still override auto trust:
9092
# psign-tool portable trust-verify-pe signed.exe --anchor-dir anchors
9193
# Portable custom ZIP Authenticode verification:
9294
# psign-tool portable trust-verify-zip archive.zip --anchor-dir anchors

crates/psign-authenticode-trust/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ repository.workspace = true
1010
anyhow = "1"
1111
base64 = "0.22"
1212
serde = { version = "1", features = ["derive"] }
13+
serde_json = "1"
1314
cms = "0.2.3"
1415
der = { version = "0.7", features = ["derive"] }
1516
digest = "0.10"
@@ -20,7 +21,7 @@ authenticode = { version = "0.5.0", features = ["std", "object"] }
2021
psign-sip-digest = { path = "../psign-sip-digest" }
2122
picky = { version = "7.0.0-rc.23", features = ["pkcs7", "time_conversion"] }
2223
picky-asn1-x509 = "0.15.4"
23-
time = "0.3"
24+
time = { version = "0.3", features = ["formatting", "parsing"] }
2425
x509-cert = "0.2.5"
2526
cab = "0.6"
2627

0 commit comments

Comments
 (0)