Fix portable MSI signatures rejected by Windows - #37
Merged
Marc-André Moreau (mamoreau-devolutions) merged 3 commits intoSep 20, 2026
Merged
Marc-André Moreau (mamoreau-devolutions) merged 3 commits into
Marc-André Moreau (mamoreau-devolutions) merged 3 commits into
Conversation
Encode Authenticode digest identifiers with NULL parameters, use rsaEncryption for the signer algorithm, and include the standard SpcSpOpusInfo and SpcStatementType authenticated attributes. Keep generic CMS signing on its existing profile.
Write MsiDigitalSignatureEx before computing the final MSI SIP digest and embed the PKCS#7 into that same staged image. Match Windows metadata traversal details and cover the prepared signing state.
Generate a valid no-op WiX package, prove Windows Installer can open it, sign it with both SignTool and portable psign, and require native SignTool verification of both outputs. Reuse the fixture in exhaustive Windows parity.
Marc-André Moreau (mamoreau-devolutions)
requested a balanced review from Copilot
September 20, 2026 15:47
Copilot started reviewing on behalf of
Marc-André Moreau (mamoreau-devolutions)
September 20, 2026 15:47
View session
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
It changes cryptographic CMS generation and Windows-specific SIP digest semantics across multiple signing paths.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes portable MSI signing so Windows SIP accepts generated signatures.
Changes:
- Stages MSI metadata before digesting and embedding signatures.
- Aligns CMS attributes, algorithms, and MSI traversal with Windows.
- Adds generated MSI fixtures and native Windows verification.
| File | Description |
|---|---|
crates/psign-sip-digest/src/msi_digest.rs |
Implements prepared MSI digest state and Windows-compatible traversal. |
crates/psign-sip-digest/src/pkcs7.rs |
Aligns Authenticode CMS algorithms and signed attributes. |
crates/psign-portable-core/src/lib.rs |
Uses prepared MSI state for unified portable signing. |
crates/psign-digest-cli/src/main.rs |
Updates local and remote MSI signing flows. |
tests/cli_pe_digest.rs |
Verifies MSI CMS profile details. |
tests/parity_signtool.rs |
Requires native acceptance of generated signatures. |
tests/fixtures/msi-parity/minimal.wxs |
Defines a minimal MSI fixture. |
tests/fixtures/README.md |
Documents generated MSI parity fixtures. |
scripts/ci/create-minimal-msi.ps1 |
Builds and validates the MSI fixture. |
scripts/ci/run-exhaustive-parity-ci.ps1 |
Adds MSI generation to exhaustive parity. |
.github/workflows/windows.yml |
Adds native Windows MSI verification. |
docs/ci-parity.md |
Documents the expanded CI workflow. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Marc-André Moreau (mamoreau-devolutions)
approved these changes
Sep 20, 2026
Marc-André Moreau (mamoreau-devolutions)
merged commit Sep 20, 2026
6eae5f4
into
Devolutions:master
18 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MsiDigitalSignatureExbefore calculating the final MSI Authenticode digestProblem
portable sign-msicould produce an MSI that passed psign's own digest verification but failed native Windows verification withTRUST_E_BAD_DIGEST.The signing path calculated the final MSI digest before creating the
MsiDigitalSignatureExmetadata-digest stream. Windows evaluates the prepared compound-file image containing that stream, so the digest embedded inSpcIndirectDatadid not describe the same signing state.The generated CMS also differed from the Windows Authenticode profile in its algorithm identifiers and required signed attributes.
Change
Introduce a prepared MSI signing state that:
MsiDigitalSignatureExstream;DigitalSignatureinto the same image after signing.Both local certificate signing and remote Artifact Signing use this prepared state.
The MSI traversal now also matches Windows behavior for:
FILETIMEvalues.Authenticode CMS generation now uses the Windows-compatible digest and RSA algorithm identifiers and includes
SpcSpOpusInfoandSpcStatementType. Generic CMS signing retains its existing profile.Tests
Unit tests cover:
MsiDigitalSignatureExbefore the final digest;The Windows workflow generates a valid no-op MSI from committed WiX source, verifies that Windows Installer can open it, signs copies using SignTool and portable psign, and requires native
signtool verify /pato accept both.No signed MSI or product binary is committed as a fixture.
Validation
cargo fmt --all -- --checkcargo test -p psign-sip-digest --lib --lockedcargo test -p psign --test cli_pe_digest --locked