diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-03-01 16:01:45 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-03-01 16:01:45 +0100 |
commit | e36ff03381c7293f9f79eb2886a675c845041b46 (patch) | |
tree | 5b1546462855f769d0aec6ebf5d438c4c01a4e5b /openpgp/src/serialize/cert_armored.rs | |
parent | 5b6eb1611bccd8c81a05ba9d7f0782a4d18ce2e9 (diff) |
openpgp: Use a policy to determine what components are valid.
- When generating armor headers, use a policy to determine what
components are valid.
Diffstat (limited to 'openpgp/src/serialize/cert_armored.rs')
-rw-r--r-- | openpgp/src/serialize/cert_armored.rs | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/openpgp/src/serialize/cert_armored.rs b/openpgp/src/serialize/cert_armored.rs index 47093dfb..5baaa8b6 100644 --- a/openpgp/src/serialize/cert_armored.rs +++ b/openpgp/src/serialize/cert_armored.rs @@ -3,12 +3,12 @@ use std::io; use std::str; use crate::armor; +use crate::cert::{Cert, amalgamation::ValidAmalgamation}; use crate::Result; use crate::types::RevocationStatus; use crate::serialize::{ Serialize, SerializeInto, generic_serialize_into, generic_export_into, }; -use crate::Cert; use crate::policy::StandardPolicy as P; @@ -28,27 +28,18 @@ impl Cert { /// default policy) are included as comments, so that it is easier /// to identify the Cert when looking at the armored data. pub fn armor_headers(&self) -> Vec<String> { - let p = P::default(); + let p = &P::default(); let length_value = armor::LINE_LENGTH - "Comment: ".len(); // Create a header per userid. - let mut headers: Vec<String> = self.userids() + let mut headers: Vec<String> = self.userids().with_policy(p, None) // Ignore revoked userids. .filter_map(|uidb| { - if let RevocationStatus::Revoked(_) = uidb.revoked(&p, None) { + if let RevocationStatus::Revoked(_) = uidb.revoked() { None } else { Some(uidb) } - // Ignore userids not "alive". - }).filter_map(|uidb| { - if uidb.binding_signature(&p, None)? - .signature_alive(None, None).is_ok() - { - Some(uidb) - } else { - None - } // Ignore userids with non-printable characters. }).filter_map(|uidb| { let value = str::from_utf8(uidb.userid().value()).ok()?; |