Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
perf(pe): reuse decoded PKCS#7 ASN.1 tree
  • Loading branch information
Deepak-Kambala
Deepak-Kambala committed Oct 23, 2026
commit f4cdff45276e0b8fcf84ebd7e6d34a8618d85558
6 changes: 4 additions & 2 deletions src/native/pe/PeCertificateAsn1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,10 @@ const parseSignedData = (
};

/** Decode ContentInfo wrapping SignedData; other content types remain unsupported. */
export const parsePkcs7SignedData = (bytes: Buffer): ParsedSignedData => {
const root = readAsn1(bytes);
export const parsePkcs7SignedData = (
bytes: Buffer,
root: Asn1Node = readAsn1(bytes),
): ParsedSignedData => {
if (root.end !== bytes.length) return fail("ContentInfo has trailing data.");
const children = sequence(root, "ContentInfo");
const type = children[0];
Expand Down
2 changes: 1 addition & 1 deletion src/native/pe/PeCertificateParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export const parsePeCertificates = (
)
fail("WIN_CERTIFICATE has invalid PKCS#7 alignment padding.");
payload = entryPayload.subarray(0, root.end);
const parsed = parsePkcs7SignedData(payload);
const parsed = parsePkcs7SignedData(payload, root);
pkcs7 = {
content_type_oid: parsed.content_type_oid,
content_type_name: oidName(parsed.content_type_oid),
Expand Down
Loading