From c1099f9f88bd9492d4145d88b07d50b7c5d9c9f0 Mon Sep 17 00:00:00 2001 From: Micah Snyder Date: Wed, 11 Dec 2024 12:50:39 -0500 Subject: [PATCH] codesign verify: record the common name from the signing cert for the 'signed by' message --- libclamav_rust/src/codesign.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libclamav_rust/src/codesign.rs b/libclamav_rust/src/codesign.rs index 7fee32f423..80ea5041ea 100644 --- a/libclamav_rust/src/codesign.rs +++ b/libclamav_rust/src/codesign.rs @@ -495,9 +495,11 @@ impl Verifier { let signer = cert .subject_name() .entries() - .next() + .find(|name_entry| { + name_entry.object().nid() == openssl::nid::Nid::COMMONNAME + }) .ok_or(Error::InvalidDigitalSignature( - "Certificate does not have any name entries".to_string(), + "Certificate in the signature's cert stack does not have a Common Name entry".to_string(), ))? .data() .as_utf8()?