Add cryptographic verification to authenticode_transplant.py#326
Merged
Flickdm merged 1 commit intomicrosoft:mainfrom Feb 24, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive cryptographic verification capabilities to the Authenticode signature tool, enabling validation of PE file signatures using the cryptography library. The changes introduce hash extraction from SPC structures, certificate parsing, and full signature verification against PE files.
Key changes:
- Added cryptographic signature verification using new helper functions for OID mapping, certificate extraction, and PKCS7 verification
- Enhanced
compute_authenticode_hash()to support multiple hash algorithms (SHA1/256/384/512) and removed incorrect padding logic - Updated
validate_pkcs7_signatures()and verification commands to perform cryptographic validation before accepting signatures
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d8166a7 to
0cee114
Compare
Javagedes
reviewed
Jan 21, 2026
Javagedes
reviewed
Jan 21, 2026
Javagedes
reviewed
Jan 21, 2026
Javagedes
approved these changes
Jan 21, 2026
apop5
approved these changes
Jan 28, 2026
b4d81a1 to
600df89
Compare
600df89 to
2884a4d
Compare
Javagedes
approved these changes
Feb 24, 2026
auto-merge was automatically disabled
February 24, 2026 19:42
Rebase failed
Add full cryptographic verification of PKCS#7 Authenticode signatures in authenticode_transplant.py. This includes: - Extract and verify PE hash from SpcIndirectDataContent against the computed Authenticode hash using the signature's own hash algorithm - Cryptographically verify signer signatures (RSA PKCS1v15 and ECDSA) against authenticated attributes - Extract and display X.509 certificate details (subject, issuer, serial, validity) during verify and combine operations - Refactor calculate_authenticode_hash to compute_authenticode_hash supporting multiple hash algorithms (SHA1, SHA256, SHA384, SHA512) - Add cryptography==43.0.0 dependency and update pyasn1 to 0.6.2 Signed-off-by: Doug Flick <dougflick@microsoft.com>
533a786 to
0361ddf
Compare
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.
This commit adds comprehensive cryptographic validation to the Authenticode signature combining tool, bringing the same verification capabilities from auth_var_tool.py to PE file signature operations.
Key changes:
New functions:
Enhanced functions:
Bug fixes:
Code improvements:
Testing:
Follows Microsoft Authenticode PE specification v1.1
Description
How This Was Tested
Ran it against copies of bootmgfw.efi and hellouefi.efi that were both singly signed and
Integration Instructions
N/A