From d183e12a3231e4c505f5f2cf48b6c1f881ad258a Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Thu, 6 Feb 2020 14:15:10 +0100 Subject: openpgp: Rename ComponentBinding to ComponentBundle, etc. - Likewise KeyBinding, UserIDBinding, UserAttributeBinding, UnknownBinding, etc. - Reason: a self-signature on a component is a binding, but revocations and TPSes are not bindings. - Consistently call collections of components and associated signatures bundles now. Likewise for fields, methods. - Fixes #425. --- openpgp/examples/web-of-trust.rs | 2 +- openpgp/src/autocrypt.rs | 2 +- openpgp/src/cert/amalgamation.rs | 26 +++--- openpgp/src/cert/bindings.rs | 4 +- openpgp/src/cert/builder.rs | 2 +- openpgp/src/cert/component_iter.rs | 18 ++-- openpgp/src/cert/components.rs | 64 +++++++------- openpgp/src/cert/key_amalgamation.rs | 100 +++++++++++----------- openpgp/src/cert/keyiter.rs | 56 ++++++------ openpgp/src/cert/mod.rs | 98 ++++++++++----------- openpgp/src/cert/parser/low_level/grammar.lalrpop | 38 ++++---- openpgp/src/cert/parser/low_level/lexer.rs | 16 ++-- openpgp/src/cert/parser/mod.rs | 6 +- openpgp/src/crypto/hash.rs | 4 +- openpgp/src/packet/key/mod.rs | 4 +- openpgp/src/packet/signature/mod.rs | 2 +- openpgp/src/serialize/cert.rs | 24 +++--- openpgp/src/serialize/cert_armored.rs | 2 +- 18 files changed, 234 insertions(+), 234 deletions(-) (limited to 'openpgp') diff --git a/openpgp/examples/web-of-trust.rs b/openpgp/examples/web-of-trust.rs index 71ddbc4f..123d4a53 100644 --- a/openpgp/examples/web-of-trust.rs +++ b/openpgp/examples/web-of-trust.rs @@ -38,7 +38,7 @@ fn main() { match cert { Ok(cert) => { let keyid = cert.keyid(); - for uidb in cert.userids().bindings() { + for uidb in cert.userids().bundles() { for tps in uidb.certifications() { for issuer in tps.get_issuers() { println!("{}, {:?}, {}", diff --git a/openpgp/src/autocrypt.rs b/openpgp/src/autocrypt.rs index c99ee4e1..22dfa40d 100644 --- a/openpgp/src/autocrypt.rs +++ b/openpgp/src/autocrypt.rs @@ -109,7 +109,7 @@ impl AutocryptHeader { let mut acc = Vec::new(); // The primary key and the most recent selfsig. - let primary = cert.primary_key().binding(); + let primary = cert.primary_key().bundle(); acc.push(primary.key().clone().mark_role_primary().into()); primary.self_signatures().iter().take(1) .for_each(|s| acc.push(s.clone().into())); diff --git a/openpgp/src/cert/amalgamation.rs b/openpgp/src/cert/amalgamation.rs index cd9b2079..10ee8d5b 100644 --- a/openpgp/src/cert/amalgamation.rs +++ b/openpgp/src/cert/amalgamation.rs @@ -3,7 +3,7 @@ use std::time::SystemTime; use crate::{ Cert, - cert::components::ComponentBinding, + cert::components::ComponentBundle, Error, packet::Signature, Result, @@ -15,24 +15,24 @@ use crate::{ #[derive(Debug, Clone)] pub struct ComponentAmalgamation<'a, C>{ cert: &'a Cert, - binding: &'a ComponentBinding, + bundle: &'a ComponentBundle, } impl<'a, C> std::ops::Deref for ComponentAmalgamation<'a, C> { type Target = C; fn deref(&self) -> &Self::Target { - self.binding.component() + self.bundle.component() } } impl<'a, C> ComponentAmalgamation<'a, C> { /// Creates a new amalgamation. - pub(crate) fn new(cert: &'a Cert, binding: &'a ComponentBinding) -> Self + pub(crate) fn new(cert: &'a Cert, bundle: &'a ComponentBundle) -> Self { Self { cert, - binding, + bundle, } } @@ -41,9 +41,9 @@ impl<'a, C> ComponentAmalgamation<'a, C> { self.cert } - /// Returns this component's component binding. - pub fn binding(&self) -> &'a ComponentBinding { - &self.binding + /// Returns this component's bundle. + pub fn bundle(&self) -> &'a ComponentBundle { + &self.bundle } /// Returns the components's binding signature as of the reference @@ -56,7 +56,7 @@ impl<'a, C> ComponentAmalgamation<'a, C> { where T: Into> { let time = time.into().unwrap_or_else(SystemTime::now); - self.binding.binding_signature(policy, time) + self.bundle.binding_signature(policy, time) } /// Sets the reference time for the amalgamation. @@ -86,14 +86,14 @@ impl<'a, C> ComponentAmalgamation<'a, C> { impl<'a> ComponentAmalgamation<'a, crate::packet::UserID> { /// Returns a reference to the User ID. pub fn userid(&self) -> &crate::packet::UserID { - self.binding().userid() + self.bundle().userid() } } impl<'a> ComponentAmalgamation<'a, crate::packet::UserAttribute> { /// Returns a reference to the User Attribute. pub fn user_attribute(&self) -> &crate::packet::UserAttribute { - self.binding().user_attribute() + self.bundle().user_attribute() } } @@ -134,7 +134,7 @@ impl<'a, C> ValidComponentAmalgamation<'a, C> /// If there is more than one, than one is selected in a /// deterministic, but undefined manner. pub(super) fn primary(cert: &'a Cert, - iter: std::slice::Iter<'a, ComponentBinding>, + iter: std::slice::Iter<'a, ComponentBundle>, policy: &'a dyn Policy, t: SystemTime) -> Option> { @@ -298,7 +298,7 @@ impl<'a, C> Amalgamation<'a> for ValidComponentAmalgamation<'a, C> { /// /// Note: this does not return whether the certificate is valid. fn revoked(&self) -> RevocationStatus<'a> { - self.binding._revoked(self.policy(), self.time, + self.bundle._revoked(self.policy(), self.time, false, Some(self.binding_signature)) } } diff --git a/openpgp/src/cert/bindings.rs b/openpgp/src/cert/bindings.rs index 83d319a2..40a326d8 100644 --- a/openpgp/src/cert/bindings.rs +++ b/openpgp/src/cert/bindings.rs @@ -173,7 +173,7 @@ impl UserID { /// let bob = bob.merge_packets(vec![certificate.into()])?; /// /// // Check that we have a certification on the userid. - /// assert_eq!(bob.userids().bindings().nth(0).unwrap() + /// assert_eq!(bob.userids().bundles().nth(0).unwrap() /// .certifications().len(), 1); /// # Ok(()) } pub fn certify(&self, signer: &mut dyn Signer, cert: &Cert, @@ -315,7 +315,7 @@ impl UserAttribute { /// let bob = bob.merge_packets(vec![certificate.into()])?; /// /// // Check that we have a certification on the userid. - /// assert_eq!(bob.user_attributes().bindings().nth(0).unwrap() + /// assert_eq!(bob.user_attributes().bundles().nth(0).unwrap() /// .certifications().len(), /// 1); /// # Ok(()) } diff --git a/openpgp/src/cert/builder.rs b/openpgp/src/cert/builder.rs index f950b484..c09d90ae 100644 --- a/openpgp/src/cert/builder.rs +++ b/openpgp/src/cert/builder.rs @@ -668,7 +668,7 @@ mod tests { let now = cert.primary_key().creation_time() + 5 * s; // The subkeys may be created a tad later. let key = cert.primary_key().key(); - let sig = &cert.primary_key().binding().self_signatures()[0]; + let sig = &cert.primary_key().bundle().self_signatures()[0]; assert!(sig.key_alive(key, now).is_ok()); assert!(sig.key_alive(key, now + 590 * s).is_ok()); assert!(! sig.key_alive(key, now + 610 * s).is_ok()); diff --git a/openpgp/src/cert/component_iter.rs b/openpgp/src/cert/component_iter.rs index 9cd9cada..879c673c 100644 --- a/openpgp/src/cert/component_iter.rs +++ b/openpgp/src/cert/component_iter.rs @@ -6,8 +6,8 @@ use crate::{ cert::{ Cert, components::{ - ComponentBinding, - ComponentBindingIter, + ComponentBundle, + ComponentBundleIter, Amalgamation, ComponentAmalgamation, ValidComponentAmalgamation, @@ -25,7 +25,7 @@ use crate::{ /// By default, `ComponentIter` returns all components without context. pub struct ComponentIter<'a, C> { cert: &'a Cert, - iter: ComponentBindingIter<'a, C>, + iter: ComponentBundleIter<'a, C>, } impl<'a, C> fmt::Debug for ComponentIter<'a, C> { @@ -46,11 +46,11 @@ impl<'a, C> Iterator for ComponentIter<'a, C> { impl<'a, C> ComponentIter<'a, C> { /// Returns a new `ComponentIter` instance. pub(crate) fn new(cert: &'a Cert, - iter: std::slice::Iter<'a, ComponentBinding>) -> Self + iter: std::slice::Iter<'a, ComponentBundle>) -> Self where Self: 'a { ComponentIter { - cert, iter: ComponentBindingIter { iter: Some(iter), }, + cert, iter: ComponentBundleIter { iter: Some(iter), }, } } @@ -78,7 +78,7 @@ impl<'a, C> ComponentIter<'a, C> { /// A component binding is similar to a component amalgamation, /// but is not bound to a specific time. It contains the /// component and all relevant signatures. - pub fn bindings(self) -> ComponentBindingIter<'a, C> { + pub fn bundles(self) -> ComponentBundleIter<'a, C> { self.iter } } @@ -94,7 +94,7 @@ impl<'a, C> ComponentIter<'a, C> { pub struct ValidComponentIter<'a, C> { // This is an option to make it easier to create an empty ValidComponentIter. cert: &'a Cert, - iter: ComponentBindingIter<'a, C>, + iter: ComponentBundleIter<'a, C>, policy: &'a dyn Policy, // The time. @@ -125,7 +125,7 @@ impl<'a, C> Iterator for ValidComponentIter<'a, C> loop { let ca = ComponentAmalgamation::new(self.cert, self.iter.next()?); - t!("Considering component: {:?}", ca.binding()); + t!("Considering component: {:?}", ca.bundle()); let vca = if let Ok(vca) = ca.set_policy(self.policy, self.time) { @@ -214,7 +214,7 @@ impl<'a, C> ValidComponentIter<'a, C> { /// true, /// } /// }) - /// .map(|ca| ca.binding()) + /// .map(|ca| ca.bundle()) /// .collect::>(); /// # Ok(()) /// # } diff --git a/openpgp/src/cert/components.rs b/openpgp/src/cert/components.rs index 5258c493..1074899c 100644 --- a/openpgp/src/cert/components.rs +++ b/openpgp/src/cert/components.rs @@ -31,14 +31,14 @@ pub use super::amalgamation::{ /// A key (primary or subkey, public or private) and any associated /// signatures. -pub type KeyBinding = ComponentBinding>; +pub type KeyBundle = ComponentBundle>; -impl KeyBinding +impl KeyBundle { /// Gets the key packet's `SecretKeyMaterial`. /// /// Note: The key module installs conversion functions on - /// KeyBinding. They need to access the key's secret. + /// KeyBundle. They need to access the key's secret. pub(crate) fn secret(&self) -> Option<&crate::packet::key::SecretKeyMaterial> { self.key().secret() @@ -46,28 +46,28 @@ impl KeyBinding } /// A primary key and any associated signatures. -pub(crate) type PrimaryKeyBinding = - KeyBinding; +pub(crate) type PrimaryKeyBundle = + KeyBundle; /// A subkey and any associated signatures. -pub type SubkeyBinding = KeyBinding; +pub type SubkeyBundle = KeyBundle; /// A key (primary or subkey, public or private) and any associated /// signatures. #[allow(dead_code)] type GenericKeyBinding - = ComponentBinding>; + = ComponentBundle>; /// A User ID and any associated signatures. -pub type UserIDBinding = ComponentBinding; +pub type UserIDBundle = ComponentBundle; /// A User Attribute and any associated signatures. -pub type UserAttributeBinding = ComponentBinding; +pub type UserAttributeBundle = ComponentBundle; /// An unknown component and any associated signatures. /// /// Note: all signatures are stored as certifications. -pub type UnknownBinding = ComponentBinding; +pub type UnknownBundle = ComponentBundle; /// A Cert component binding. /// @@ -75,7 +75,7 @@ pub type UnknownBinding = ComponentBinding; /// attribute. A binding is a Cert component and any related /// signatures. #[derive(Debug, Clone, PartialEq)] -pub struct ComponentBinding { +pub struct ComponentBundle { pub(crate) component: C, // Self signatures. @@ -92,7 +92,7 @@ pub struct ComponentBinding { pub(crate) other_revocations: Vec, } -impl ComponentBinding { +impl ComponentBundle { /// Returns a reference to the component. pub fn component(&self) -> &C { &self.component @@ -232,7 +232,7 @@ impl ComponentBinding { = selfsig.and_then(|s| s.signature_creation_time()) .unwrap_or_else(time_zero); - tracer!(super::TRACE, "ComponentBinding::_revoked", 0); + tracer!(super::TRACE, "ComponentBundle::_revoked", 0); t!("hard_revocations_are_final: {}, selfsig: {:?}, t: {:?}", hard_revocations_are_final, selfsig_creation_time, @@ -360,7 +360,7 @@ impl ComponentBinding { } } -impl ComponentBinding> { +impl ComponentBundle> { /// Returns a reference to the key. pub fn key(&self) -> &Key { self.component() @@ -372,7 +372,7 @@ impl ComponentBinding> { } } -impl ComponentBinding> { +impl ComponentBundle> { /// Returns the subkey's revocation status at time `t`. /// /// A subkey is revoked at time `t` if: @@ -397,7 +397,7 @@ impl ComponentBinding> { } } -impl ComponentBinding { +impl ComponentBundle { /// Returns a reference to the User ID. pub fn userid(&self) -> &UserID { self.component() @@ -424,7 +424,7 @@ impl ComponentBinding { } } -impl ComponentBinding { +impl ComponentBundle { /// Returns a reference to the User Attribute. pub fn user_attribute(&self) -> &UserAttribute { self.component() @@ -451,30 +451,30 @@ impl ComponentBinding { } } -impl ComponentBinding { +impl ComponentBundle { /// Returns a reference to the unknown component. pub fn unknown(&self) -> &Unknown { self.component() } } -/// An iterator over `ComponentBinding`s. -pub struct ComponentBindingIter<'a, C> { - pub(crate) iter: Option>>, +/// An iterator over `ComponentBundle`s. +pub struct ComponentBundleIter<'a, C> { + pub(crate) iter: Option>>, } -/// An iterator over `KeyBinding`s. -pub type KeyBindingIter<'a, P, R> = ComponentBindingIter<'a, Key>; -/// An iterator over `UserIDBinding`s. -pub type UserIDBindingIter<'a> = ComponentBindingIter<'a, UserID>; -/// An iterator over `UserAttributeBinding`s. -pub type UserAttributeBindingIter<'a> = ComponentBindingIter<'a, UserAttribute>; -/// An iterator over `UnknownBinding`s. -pub type UnknownBindingIter<'a> = ComponentBindingIter<'a, Unknown>; +/// An iterator over `KeyBundle`s. +pub type UnfilteredKeyBundleIter<'a, P, R> = ComponentBundleIter<'a, Key>; +/// An iterator over `UserIDBundle`s. +pub type UserIDBundleIter<'a> = ComponentBundleIter<'a, UserID>; +/// An iterator over `UserAttributeBundle`s. +pub type UserAttributeBundleIter<'a> = ComponentBundleIter<'a, UserAttribute>; +/// An iterator over `UnknownBundle`s. +pub type UnknownBundleIter<'a> = ComponentBundleIter<'a, Unknown>; -impl<'a, C> Iterator for ComponentBindingIter<'a, C> +impl<'a, C> Iterator for ComponentBundleIter<'a, C> { - type Item = &'a ComponentBinding; + type Item = &'a ComponentBundle; fn next(&mut self) -> Option { match self.iter { @@ -484,7 +484,7 @@ impl<'a, C> Iterator for ComponentBindingIter<'a, C> } } -impl<'a, C> ExactSizeIterator for ComponentBindingIter<'a, C> +impl<'a, C> ExactSizeIterator for ComponentBundleIter<'a, C> { fn len(&self) -> usize { match self.iter { diff --git a/openpgp/src/cert/key_amalgamation.rs b/openpgp/src/cert/key_amalgamation.rs index c9b7b4ed..1d736c1e 100644 --- a/openpgp/src/cert/key_amalgamation.rs +++ b/openpgp/src/cert/key_amalgamation.rs @@ -9,7 +9,7 @@ use crate::{ Cert, cert::components::{ Amalgamation, - KeyBinding, + KeyBundle, }, Error, packet::key, @@ -28,16 +28,16 @@ use crate::{ /// must also all be public, and we don't want that here. Wrapping /// this in a struct means that we can hide that. #[derive(Debug, Clone)] -enum KeyAmalgamationBinding<'a, P: key::KeyParts> { +enum KeyAmalgamationBundle<'a, P: key::KeyParts> { Primary(), - Subordinate(&'a KeyBinding), + Subordinate(&'a KeyBundle), } /// A `Key` and its associated data. #[derive(Debug, Clone)] pub struct KeyAmalgamation<'a, P: key::KeyParts> { cert: &'a Cert, - binding: KeyAmalgamationBinding<'a, P>, + bundle: KeyAmalgamationBundle<'a, P>, } impl<'a, P: key::KeyParts> Deref for KeyAmalgamation<'a, P> @@ -59,19 +59,19 @@ impl<'a> From> match ka { KeyAmalgamation { cert, - binding: KeyAmalgamationBinding::Primary(), + bundle: KeyAmalgamationBundle::Primary(), } => KeyAmalgamation { cert, - binding: KeyAmalgamationBinding::Primary(), + bundle: KeyAmalgamationBundle::Primary(), }, KeyAmalgamation { cert, - binding: KeyAmalgamationBinding::Subordinate(binding), + bundle: KeyAmalgamationBundle::Subordinate(bundle), } => KeyAmalgamation { cert, - binding: KeyAmalgamationBinding::Subordinate(binding.into()), + bundle: KeyAmalgamationBundle::Subordinate(bundle.into()), }, } } @@ -84,19 +84,19 @@ impl<'a> From> match ka { KeyAmalgamation { cert, - binding: KeyAmalgamationBinding::Primary(), + bundle: KeyAmalgamationBundle::Primary(), } => KeyAmalgamation { cert, - binding: KeyAmalgamationBinding::Primary(), + bundle: KeyAmalgamationBundle::Primary(), }, KeyAmalgamation { cert, - binding: KeyAmalgamationBinding::Subordinate(binding), + bundle: KeyAmalgamationBundle::Subordinate(bundle), } => KeyAmalgamation { cert, - binding: KeyAmalgamationBinding::Subordinate(binding.into()), + bundle: KeyAmalgamationBundle::Subordinate(bundle.into()), }, } } @@ -111,24 +111,24 @@ impl<'a> TryFrom> Ok(match ka { KeyAmalgamation { cert, - binding: KeyAmalgamationBinding::Primary(), + bundle: KeyAmalgamationBundle::Primary(), } => { // Error out if the primary key does not have secret // key material. - let _ : &KeyBinding + let _ : &KeyBundle = (&cert.primary).try_into()?; KeyAmalgamation { cert, - binding: KeyAmalgamationBinding::Primary(), + bundle: KeyAmalgamationBundle::Primary(), } } KeyAmalgamation { cert, - binding: KeyAmalgamationBinding::Subordinate(binding), + bundle: KeyAmalgamationBundle::Subordinate(bundle), } => KeyAmalgamation { cert, - binding: KeyAmalgamationBinding::Subordinate(binding.try_into()?), + bundle: KeyAmalgamationBundle::Subordinate(bundle.try_into()?), }, }) } @@ -138,17 +138,17 @@ impl<'a, P: 'a + key::KeyParts> KeyAmalgamation<'a, P> { pub(crate) fn new_primary(cert: &'a Cert) -> Self { KeyAmalgamation { cert: cert, - binding: KeyAmalgamationBinding::Primary(), + bundle: KeyAmalgamationBundle::Primary(), } } pub(crate) fn new_subordinate( - cert: &'a Cert, binding: &'a KeyBinding) + cert: &'a Cert, bundle: &'a KeyBundle) -> Self { KeyAmalgamation { cert: cert, - binding: KeyAmalgamationBinding::Subordinate(binding), + bundle: KeyAmalgamationBundle::Subordinate(bundle), } } @@ -157,10 +157,10 @@ impl<'a, P: 'a + key::KeyParts> KeyAmalgamation<'a, P> { where &'a Key: From<&'a key::PublicKey> { match self { - KeyAmalgamation { binding: KeyAmalgamationBinding::Primary(), .. } => + KeyAmalgamation { bundle: KeyAmalgamationBundle::Primary(), .. } => self.cert.primary.key().into(), - KeyAmalgamation { binding: KeyAmalgamationBinding::Subordinate(ref binding), .. } => - binding.key().into(), + KeyAmalgamation { bundle: KeyAmalgamationBundle::Subordinate(bundle), .. } => + bundle.key().into(), } } @@ -168,10 +168,10 @@ impl<'a, P: 'a + key::KeyParts> KeyAmalgamation<'a, P> { fn generic_key(&self) -> &'a Key { match self { - KeyAmalgamation { binding: KeyAmalgamationBinding::Primary(), .. } => + KeyAmalgamation { bundle: KeyAmalgamationBundle::Primary(), .. } => self.cert.primary.key().into(), - KeyAmalgamation { binding: KeyAmalgamationBinding::Subordinate(ref binding), .. } => - binding.key().mark_parts_unspecified_ref().into(), + KeyAmalgamation { bundle: KeyAmalgamationBundle::Subordinate(bundle), .. } => + bundle.key().mark_parts_unspecified_ref().into(), } } @@ -202,16 +202,16 @@ impl<'a, P: 'a + key::KeyParts> KeyAmalgamation<'a, P> { } } - /// Returns this key's binding. - pub fn binding(&self) -> &'a KeyBinding - where &'a KeyBinding: - From<&'a KeyBinding> + /// Returns this key's bundle. + pub fn bundle(&self) -> &'a KeyBundle + where &'a KeyBundle: + From<&'a KeyBundle> { match self { - KeyAmalgamation { binding: KeyAmalgamationBinding::Primary(), .. } => + KeyAmalgamation { bundle: KeyAmalgamationBundle::Primary(), .. } => (&self.cert.primary).into(), - KeyAmalgamation { binding: KeyAmalgamationBinding::Subordinate(binding), .. } => - (*binding).into(), + KeyAmalgamation { bundle: KeyAmalgamationBundle::Subordinate(bundle), .. } => + (*bundle).into(), } } @@ -227,19 +227,19 @@ impl<'a, P: 'a + key::KeyParts> KeyAmalgamation<'a, P> { let time = time.into().unwrap_or_else(SystemTime::now); match self { KeyAmalgamation { - binding: KeyAmalgamationBinding::Primary(), + bundle: KeyAmalgamationBundle::Primary(), .. } => { self.cert.primary_userid(policy, time) .map(|u| u.binding_signature()) - .or_else(|| self.cert.primary_key().binding() + .or_else(|| self.cert.primary_key().bundle() .binding_signature(policy, time)) }, KeyAmalgamation { - binding: KeyAmalgamationBinding::Subordinate(ref binding), + bundle: KeyAmalgamationBundle::Subordinate(bundle), .. } => - binding.binding_signature(policy, time), + bundle.binding_signature(policy, time), } } @@ -307,7 +307,7 @@ impl<'a, P: key::KeyParts> PrimaryKeyAmalgamation<'a, P> { pub(super) fn new(a: KeyAmalgamation<'a, P>) -> Self { assert_match!( &KeyAmalgamation { - binding: KeyAmalgamationBinding::Primary(), + bundle: KeyAmalgamationBundle::Primary(), .. } = &a); @@ -472,37 +472,37 @@ impl<'a, P: 'a + key::KeyParts> Amalgamation<'a> for ValidKeyAmalgamation<'a, P> /// revoked, it does not return whether the certificate has been /// revoked. fn revoked(&self) -> RevocationStatus<'a> { - match self.a.binding { - KeyAmalgamationBinding::Primary() => + match self.a.bundle { + KeyAmalgamationBundle::Primary() => self.cert.revoked(self.policy, self.time()), - KeyAmalgamationBinding::Subordinate(ref binding) => - binding.revoked(self.policy, self.time()), + KeyAmalgamationBundle::Subordinate(bundle) => + bundle.revoked(self.policy, self.time()), } } } impl<'a, P: 'a + key::KeyParts> ValidKeyAmalgamation<'a, P> { - /// Returns this key's binding. - pub fn binding(&self) -> &'a KeyBinding - where &'a KeyBinding: - From<&'a KeyBinding> + /// Returns this key's bundle. + pub fn bundle(&self) -> &'a KeyBundle + where &'a KeyBundle: + From<&'a KeyBundle> { match self { ValidKeyAmalgamation { a: KeyAmalgamation { - binding: KeyAmalgamationBinding::Primary(), .. + bundle: KeyAmalgamationBundle::Primary(), .. }, .. } => (&self.cert.primary).into(), ValidKeyAmalgamation { a: KeyAmalgamation { - binding: KeyAmalgamationBinding::Subordinate(binding), + bundle: KeyAmalgamationBundle::Subordinate(bundle), .. }, .. } => - (*binding).into(), + (*bundle).into(), } } @@ -690,7 +690,7 @@ impl<'a, P: key::KeyParts> ValidPrimaryKeyAmalgamation<'a, P> { assert_match!( &ValidKeyAmalgamation { a: KeyAmalgamation { - binding: KeyAmalgamationBinding::Primary(), + bundle: KeyAmalgamationBundle::Primary(), .. }, .. diff --git a/openpgp/src/cert/keyiter.rs b/openpgp/src/cert/keyiter.rs index 7fb5c455..e1bd03c6 100644 --- a/openpgp/src/cert/keyiter.rs +++ b/openpgp/src/cert/keyiter.rs @@ -13,8 +13,8 @@ use crate::{ Cert, components::{ Amalgamation, - KeyBinding, - KeyBindingIter, + KeyBundle, + UnfilteredKeyBundleIter, }, KeyAmalgamation, ValidKeyAmalgamation, @@ -41,7 +41,7 @@ pub struct KeyIter<'a, P: key::KeyParts> { // This is an option to make it easier to create an empty KeyIter. cert: Option<&'a Cert>, primary: bool, - subkey_iter: KeyBindingIter<'a, + subkey_iter: UnfilteredKeyBundleIter<'a, key::PublicParts, key::SubordinateRole>, @@ -405,16 +405,16 @@ impl<'a, P: 'a + key::KeyParts> KeyIter<'a, P> } } - /// Changes the iterator to return key components. + /// Changes the iterator to return key bundles. /// - /// A key component is similar to a key amalgamation, but is not + /// A key bundle is similar to a key amalgamation, but is not /// bound to a specific time. It contains the key and all /// relevant signatures. /// /// If the primary key satisfies the current filter on this /// iterator, it is returned first. - pub fn components(self) -> KeyComponentIter<'a, P, key::UnspecifiedRole> { - KeyComponentIter { + pub fn bundles(self) -> KeyBundleIter<'a, P, key::UnspecifiedRole> { + KeyBundleIter { cert: self.cert, primary: self.primary, subkey_iter: self.subkey_iter, @@ -429,15 +429,15 @@ impl<'a, P: 'a + key::KeyParts> KeyIter<'a, P> } } - /// Changes the iterator to return subkey components. + /// Changes the iterator to return subkey bundles. /// - /// A key component is similar to a key amalgamation, but is not + /// A key bundle is similar to a key amalgamation, but is not /// bound to a specific time. It contains the key and all /// relevant signatures. /// /// The primary key is never returned from this iterator. - pub fn subkeys(self) -> KeyComponentIter<'a, P, key::SubordinateRole> { - KeyComponentIter { + pub fn subkeys(self) -> KeyBundleIter<'a, P, key::SubordinateRole> { + KeyBundleIter { cert: self.cert, primary: true, subkey_iter: self.subkey_iter, @@ -468,7 +468,7 @@ pub struct ValidKeyIter<'a, P: key::KeyParts> { // This is an option to make it easier to create an empty ValidKeyIter. cert: Option<&'a Cert>, primary: bool, - subkey_iter: KeyBindingIter<'a, + subkey_iter: UnfilteredKeyBundleIter<'a, key::PublicParts, key::SubordinateRole>, @@ -887,11 +887,11 @@ impl<'a, P: 'a + key::KeyParts> ValidKeyIter<'a, P> } } -pub struct KeyComponentIter<'a, P: key::KeyParts, R: key::KeyRole> { +pub struct KeyBundleIter<'a, P: key::KeyParts, R: key::KeyRole> { // This is an option to make it easier to create an empty KeyIter. cert: Option<&'a Cert>, primary: bool, - subkey_iter: KeyBindingIter<'a, + subkey_iter: UnfilteredKeyBundleIter<'a, key::PublicParts, key::SubordinateRole>, // If not None, filters by whether a key has a secret. @@ -909,10 +909,10 @@ pub struct KeyComponentIter<'a, P: key::KeyParts, R: key::KeyRole> { } impl<'a, P: key::KeyParts, R: key::KeyRole> fmt::Debug - for KeyComponentIter<'a, P, R> + for KeyBundleIter<'a, P, R> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("KeyComponentIter") + f.debug_struct("KeyBundleIter") .field("primary", &self.primary) .field("secret", &self.secret) .field("unencrypted_secret", &self.unencrypted_secret) @@ -927,11 +927,11 @@ impl<'a, P: key::KeyParts, R: key::KeyRole> fmt::Debug // implementation for Key below. macro_rules! impl_key_component_iterator { ($parts:path) => { - impl<'a, R: 'a + key::KeyRole> Iterator for KeyComponentIter<'a, $parts, R> - where &'a KeyBinding<$parts, R>: - From<&'a KeyBinding> + impl<'a, R: 'a + key::KeyRole> Iterator for KeyBundleIter<'a, $parts, R> + where &'a KeyBundle<$parts, R>: + From<&'a KeyBundle> { - type Item = &'a KeyBinding<$parts, R>; + type Item = &'a KeyBundle<$parts, R>; fn next(&mut self) -> Option { self.next_common().map(|b| b.into()) @@ -942,25 +942,25 @@ macro_rules! impl_key_component_iterator { impl_key_component_iterator!(key::PublicParts); impl_key_component_iterator!(key::UnspecifiedParts); -impl<'a, R: 'a + key::KeyRole, E> Iterator for KeyComponentIter<'a, key::SecretParts, R> - where &'a KeyBinding: - TryFrom<&'a KeyBinding, +impl<'a, R: 'a + key::KeyRole, E> Iterator for KeyBundleIter<'a, key::SecretParts, R> + where &'a KeyBundle: + TryFrom<&'a KeyBundle, Error = E>, E: std::fmt::Debug, { - type Item = &'a KeyBinding; + type Item = &'a KeyBundle; fn next(&mut self) -> Option { self.next_common().map(|ka| ka.try_into().expect("has secret parts")) } } -impl<'a, P: 'a + key::KeyParts, R: 'a + key::KeyRole> KeyComponentIter<'a, P, R> +impl<'a, P: 'a + key::KeyParts, R: 'a + key::KeyRole> KeyBundleIter<'a, P, R> { - fn next_common(&mut self) -> Option<&'a KeyBinding> + fn next_common(&mut self) -> Option<&'a KeyBundle> { - tracer!(false, "KeyComponentIter::next", 0); - t!("KeyComponentIter: {:?}", self); + tracer!(false, "KeyBundleIter::next", 0); + t!("KeyBundleIter: {:?}", self); if self.cert.is_none() { return None; diff --git a/openpgp/src/cert/mod.rs b/openpgp/src/cert/mod.rs index 852cf3c2..0dc4fde6 100644 --- a/openpgp/src/cert/mod.rs +++ b/openpgp/src/cert/mod.rs @@ -44,10 +44,10 @@ mod bindings; pub mod components; use components::{ Amalgamation, - ComponentBinding, - PrimaryKeyBinding, - KeyBindingIter, - UnknownBindingIter, + ComponentBundle, + PrimaryKeyBundle, + UnfilteredKeyBundleIter, + UnknownBundleIter, ValidComponentAmalgamation, }; mod component_iter; @@ -114,46 +114,46 @@ impl fmt::Display for Cert { } } -/// A collection of `ComponentBindings`. +/// A collection of `ComponentBundles`. /// -/// Note: we need this, because we can't `impl Vec`. +/// Note: we need this, because we can't `impl Vec`. #[derive(Debug, Clone, PartialEq)] -struct ComponentBindings - where ComponentBinding: cmp::PartialEq +struct ComponentBundles + where ComponentBundle: cmp::PartialEq { - bindings: Vec>, + bindings: Vec>, } -impl Deref for ComponentBindings - where ComponentBinding: cmp::PartialEq +impl Deref for ComponentBundles + where ComponentBundle: cmp::PartialEq { - type Target = Vec>; + type Target = Vec>; fn deref(&self) -> &Self::Target { &self.bindings } } -impl DerefMut for ComponentBindings - where ComponentBinding: cmp::PartialEq +impl DerefMut for ComponentBundles + where ComponentBundle: cmp::PartialEq { - fn deref_mut(&mut self) -> &mut Vec> { + fn deref_mut(&mut self) -> &mut Vec> { &mut self.bindings } } -impl Into>> for ComponentBindings - where ComponentBinding: cmp::PartialEq +impl Into>> for ComponentBundles + where ComponentBundle: cmp::PartialEq { - fn into(self) -> Vec> { + fn into(self) -> Vec> { self.bindings } } -impl IntoIterator for ComponentBindings - where ComponentBinding: cmp::PartialEq +impl IntoIterator for ComponentBundles + where ComponentBundle: cmp::PartialEq { - type Item = ComponentBinding; + type Item = ComponentBundle; type IntoIter = std::vec::IntoIter; fn into_iter(self) -> Self::IntoIter { @@ -161,16 +161,16 @@ impl IntoIterator for ComponentBindings } } -impl ComponentBindings - where ComponentBinding: cmp::PartialEq +impl ComponentBundles + where ComponentBundle: cmp::PartialEq { fn new() -> Self { Self { bindings: vec![] } } } -impl ComponentBindings - where ComponentBinding: cmp::PartialEq +impl ComponentBundles + where ComponentBundle: cmp::PartialEq { // Sort and dedup the components. // @@ -214,27 +214,27 @@ impl ComponentBindings /// A vecor of key (primary or subkey, public or private) and any /// associated signatures. -type KeyBindings = ComponentBindings>; +type KeyBundles = ComponentBundles>; /// A vector of subkeys and any associated signatures. -type SubkeyBindings = KeyBindings; +type SubkeyBindings = KeyBundles; /// A vector of key (primary or subkey, public or private) and any /// associated signatures. #[allow(dead_code)] type GenericKeyBindings - = ComponentBindings>; + = ComponentBundles>; /// A vector of User ID bindings and any associated signatures. -type UserIDBindings = ComponentBindings; +type UserIDBindings = ComponentBundles; /// A vector of User Attribute bindings and any associated signatures. -type UserAttributeBindings = ComponentBindings; +type UserAttributeBindings = ComponentBundles; /// A vector of unknown components and any associated signatures. /// /// Note: all signatures are stored as certifications. -type UnknownBindings = ComponentBindings; +type UnknownBindings = ComponentBundles; // DOC-HACK: To avoid having a top-level re-export of `Cert`, we move @@ -292,7 +292,7 @@ use super::*; /// let mut acc = Vec::new(); /// /// // Primary key and related signatures. -/// let c = cert.primary_key().binding(); +/// let c = cert.primary_key().bundle(); /// acc.push(c.key().clone().mark_role_primary().into()); /// for s in c.self_signatures() { acc.push(s.clone().into()) } /// for s in c.certifications() { acc.push(s.clone().into()) } @@ -300,7 +300,7 @@ use super::*; /// for s in c.other_revocations() { acc.push(s.clone().into()) } /// /// // UserIDs and related signatures. -/// for c in cert.userids().bindings() { +/// for c in cert.userids().bundles() { /// acc.push(c.userid().clone().into()); /// for s in c.self_signatures() { acc.push(s.clone().into()) } /// for s in c.certifications() { acc.push(s.clone().into()) } @@ -309,7 +309,7 @@ use super::*; /// } /// /// // UserAttributes and related signatures. -/// for c in cert.user_attributes().bindings() { +/// for c in cert.user_attributes().bundles() { /// acc.push(c.user_attribute().clone().into()); /// for s in c.self_signatures() { acc.push(s.clone().into()) } /// for s in c.certifications() { acc.push(s.clone().into()) } @@ -364,7 +364,7 @@ use super::*; /// match Cert::from_packet_parser(ppr) { /// Ok(cert) => { /// println!("Key: {}", cert.fingerprint()); -/// for binding in cert.userids().bindings() { +/// for binding in cert.userids().bundles() { /// println!("User ID: {}", binding.userid()); /// } /// } @@ -379,7 +379,7 @@ use super::*; #[derive(Debug, Clone, PartialEq)] pub struct Cert { pub(super) // doc-hack, see above - primary: PrimaryKeyBinding, + primary: PrimaryKeyBundle, pub(super) // doc-hack, see above userids: UserIDBindings, @@ -467,7 +467,7 @@ impl Cert { _ => () } } - self.primary_key().binding()._revoked(policy, t, true, sig) + self.primary_key().bundle()._revoked(policy, t, true, sig) } /// Revokes the Cert in place. @@ -637,7 +637,7 @@ impl Cert { policy, t) } - /// Returns an iterator over the Cert's valid `UserAttributeBinding`s. + /// Returns an iterator over the Cert's valid `UserAttributeBundle`s. /// /// A valid `UserIDAttributeBinding` has at least one good /// self-signature. @@ -647,18 +647,18 @@ impl Cert { /// Returns an iterator over the Cert's valid subkeys. /// - /// A valid `KeyBinding` has at least one good self-signature. - pub(crate) fn subkeys(&self) -> KeyBindingIter UnfilteredKeyBundleIter { - KeyBindingIter { iter: Some(self.subkeys.iter()) } + UnfilteredKeyBundleIter { iter: Some(self.subkeys.iter()) } } /// Returns an iterator over the Cert's valid unknown components. /// - /// A valid `UnknownBinding` has at least one good self-signature. - pub fn unknowns(&self) -> UnknownBindingIter { - UnknownBindingIter { iter: Some(self.unknowns.iter()) } + /// A valid `UnknownBundle` has at least one good self-signature. + pub fn unknowns(&self) -> UnknownBundleIter { + UnknownBundleIter { iter: Some(self.unknowns.iter()) } } /// Returns a slice containing all bad signatures. @@ -2437,7 +2437,7 @@ mod test { = cert.revoked(p, None)); assert_eq!(cert.user_attributes().count(), 1); - let ua = cert.user_attributes().bindings().nth(0).unwrap(); + let ua = cert.user_attributes().bundles().nth(0).unwrap(); if revoked { assert_match!(RevocationStatus::Revoked(_) = ua.revoked(p, t)); @@ -2666,7 +2666,7 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g= // than one signature. let mut cmps = 0; - for uid in neal.userids().bindings() { + for uid in neal.userids().bundles() { for sigs in [ uid.self_signatures(), uid.certifications(), @@ -2924,7 +2924,7 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g= cert = cert.merge_packets(vec![ binding ]).unwrap(); // A time that matches multiple signatures. let direct_signatures = - cert.primary_key().binding().self_signatures(); + cert.primary_key().bundle().self_signatures(); assert_eq!(cert.primary_key().set_policy(p, *t).unwrap() .direct_key_signature(), direct_signatures.get(*offset)); @@ -2969,7 +2969,7 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g= .generate().unwrap(); assert_eq!(bob.userids().len(), 1); - let bob_userid_binding = bob.userids().bindings().nth(0).unwrap(); + let bob_userid_binding = bob.userids().bundles().nth(0).unwrap(); assert_eq!(bob_userid_binding.userid().value(), b"bob@bar.com"); let sig_template @@ -2992,7 +2992,7 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g= // Make sure the certification is merged, and put in the right // place. assert_eq!(bob.userids().len(), 1); - let bob_userid_binding = bob.userids().bindings().nth(0).unwrap(); + let bob_userid_binding = bob.userids().bundles().nth(0).unwrap(); assert_eq!(bob_userid_binding.userid().value(), b"bob@bar.com"); // Canonicalizing Bob's cert without having Alice's key diff --git a/openpgp/src/cert/parser/low_level/grammar.lalrpop b/openpgp/src/cert/parser/low_level/grammar.lalrpop index 8f158169..d8e313e5 100644 --- a/openpgp/src/cert/parser/low_level/grammar.lalrpop +++ b/openpgp/src/cert/parser/low_level/grammar.lalrpop @@ -11,13 +11,13 @@ use crate::Cert; use crate::cert::parser::low_level::lexer; use crate::cert::parser::low_level::lexer::{Token, Component}; -use crate::cert::ComponentBindings; +use crate::cert::ComponentBundles; use crate::cert::components::{ - PrimaryKeyBinding, - SubkeyBinding, - UserIDBinding, - UserAttributeBinding, - UnknownBinding, + PrimaryKeyBundle, + SubkeyBundle, + UserIDBundle, + UserAttributeBundle, + UnknownBundle, }; use lalrpop_util::ParseError; @@ -46,29 +46,29 @@ pub Cert: Option = { let c = c.unwrap(); let mut cert = Cert { - primary: PrimaryKeyBinding { + primary: PrimaryKeyBundle { component: key, self_signatures: vec![], certifications: sigs, self_revocations: vec![], other_revocations: vec![], }, - subkeys: ComponentBindings::new(), - userids: ComponentBindings::new(), - user_attributes: ComponentBindings::new(), - unknowns: ComponentBindings::new(), + subkeys: ComponentBundles::new(), + userids: ComponentBundles::new(), + user_attributes: ComponentBundles::new(), + unknowns: ComponentBundles::new(), bad: vec![], }; for c in c.into_iter() { match c { - Component::SubkeyBinding(b) => + Component::SubkeyBundle(b) => cert.subkeys.push(b), - Component::UserIDBinding(b) => + Component::UserIDBundle(b) => cert.userids.push(b), - Component::UserAttributeBinding(b) => + Component::UserAttributeBundle(b) => cert.user_attributes.push(b), - Component::UnknownBinding(b) => + Component::UnknownBundle(b) => cert.unknowns.push(b), } } @@ -157,7 +157,7 @@ Component: Option = { Some(key) => { let sigs = sigs.unwrap(); - Some(Component::SubkeyBinding(SubkeyBinding { + Some(Component::SubkeyBundle(SubkeyBundle { component: key, self_signatures: vec![], certifications: sigs, @@ -174,7 +174,7 @@ Component: Option = { Some(u) => { let sigs = sigs.unwrap(); - Some(Component::UserIDBinding(UserIDBinding { + Some(Component::UserIDBundle(UserIDBundle { component: u, self_signatures: vec![], certifications: sigs, @@ -191,7 +191,7 @@ Component: Option = { Some(u) => { let sigs = sigs.unwrap(); - Some(Component::UserAttributeBinding(UserAttributeBinding { + Some(Component::UserAttributeBundle(UserAttributeBundle { component: u, self_signatures: vec![], certifications: sigs, @@ -208,7 +208,7 @@ Component: Option = { Some(u) => { let sigs = sigs.unwrap(); - Some(Component::UnknownBinding(UnknownBinding { + Some(Component::UnknownBundle(UnknownBundle { component: u, self_signatures: vec![], certifications: sigs, diff --git a/openpgp/src/cert/parser/low_level/lexer.rs b/openpgp/src/cert/parser/low_level/lexer.rs index df38090e..cf69f945 100644 --- a/openpgp/src/cert/parser/low_level/lexer.rs +++ b/openpgp/src/cert/parser/low_level/lexer.rs @@ -4,10 +4,10 @@ use crate::Error; use crate::Packet; use crate::packet::Tag; use crate::cert::components::{ - SubkeyBinding, - UserIDBinding, - UserAttributeBinding, - UnknownBinding, + SubkeyBundle, + UserIDBundle, + UserAttributeBundle, + UnknownBundle, }; use crate::packet::key; @@ -53,10 +53,10 @@ pub enum Token { /// public. But, since this module is not public, it will not /// actually be exported to used of the library. pub enum Component { - SubkeyBinding(SubkeyBinding), - UserIDBinding(UserIDBinding), - UserAttributeBinding(UserAttributeBinding), - UnknownBinding(UnknownBinding), + SubkeyBundle(SubkeyBundle), + UserIDBundle(UserIDBundle), + UserAttributeBundle(UserAttributeBundle), + UnknownBundle(UnknownBundle), } impl<'a> From<&'a Token> for Tag { diff --git a/openpgp/src/cert/parser/mod.rs b/openpgp/src/cert/parser/mod.rs index 2e88a06b..7552f4db 100644 --- a/openpgp/src/cert/parser/mod.rs +++ b/openpgp/src/cert/parser/mod.rs @@ -16,7 +16,7 @@ use crate::{ PacketParser }, Result, - cert::components::ComponentBinding, + cert::components::ComponentBundle, Cert, }; @@ -522,7 +522,7 @@ impl<'a, I: Iterator> CertParser<'a, I> { /// # let some_keyid = KeyID::from_hex("C2B819056C652598").unwrap(); /// for certr in CertParser::from_packet_parser(ppr) /// .unvalidated_cert_filter(|cert, _| { - /// for component in cert.keys().components() { + /// for component in cert.keys().bundles() { /// if component.key().keyid() == some_keyid { /// return true; /// } @@ -658,7 +658,7 @@ impl<'a, I: Iterator> CertParser<'a, I> { /// Splits the signatures in b.certifications into the correct /// vectors. pub fn split_sigs(primary: &KeyHandle, primary_keyid: &KeyHandle, - b: &mut ComponentBinding) + b: &mut ComponentBundle) { let mut self_signatures = vec![]; let mut certifications = vec![]; diff --git a/openpgp/src/crypto/hash.rs b/openpgp/src/crypto/hash.rs index 9cf25a94..ed68cc16 100644 --- a/openpgp/src/crypto/hash.rs +++ b/openpgp/src/crypto/hash.rs @@ -488,7 +488,7 @@ mod test { fn hash_verification() { fn check(cert: Cert) -> (usize, usize, usize) { let mut userid_sigs = 0; - for (i, binding) in cert.userids().bindings().enumerate() { + for (i, binding) in cert.userids().bundles().enumerate() { for selfsig in binding.self_signatures() { let h = Signature::hash_userid_binding( selfsig, @@ -504,7 +504,7 @@ mod test { } } let mut ua_sigs = 0; - for (i, binding) in cert.user_attributes().bindings().enumerate() + for (i, binding) in cert.user_attributes().bundles().enumerate() { for selfsig in binding.self_signatures() { let h = Signature::hash_user_attribute_binding( diff --git a/openpgp/src/packet/key/mod.rs b/openpgp/src/packet/key/mod.rs index 44721e73..f426cd5d 100644 --- a/openpgp/src/packet/key/mod.rs +++ b/openpgp/src/packet/key/mod.rs @@ -544,8 +544,8 @@ macro_rules! create_conversions { create_conversions!(Key); create_conversions!(Key4); -use crate::cert::components::KeyBinding; -create_conversions!(KeyBinding); +use crate::cert::components::KeyBundle; +create_conversions!(KeyBundle); /// Holds a public key, public subkey, private key or private subkey packet. /// diff --git a/openpgp/src/packet/signature/mod.rs b/openpgp/src/packet/signature/mod.rs index 3accd8fd..5c3af38f 100644 --- a/openpgp/src/packet/signature/mod.rs +++ b/openpgp/src/packet/signature/mod.rs @@ -1386,7 +1386,7 @@ mod test { let test2 = Cert::from_bytes( crate::tests::key("test2-signed-by-test1.pgp")).unwrap(); let uid_binding = - test2.userids().set_policy(p, None).nth(0).unwrap().binding(); + test2.userids().set_policy(p, None).nth(0).unwrap().bundle(); let cert = &uid_binding.certifications()[0]; cert.verify_userid_binding(cert_key1, diff --git a/openpgp/src/serialize/cert.rs b/openpgp/src/serialize/cert.rs index 761fbb50..330254e6 100644 --- a/openpgp/src/serialize/cert.rs +++ b/openpgp/src/serialize/cert.rs @@ -38,7 +38,7 @@ impl Cert { fn serialize_common(&self, o: &mut dyn std::io::Write, export: bool) -> Result<()> { - let primary = self.primary_key().binding(); + let primary = self.primary_key().bundle(); PacketRef::PublicKey(primary.key().mark_role_primary_ref()) .serialize(o)?; @@ -69,7 +69,7 @@ impl Cert { serialize_sig(o, s)?; } - for u in self.userids().bindings() { + for u in self.userids().bundles() { if export && ! u.self_signatures().iter().chain(u.self_revocations()).any( |s| s.exportable_certification().unwrap_or(true)) { @@ -92,7 +92,7 @@ impl Cert { } } - for u in self.user_attributes().bindings() { + for u in self.user_attributes().bundles() { if export && ! u.self_signatures().iter().chain(u.self_revocations()).any( |s| s.exportable_certification().unwrap_or(true)) { @@ -173,7 +173,7 @@ impl Cert { impl SerializeInto for Cert { fn serialized_len(&self) -> usize { let mut l = 0; - let primary = self.primary_key().binding(); + let primary = self.primary_key().bundle(); l += PacketRef::PublicKey(primary.key().mark_role_primary_ref()) .serialized_len(); @@ -190,7 +190,7 @@ impl SerializeInto for Cert { l += PacketRef::Signature(s).serialized_len(); } - for u in self.userids().bindings() { + for u in self.userids().bundles() { l += PacketRef::UserID(u.userid()).serialized_len(); for s in u.self_revocations() { @@ -207,7 +207,7 @@ impl SerializeInto for Cert { } } - for u in self.user_attributes().bindings() { + for u in self.user_attributes().bundles() { l += PacketRef::UserAttribute(u.user_attribute()).serialized_len(); for s in u.self_revocations() { @@ -403,7 +403,7 @@ impl<'a> TSK<'a> { } }; - let primary = self.cert.primary_key().binding(); + let primary = self.cert.primary_key().bundle(); serialize_key(o, primary.key().mark_role_primary_ref().into(), Tag::PublicKey, Tag::SecretKey)?; @@ -420,7 +420,7 @@ impl<'a> TSK<'a> { serialize_sig(o, s)?; } - for u in self.cert.userids().bindings() { + for u in self.cert.userids().bundles() { if export && ! u.self_signatures().iter().chain(u.self_revocations()).any( |s| s.exportable_certification().unwrap_or(true)) { @@ -443,7 +443,7 @@ impl<'a> TSK<'a> { } } - for u in self.cert.user_attributes().bindings() { + for u in self.cert.user_attributes().bundles() { if export && ! u.self_signatures().iter().chain(u.self_revocations()).any( |s| s.exportable_certification().unwrap_or(true)) { @@ -558,7 +558,7 @@ impl<'a> SerializeInto for TSK<'a> { packet.serialized_len() }; - let primary = self.cert.primary_key().binding(); + let primary = self.cert.primary_key().bundle(); l += serialized_len_key(primary.key().mark_role_primary_ref().into(), Tag::PublicKey, Tag::SecretKey); @@ -575,7 +575,7 @@ impl<'a> SerializeInto for TSK<'a> { l += PacketRef::Signature(s).serialized_len(); } - for u in self.cert.userids().bindings() { + for u in self.cert.userids().bundles() { l += PacketRef::UserID(u.userid()).serialized_len(); for s in u.self_revocations() { @@ -592,7 +592,7 @@ impl<'a> SerializeInto for TSK<'a> { } } - for u in self.cert.user_attributes().bindings() { + for u in self.cert.user_attributes().bundles() { l += PacketRef::UserAttribute(u.user_attribute()).serialized_len(); for s in u.self_revocations() { diff --git a/openpgp/src/serialize/cert_armored.rs b/openpgp/src/serialize/cert_armored.rs index 2d6927fd..861393c4 100644 --- a/openpgp/src/serialize/cert_armored.rs +++ b/openpgp/src/serialize/cert_armored.rs @@ -32,7 +32,7 @@ impl Cert { let length_value = armor::LINE_LENGTH - "Comment: ".len(); // Create a header per userid. - let mut headers: Vec = self.userids().bindings() + let mut headers: Vec = self.userids().bundles() // Ignore revoked userids. .filter_map(|uidb| { if let RevocationStatus::Revoked(_) = uidb.revoked(&p, None) { -- cgit v1.2.3