diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-01-31 14:20:53 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-01-31 15:59:16 +0100 |
commit | a464ce819ccd1fa07ff8c6d0be74cff5eec5cf34 (patch) | |
tree | 31ed9d18b9c7802a93b4e4c8e6e85d1121b201d8 /openpgp/src/serialize/cert_armored.rs | |
parent | b9b6533bd5394cd5cdb6b91b5c5ca7a02e3ea199 (diff) |
openpgp: Add a policy object.
- Change all functions that need to evaluate the validity of a
signature (either directly or indirectly to take a policy object.
- Use the policy object to allow the user to place additional
constraints on a signature's validity.
- This addresses the first half of #274 (it introduces the policy
object, but does not yet implement any policy).
Diffstat (limited to 'openpgp/src/serialize/cert_armored.rs')
-rw-r--r-- | openpgp/src/serialize/cert_armored.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/openpgp/src/serialize/cert_armored.rs b/openpgp/src/serialize/cert_armored.rs index 40c05464..fd312725 100644 --- a/openpgp/src/serialize/cert_armored.rs +++ b/openpgp/src/serialize/cert_armored.rs @@ -9,6 +9,7 @@ use crate::serialize::{ Serialize, SerializeInto, generic_serialize_into, generic_export_into, }; use crate::Cert; +use crate::policy::StandardPolicy as P; /// Whether or not a character is printable. @@ -23,23 +24,25 @@ impl Cert { /// Creates descriptive armor headers. /// /// Returns armor headers that describe this Cert. The Cert's - /// primary fingerprint and userids are included as comments, so - /// that it is easier to identify the Cert when looking at the - /// armored data. + /// primary fingerprint and valid userids (according to the + /// 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 length_value = armor::LINE_LENGTH - "Comment: ".len(); // Create a header per userid. let mut headers: Vec<String> = self.userids().bindings() // Ignore revoked userids. .filter_map(|uidb| { - if let RevocationStatus::Revoked(_) = uidb.revoked(None) { + if let RevocationStatus::Revoked(_) = uidb.revoked(&p, None) { None } else { Some(uidb) } // Ignore userids not "alive". }).filter_map(|uidb| { - if uidb.binding_signature(None)? + if uidb.binding_signature(&p, None)? .signature_alive(None, None).is_ok() { Some(uidb) |