diff options
author | Neal H. Walfield <neal@sequoia-pgp.org> | 2024-01-24 14:22:34 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@sequoia-pgp.org> | 2024-01-24 16:00:41 +0100 |
commit | eaf8bff6aa524ba46e11e3d2ad272c1d8a568d61 (patch) | |
tree | 6e0a18e0b27df5a973645854c2f226c8b9b9b71f /openpgp | |
parent | de51f1680d2a9a449639c2f32312fc1cba707a16 (diff) |
openpgp: Use SubpacketAreas::issuers to get issuer subpackets.
- When checking for an issuer subpacket, `SubpacketAreas::issuers`,
not `SubpacketAreas::get_issuers`.
Diffstat (limited to 'openpgp')
-rw-r--r-- | openpgp/src/packet/signature.rs | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/openpgp/src/packet/signature.rs b/openpgp/src/packet/signature.rs index b8fce53c..b9e91268 100644 --- a/openpgp/src/packet/signature.rs +++ b/openpgp/src/packet/signature.rs @@ -4212,18 +4212,20 @@ mod test { // of the deduplicating nature of the merge. let merged = sig.clone().merge(malicious.clone())?; let issuers = merged.get_issuers(); + let keyid_issuers = merged.issuers().collect::<Vec<&KeyID>>(); assert_eq!(issuers.len(), 3); assert!(issuers.contains(&KeyHandle::from(&fp))); - assert!(issuers.contains(&KeyHandle::from(&keyid))); - assert!(issuers.contains(&KeyHandle::from(&dummy))); + assert!(keyid_issuers.contains(&&keyid)); + assert!(keyid_issuers.contains(&&dummy)); // Same, but the other way around. let merged = malicious.clone().merge(sig.clone())?; let issuers = merged.get_issuers(); + let keyid_issuers = merged.issuers().collect::<Vec<_>>(); assert_eq!(issuers.len(), 3); assert!(issuers.contains(&KeyHandle::from(&fp))); - assert!(issuers.contains(&KeyHandle::from(&keyid))); - assert!(issuers.contains(&KeyHandle::from(&dummy))); + assert!(keyid_issuers.contains(&&keyid)); + assert!(keyid_issuers.contains(&&dummy)); // Try to displace the issuer information using garbage // packets. @@ -4247,16 +4249,18 @@ mod test { // the merge prefers plausible packets. let merged = sig.clone().merge(malicious.clone())?; let issuers = merged.get_issuers(); + let keyid_issuers = merged.issuers().collect::<Vec<_>>(); assert_eq!(issuers.len(), 2); assert!(issuers.contains(&KeyHandle::from(&fp))); - assert!(issuers.contains(&KeyHandle::from(&keyid))); + assert!(keyid_issuers.contains(&&keyid)); // Same, but the other way around. let merged = malicious.clone().merge(sig.clone())?; let issuers = merged.get_issuers(); + let keyid_issuers = merged.issuers().collect::<Vec<_>>(); assert_eq!(issuers.len(), 2); assert!(issuers.contains(&KeyHandle::from(&fp))); - assert!(issuers.contains(&KeyHandle::from(&keyid))); + assert!(keyid_issuers.contains(&&keyid)); // Try to displace the issuer information by using random keyids. let mut malicious = sig.clone(); @@ -4280,14 +4284,16 @@ mod test { let merged = verified.clone().merge(malicious.clone())?; let issuers = merged.get_issuers(); + let keyid_issuers = merged.issuers().collect::<Vec<_>>(); assert!(issuers.contains(&KeyHandle::from(&fp))); - assert!(issuers.contains(&KeyHandle::from(&keyid))); + assert!(keyid_issuers.contains(&&keyid)); // Same, but the other way around. let merged = malicious.clone().merge(verified.clone())?; let issuers = merged.get_issuers(); + let keyid_issuers = merged.issuers().collect::<Vec<_>>(); assert!(issuers.contains(&KeyHandle::from(&fp))); - assert!(issuers.contains(&KeyHandle::from(&keyid))); + assert!(keyid_issuers.contains(&&keyid)); Ok(()) } |