pub struct ValidComponentAmalgamation<'a, C> { /* private fields */ }
Expand description
A ComponentAmalgamation
plus a Policy
and a reference time.
A ValidComponentAmalgamation
combines a
ComponentAmalgamation
with a Policy
and a reference time.
This allows it to implement the ValidAmalgamation
trait, which
provides methods that require a Policy
and a reference time.
Although ComponentAmalgamation
could implement these methods by
requiring that the caller explicitly pass them in, embedding them
in the ValidComponentAmalgamation
helps ensure that multipart
operations, even those that span multiple functions, use the same
Policy
and reference time.
A ValidComponentAmalgamation
is typically obtained by
transforming a ComponentAmalgamation
using
ValidateAmalgamation::with_policy
. A
ComponentAmalgamationIter
can also be changed to yield
ValidComponentAmalgamation
s.
A ValidComponentAmalgamation
is guaranteed to come from a valid
certificate, and have a valid and live binding signature at the
specified reference time. Note: this only means that the binding
signatures are live; it says nothing about whether the
certificate is live. If you care about that, then you need to
check it separately.
Examples
Print out information about all non-revoked User IDs.
use openpgp::cert::prelude::*;
use openpgp::packet::prelude::*;
use openpgp::policy::StandardPolicy;
use openpgp::types::RevocationStatus;
let p = &StandardPolicy::new();
for u in cert.userids() {
// Create a `ValidComponentAmalgamation`. This may fail if
// there are no binding signatures that are accepted by the
// policy and that are live right now.
let u = u.with_policy(p, None)?;
// Before using the User ID, we still need to check that it is
// not revoked; `ComponentAmalgamation::with_policy` ensures
// that there is a valid *binding signature*, not that the
// `ComponentAmalgamation` is valid.
//
// Note: `ValidComponentAmalgamation::revocation_status` and
// `Preferences::preferred_symmetric_algorithms` use the
// embedded policy and timestamp. Even though we used `None` for
// the timestamp (i.e., now), they are guaranteed to use the same
// timestamp, because `with_policy` eagerly transforms it into
// the current time.
//
// Note: we only check whether the User ID is not revoked. If
// we were using a key, we'd also want to check that it is alive.
// (Keys can expire, but User IDs cannot.)
if let RevocationStatus::Revoked(_revs) = u.revocation_status() {
// Revoked by the key owner. (If we care about
// designated revokers, then we need to check those
// ourselves.)
} else {
// Print information about the User ID.
eprintln!("{}: preferred symmetric algorithms: {:?}",
String::from_utf8_lossy(u.value()),
u.preferred_symmetric_algorithms());
}
}
Implementations
sourceimpl<'a> ValidComponentAmalgamation<'a, UserID>
impl<'a> ValidComponentAmalgamation<'a, UserID>
sourcepub fn attested_certifications(
&self
) -> impl Iterator<Item = &Signature> + Send + Sync
pub fn attested_certifications(
&self
) -> impl Iterator<Item = &Signature> + Send + Sync
Returns the userid’s attested third-party certifications.
This feature is experimental.
Allows the certificate owner to attest to third party certifications. See Section 5.2.3.30 of RFC 4880bis for details. This can be used to address certificate flooding concerns.
This method only returns signatures that are valid under the current policy and are attested by the certificate holder.
sourcepub fn attestation_key_signatures(
&'a self
) -> impl Iterator<Item = &'a Signature> + Send + Sync
pub fn attestation_key_signatures(
&'a self
) -> impl Iterator<Item = &'a Signature> + Send + Sync
Returns set of active attestation key signatures.
This feature is experimental.
Returns the set of signatures with the newest valid signature creation time. Older signatures are not returned. The sum of all digests in these signatures are the set of attested third-party certifications.
This interface is useful for pruning old attestation key signatures when filtering a certificate.
Note: This is a low-level interface. Consider using
ValidUserIDAmalgamation::attested_certifications
to
iterate over all attested certifications.
sourcepub fn attest_certifications<C, S>(
&self,
primary_signer: &mut dyn Signer,
certifications: C
) -> Result<Vec<Signature>> where
C: IntoIterator<Item = S>,
S: Borrow<Signature>,
pub fn attest_certifications<C, S>(
&self,
primary_signer: &mut dyn Signer,
certifications: C
) -> Result<Vec<Signature>> where
C: IntoIterator<Item = S>,
S: Borrow<Signature>,
Attests to third-party certifications.
This feature is experimental.
Allows the certificate owner to attest to third party certifications. See Section 5.2.3.30 of RFC 4880bis for details. This can be used to address certificate flooding concerns.
Examples
let (alice, _) = CertBuilder::new()
.add_userid("alice@example.org")
.generate()?;
let mut alice_signer =
alice.primary_key().key().clone().parts_into_secret()?
.into_keypair()?;
let (bob, _) = CertBuilder::new()
.add_userid("bob@example.org")
.generate()?;
let mut bob_signer =
bob.primary_key().key().clone().parts_into_secret()?
.into_keypair()?;
let bob_pristine = bob.clone();
// Have Alice certify the binding between "bob@example.org" and
// Bob's key.
let alice_certifies_bob
= bob.userids().next().unwrap().userid().bind(
&mut alice_signer, &bob,
SignatureBuilder::new(SignatureType::GenericCertification))?;
let bob = bob.insert_packets(vec![alice_certifies_bob.clone()])?;
// Have Bob attest that certification.
let bobs_uid = bob.userids().next().unwrap();
let attestations =
bobs_uid.attest_certifications(
policy,
&mut bob_signer,
bobs_uid.certifications())?;
let bob = bob.insert_packets(attestations)?;
assert_eq!(bob.bad_signatures().count(), 0);
assert_eq!(bob.userids().next().unwrap().certifications().next(),
Some(&alice_certifies_bob));
sourceimpl<'a> ValidComponentAmalgamation<'a, UserAttribute>
impl<'a> ValidComponentAmalgamation<'a, UserAttribute>
sourcepub fn attested_certifications(
&self
) -> impl Iterator<Item = &Signature> + Send + Sync
pub fn attested_certifications(
&self
) -> impl Iterator<Item = &Signature> + Send + Sync
Returns the user attributes’s attested third-party certifications.
This feature is experimental.
Allows the certificate owner to attest to third party certifications. See Section 5.2.3.30 of RFC 4880bis for details. This can be used to address certificate flooding concerns.
This method only returns signatures that are valid under the current policy and are attested by the certificate holder.
sourcepub fn attestation_key_signatures(
&'a self
) -> impl Iterator<Item = &'a Signature> + Send + Sync
pub fn attestation_key_signatures(
&'a self
) -> impl Iterator<Item = &'a Signature> + Send + Sync
Returns set of active attestation key signatures.
This feature is experimental.
Returns the set of signatures with the newest valid signature creation time. Older signatures are not returned. The sum of all digests in these signatures are the set of attested third-party certifications.
This interface is useful for pruning old attestation key signatures when filtering a certificate.
Note: This is a low-level interface. Consider using
ValidUserAttributeAmalgamation::attested_certifications
to
iterate over all attested certifications.
sourcepub fn attest_certifications<C, S>(
&self,
primary_signer: &mut dyn Signer,
certifications: C
) -> Result<Vec<Signature>> where
C: IntoIterator<Item = S>,
S: Borrow<Signature>,
pub fn attest_certifications<C, S>(
&self,
primary_signer: &mut dyn Signer,
certifications: C
) -> Result<Vec<Signature>> where
C: IntoIterator<Item = S>,
S: Borrow<Signature>,
Attests to third-party certifications.
This feature is experimental.
Allows the certificate owner to attest to third party certifications. See Section 5.2.3.30 of RFC 4880bis for details. This can be used to address certificate flooding concerns.
Examples
See ValidUserIDAmalgamation::attest_certifications#examples
.
sourceimpl<'a, C> ValidComponentAmalgamation<'a, C> where
C: Ord + Send + Sync,
impl<'a, C> ValidComponentAmalgamation<'a, C> where
C: Ord + Send + Sync,
sourcepub fn self_signatures(&self) -> impl Iterator<Item = &Signature> + Send + Sync
pub fn self_signatures(&self) -> impl Iterator<Item = &Signature> + Send + Sync
The component’s self-signatures.
This method only returns signatures that are valid under the current policy.
sourcepub fn certifications(&self) -> impl Iterator<Item = &Signature> + Send + Sync
pub fn certifications(&self) -> impl Iterator<Item = &Signature> + Send + Sync
The component’s third-party certifications.
This method only returns signatures that are valid under the current policy.
sourcepub fn self_revocations(&self) -> impl Iterator<Item = &Signature> + Send + Sync
pub fn self_revocations(&self) -> impl Iterator<Item = &Signature> + Send + Sync
The component’s revocations that were issued by the certificate holder.
This method only returns signatures that are valid under the current policy.
Methods from Deref<Target = ComponentAmalgamation<'a, C>>
sourcepub fn parts_as_public(
&'a self
) -> &'a ComponentAmalgamation<'a, Key<PublicParts, R>>
pub fn parts_as_public(
&'a self
) -> &'a ComponentAmalgamation<'a, Key<PublicParts, R>>
Changes the key’s parts tag to PublicParts
.
sourcepub fn parts_as_secret(
&'a self
) -> Result<&'a ComponentAmalgamation<'a, Key<SecretParts, R>>>
pub fn parts_as_secret(
&'a self
) -> Result<&'a ComponentAmalgamation<'a, Key<SecretParts, R>>>
Changes the key’s parts tag to SecretParts
.
sourcepub fn parts_as_unspecified(
&'a self
) -> &ComponentAmalgamation<'a, Key<UnspecifiedParts, R>>
pub fn parts_as_unspecified(
&'a self
) -> &ComponentAmalgamation<'a, Key<UnspecifiedParts, R>>
Changes the key’s parts tag to UnspecifiedParts
.
sourcepub fn role_as_primary(
&'a self
) -> &'a ComponentAmalgamation<'a, Key<P, PrimaryRole>>
pub fn role_as_primary(
&'a self
) -> &'a ComponentAmalgamation<'a, Key<P, PrimaryRole>>
Changes the key’s role tag to PrimaryRole
.
sourcepub fn role_as_subordinate(
&'a self
) -> &'a ComponentAmalgamation<'a, Key<P, SubordinateRole>>
pub fn role_as_subordinate(
&'a self
) -> &'a ComponentAmalgamation<'a, Key<P, SubordinateRole>>
Changes the key’s role tag to SubordinateRole
.
sourcepub fn role_as_unspecified(
&'a self
) -> &'a ComponentAmalgamation<'a, Key<P, UnspecifiedRole>>
pub fn role_as_unspecified(
&'a self
) -> &'a ComponentAmalgamation<'a, Key<P, UnspecifiedRole>>
Changes the key’s role tag to UnspecifiedRole
.
sourcepub fn cert(&self) -> &'a Cert
pub fn cert(&self) -> &'a Cert
Returns the component’s associated certificate.
for u in cert.userids() {
// It's not only an identical `Cert`, it's the same one.
assert!(std::ptr::eq(u.cert(), &cert));
}
sourcepub fn bundle(&self) -> &'a ComponentBundle<C>
pub fn bundle(&self) -> &'a ComponentBundle<C>
Returns this amalgamation’s bundle.
Note: although ComponentAmalgamation
derefs to a
&ComponentBundle
, this method provides a more accurate
lifetime, which is helpful when returning the reference from a
function. See the module’s documentation for more details.
Examples
use openpgp::cert::prelude::*;
use openpgp::packet::prelude::*;
cert.userids()
.map(|ua| {
// The following doesn't work:
//
// let b: &ComponentBundle<_> = &ua; b
//
// Because ua's lifetime is this closure and autoderef
// assigns `b` the same lifetime as `ua`. `bundle()`,
// however, returns a reference whose lifetime is that
// of `cert`.
ua.bundle()
})
.collect::<Vec<&ComponentBundle<_>>>();
sourcepub fn component(&self) -> &'a C
pub fn component(&self) -> &'a C
Returns this amalgamation’s component.
Note: although ComponentAmalgamation
derefs to a
&Component
(via &ComponentBundle
), this method provides a
more accurate lifetime, which is helpful when returning the
reference from a function. See the module’s documentation
for more details.
sourcepub fn self_signatures(
&self
) -> impl Iterator<Item = &'a Signature> + Send + Sync
pub fn self_signatures(
&self
) -> impl Iterator<Item = &'a Signature> + Send + Sync
The component’s self-signatures.
sourcepub fn certifications(
&self
) -> impl Iterator<Item = &'a Signature> + Send + Sync
pub fn certifications(
&self
) -> impl Iterator<Item = &'a Signature> + Send + Sync
The component’s third-party certifications.
sourcepub fn self_revocations(
&self
) -> impl Iterator<Item = &'a Signature> + Send + Sync
pub fn self_revocations(
&self
) -> impl Iterator<Item = &'a Signature> + Send + Sync
The component’s revocations that were issued by the certificate holder.
sourcepub fn userid(&self) -> &'a UserID
pub fn userid(&self) -> &'a UserID
Returns a reference to the User ID.
Note: although ComponentAmalgamation<UserID>
derefs to a
&UserID
(via &ComponentBundle
), this method provides a
more accurate lifetime, which is helpful when returning the
reference from a function. See the module’s documentation
for more details.
sourcepub fn attest_certifications<C, S>(
&self,
policy: &dyn Policy,
primary_signer: &mut dyn Signer,
certifications: C
) -> Result<Vec<Signature>> where
C: IntoIterator<Item = S>,
S: Borrow<Signature>,
pub fn attest_certifications<C, S>(
&self,
policy: &dyn Policy,
primary_signer: &mut dyn Signer,
certifications: C
) -> Result<Vec<Signature>> where
C: IntoIterator<Item = S>,
S: Borrow<Signature>,
Attests to third-party certifications.
This feature is experimental.
Allows the certificate owner to attest to third party certifications. See Section 5.2.3.30 of RFC 4880bis for details. This can be used to address certificate flooding concerns.
A policy is needed, because the expiration is updated by updating the current binding signatures.
Examples
let (alice, _) = CertBuilder::new()
.add_userid("alice@example.org")
.generate()?;
let mut alice_signer =
alice.primary_key().key().clone().parts_into_secret()?
.into_keypair()?;
let (bob, _) = CertBuilder::new()
.add_userid("bob@example.org")
.generate()?;
let mut bob_signer =
bob.primary_key().key().clone().parts_into_secret()?
.into_keypair()?;
let bob_pristine = bob.clone();
// Have Alice certify the binding between "bob@example.org" and
// Bob's key.
let alice_certifies_bob
= bob.userids().next().unwrap().userid().bind(
&mut alice_signer, &bob,
SignatureBuilder::new(SignatureType::GenericCertification))?;
let bob = bob.insert_packets(vec![alice_certifies_bob.clone()])?;
// Have Bob attest that certification.
let bobs_uid = bob.userids().next().unwrap();
let attestations =
bobs_uid.attest_certifications(
policy,
&mut bob_signer,
bobs_uid.certifications())?;
let bob = bob.insert_packets(attestations)?;
assert_eq!(bob.bad_signatures().count(), 0);
assert_eq!(bob.userids().next().unwrap().certifications().next(),
Some(&alice_certifies_bob));
sourcepub fn user_attribute(&self) -> &'a UserAttribute
pub fn user_attribute(&self) -> &'a UserAttribute
Returns a reference to the User Attribute.
Note: although ComponentAmalgamation<UserAttribute>
derefs
to a &UserAttribute
(via &ComponentBundle
), this method
provides a more accurate lifetime, which is helpful when
returning the reference from a function. See the module’s
documentation for more details.
sourcepub fn attest_certifications<C, S>(
&self,
policy: &dyn Policy,
primary_signer: &mut dyn Signer,
certifications: C
) -> Result<Vec<Signature>> where
C: IntoIterator<Item = S>,
S: Borrow<Signature>,
pub fn attest_certifications<C, S>(
&self,
policy: &dyn Policy,
primary_signer: &mut dyn Signer,
certifications: C
) -> Result<Vec<Signature>> where
C: IntoIterator<Item = S>,
S: Borrow<Signature>,
Attests to third-party certifications.
This feature is experimental.
Allows the certificate owner to attest to third party certifications. See Section 5.2.3.30 of RFC 4880bis for details. This can be used to address certificate flooding concerns.
A policy is needed, because the expiration is updated by updating the current binding signatures.
Examples
Methods from Deref<Target = ComponentBundle<C>>
sourcepub fn parts_as_public(&self) -> &KeyBundle<PublicParts, R>
pub fn parts_as_public(&self) -> &KeyBundle<PublicParts, R>
Changes the key’s parts tag to PublicParts
.
sourcepub fn parts_as_secret(&self) -> Result<&KeyBundle<SecretParts, R>>
pub fn parts_as_secret(&self) -> Result<&KeyBundle<SecretParts, R>>
Changes the key’s parts tag to SecretParts
.
sourcepub fn parts_as_unspecified(&self) -> &KeyBundle<UnspecifiedParts, R>
pub fn parts_as_unspecified(&self) -> &KeyBundle<UnspecifiedParts, R>
Changes the key’s parts tag to UnspecifiedParts
.
sourcepub fn role_as_primary(&self) -> &KeyBundle<P, PrimaryRole>
pub fn role_as_primary(&self) -> &KeyBundle<P, PrimaryRole>
Changes the key’s role tag to PrimaryRole
.
sourcepub fn role_as_subordinate(&self) -> &KeyBundle<P, SubordinateRole>
pub fn role_as_subordinate(&self) -> &KeyBundle<P, SubordinateRole>
Changes the key’s role tag to SubordinateRole
.
sourcepub fn role_as_unspecified(&self) -> &KeyBundle<P, UnspecifiedRole>
pub fn role_as_unspecified(&self) -> &KeyBundle<P, UnspecifiedRole>
Changes the key’s role tag to UnspecifiedRole
.
sourcepub fn component(&self) -> &C
pub fn component(&self) -> &C
Returns a reference to the bundle’s component.
Examples
// Display some information about any unknown components.
for u in cert.unknowns() {
eprintln!(" - {:?}", u.component());
}
sourcepub fn binding_signature<T>(
&self,
policy: &dyn Policy,
t: T
) -> Result<&Signature> where
T: Into<Option<SystemTime>>,
pub fn binding_signature<T>(
&self,
policy: &dyn Policy,
t: T
) -> Result<&Signature> where
T: Into<Option<SystemTime>>,
Returns the active binding signature at time t
.
The active binding signature is the most recent, non-revoked
self-signature that is valid according to the policy
and
alive at time t
(creation time <= t
, t < expiry
). If
there are multiple such signatures then the signatures are
ordered by their MPIs interpreted as byte strings.
Examples
use openpgp::policy::StandardPolicy;
let p = &StandardPolicy::new();
// Display information about each User ID's current active
// binding signature (the `time` parameter is `None`), if any.
for ua in cert.userids() {
eprintln!("{:?}", ua.binding_signature(p, None));
}
sourcepub fn self_signatures(&self) -> &[Signature]
pub fn self_signatures(&self) -> &[Signature]
Returns the component’s self-signatures.
The signatures are validated, and they are sorted by their creation time, most recent first.
Examples
use openpgp::policy::StandardPolicy;
let p = &StandardPolicy::new();
for (i, ka) in cert.keys().enumerate() {
eprintln!("Key #{} ({}) has {:?} self signatures",
i, ka.fingerprint(),
ka.bundle().self_signatures().len());
}
sourcepub fn certifications(&self) -> &[Signature]
pub fn certifications(&self) -> &[Signature]
Returns the component’s third-party certifications.
The signatures are not validated. They are sorted by their creation time, most recent first.
Examples
use openpgp::policy::StandardPolicy;
let p = &StandardPolicy::new();
for ua in cert.userids() {
eprintln!("User ID {} has {:?} unverified, third-party certifications",
String::from_utf8_lossy(ua.userid().value()),
ua.bundle().certifications().len());
}
sourcepub fn self_revocations(&self) -> &[Signature]
pub fn self_revocations(&self) -> &[Signature]
Returns the component’s revocations that were issued by the certificate holder.
The revocations are validated, and they are sorted by their creation time, most recent first.
Examples
use openpgp::policy::StandardPolicy;
let p = &StandardPolicy::new();
for u in cert.userids() {
eprintln!("User ID {} has {:?} revocation certificates.",
String::from_utf8_lossy(u.userid().value()),
u.bundle().self_revocations().len());
}
sourcepub fn other_revocations(&self) -> &[Signature]
pub fn other_revocations(&self) -> &[Signature]
Returns the component’s revocations that were issued by other certificates.
The revocations are not validated. They are sorted by their creation time, most recent first.
Examples
use openpgp::policy::StandardPolicy;
let p = &StandardPolicy::new();
for u in cert.userids() {
eprintln!("User ID {} has {:?} unverified, third-party revocation certificates.",
String::from_utf8_lossy(u.userid().value()),
u.bundle().other_revocations().len());
}
sourcepub fn attestations(&self) -> impl Iterator<Item = &Signature> + Send + Sync
pub fn attestations(&self) -> impl Iterator<Item = &Signature> + Send + Sync
Returns all of the component’s Attestation Key Signatures.
This feature is experimental.
The signatures are validated, and they are sorted by their creation time, most recent first.
A certificate owner can use Attestation Key Signatures to attest to third party certifications. Currently, only userid and user attribute certifications can be attested. See Section 5.2.3.30 of RFC 4880bis for details.
Examples
use openpgp::policy::StandardPolicy;
let p = &StandardPolicy::new();
for (i, uid) in cert.userids().enumerate() {
eprintln!("UserID #{} ({:?}) has {:?} attestation key signatures",
i, uid.email(),
uid.attestations().count());
}
sourcepub fn signatures(&self) -> impl Iterator<Item = &Signature> + Send + Sync
pub fn signatures(&self) -> impl Iterator<Item = &Signature> + Send + Sync
Returns all of the component’s signatures.
Only the self-signatures are validated. The signatures are sorted first by type, then by creation time. The self revocations come first, then the self signatures, then any key attestation signatures, certifications, and third-party revocations coming last. This function may return additional types of signatures that could be associated to this component.
Examples
use openpgp::policy::StandardPolicy;
let p = &StandardPolicy::new();
for (i, ka) in cert.keys().enumerate() {
eprintln!("Key #{} ({}) has {:?} signatures",
i, ka.fingerprint(),
ka.signatures().count());
}
sourcepub fn key(&self) -> &Key<P, R>
pub fn key(&self) -> &Key<P, R>
Returns a reference to the key.
This is just a type-specific alias for
ComponentBundle::component
.
Examples
// Display some information about the keys.
for ka in cert.keys() {
eprintln!(" - {:?}", ka.key());
}
sourcepub fn revocation_status<T>(
&self,
policy: &dyn Policy,
t: T
) -> RevocationStatus<'_> where
T: Into<Option<SystemTime>>,
pub fn revocation_status<T>(
&self,
policy: &dyn Policy,
t: T
) -> RevocationStatus<'_> where
T: Into<Option<SystemTime>>,
Returns the subkey’s revocation status at time t
.
A subkey is revoked at time t
if:
-
There is a live revocation at time
t
that is newer than all live self signatures at timet
, or -
There is a hard revocation (even if it is not live at time
t
, and even if there is a newer self-signature).
Note: Certs and subkeys have different criteria from User IDs and User Attributes.
Note: this only returns whether this subkey is revoked; it does not imply anything about the Cert or other components.
Examples
use openpgp::policy::StandardPolicy;
let p = &StandardPolicy::new();
// Display the subkeys' revocation status.
for ka in cert.keys().subkeys() {
eprintln!(" Revocation status of {}: {:?}",
ka.fingerprint(), ka.revocation_status(p, None));
}
sourcepub fn userid(&self) -> &UserID
pub fn userid(&self) -> &UserID
Returns a reference to the User ID.
This is just a type-specific alias for
ComponentBundle::component
.
Examples
// Display some information about the User IDs.
for ua in cert.userids() {
eprintln!(" - {:?}", ua.userid());
}
sourcepub fn revocation_status<T>(
&self,
policy: &dyn Policy,
t: T
) -> RevocationStatus<'_> where
T: Into<Option<SystemTime>>,
pub fn revocation_status<T>(
&self,
policy: &dyn Policy,
t: T
) -> RevocationStatus<'_> where
T: Into<Option<SystemTime>>,
Returns the User ID’s revocation status at time t
.
A User ID is revoked at time t
if:
- There is a live revocation at time
t
that is newer than all live self signatures at timet
.
Note: Certs and subkeys have different criteria from User IDs and User Attributes.
Note: this only returns whether this User ID is revoked; it does not imply anything about the Cert or other components.
Examples
use openpgp::policy::StandardPolicy;
let p = &StandardPolicy::new();
// Display the User IDs' revocation status.
for ua in cert.userids() {
eprintln!(" Revocation status of {}: {:?}",
String::from_utf8_lossy(ua.userid().value()),
ua.revocation_status(p, None));
}
sourcepub fn user_attribute(&self) -> &UserAttribute
pub fn user_attribute(&self) -> &UserAttribute
Returns a reference to the User Attribute.
This is just a type-specific alias for
ComponentBundle::component
.
Examples
// Display some information about the User Attributes
for ua in cert.user_attributes() {
eprintln!(" - {:?}", ua.user_attribute());
}
sourcepub fn revocation_status<T>(
&self,
policy: &dyn Policy,
t: T
) -> RevocationStatus<'_> where
T: Into<Option<SystemTime>>,
pub fn revocation_status<T>(
&self,
policy: &dyn Policy,
t: T
) -> RevocationStatus<'_> where
T: Into<Option<SystemTime>>,
Returns the User Attribute’s revocation status at time t
.
A User Attribute is revoked at time t
if:
- There is a live revocation at time
t
that is newer than all live self signatures at timet
.
Note: Certs and subkeys have different criteria from User IDs and User Attributes.
Note: this only returns whether this User Attribute is revoked; it does not imply anything about the Cert or other components.
Examples
use openpgp::policy::StandardPolicy;
let p = &StandardPolicy::new();
// Display the User Attributes' revocation status.
for (i, ua) in cert.user_attributes().enumerate() {
eprintln!(" Revocation status of User Attribute #{}: {:?}",
i, ua.revocation_status(p, None));
}
sourcepub fn unknown(&self) -> &Unknown
pub fn unknown(&self) -> &Unknown
Returns a reference to the unknown component.
This is just a type-specific alias for
ComponentBundle::component
.
Examples
// Display some information about the User Attributes
for u in cert.unknowns() {
eprintln!(" - {:?}", u.unknown());
}
Trait Implementations
sourceimpl<'a, C> Clone for ValidComponentAmalgamation<'a, C>
impl<'a, C> Clone for ValidComponentAmalgamation<'a, C>
sourceimpl<'a, C: Debug> Debug for ValidComponentAmalgamation<'a, C>
impl<'a, C: Debug> Debug for ValidComponentAmalgamation<'a, C>
sourceimpl<'a, C> Deref for ValidComponentAmalgamation<'a, C>
impl<'a, C> Deref for ValidComponentAmalgamation<'a, C>
type Target = ComponentAmalgamation<'a, C>
type Target = ComponentAmalgamation<'a, C>
The resulting type after dereferencing.
sourceimpl<'a, C: 'a> From<ValidComponentAmalgamation<'a, C>> for ComponentAmalgamation<'a, C>
impl<'a, C: 'a> From<ValidComponentAmalgamation<'a, C>> for ComponentAmalgamation<'a, C>
sourcefn from(vca: ValidComponentAmalgamation<'a, C>) -> Self
fn from(vca: ValidComponentAmalgamation<'a, C>) -> Self
Converts to this type from the input type.
sourceimpl<'a, C> Preferences<'a> for ValidComponentAmalgamation<'a, C>
impl<'a, C> Preferences<'a> for ValidComponentAmalgamation<'a, C>
sourcefn preferred_symmetric_algorithms(&self) -> Option<&'a [SymmetricAlgorithm]>
fn preferred_symmetric_algorithms(&self) -> Option<&'a [SymmetricAlgorithm]>
Returns the supported symmetric algorithms ordered by preference. Read more
sourcefn preferred_hash_algorithms(&self) -> Option<&'a [HashAlgorithm]>
fn preferred_hash_algorithms(&self) -> Option<&'a [HashAlgorithm]>
Returns the supported hash algorithms ordered by preference. Read more
sourcefn preferred_compression_algorithms(&self) -> Option<&'a [CompressionAlgorithm]>
fn preferred_compression_algorithms(&self) -> Option<&'a [CompressionAlgorithm]>
Returns the supported compression algorithms ordered by preference. Read more
sourcefn preferred_aead_algorithms(&self) -> Option<&'a [AEADAlgorithm]>
fn preferred_aead_algorithms(&self) -> Option<&'a [AEADAlgorithm]>
Returns the supported AEAD algorithms ordered by preference. Read more
sourcefn key_server_preferences(&self) -> Option<KeyServerPreferences>
fn key_server_preferences(&self) -> Option<KeyServerPreferences>
Returns the certificate holder’s keyserver preferences.
sourcefn preferred_key_server(&self) -> Option<&'a [u8]>
fn preferred_key_server(&self) -> Option<&'a [u8]>
Returns the certificate holder’s preferred keyserver for updates. Read more
sourcefn policy_uri(&self) -> Option<&'a [u8]>
fn policy_uri(&self) -> Option<&'a [u8]>
Returns the URI of a document describing the policy the certificate was issued under. Read more
sourceimpl<'a, C> ValidAmalgamation<'a, C> for ValidComponentAmalgamation<'a, C>
impl<'a, C> ValidAmalgamation<'a, C> for ValidComponentAmalgamation<'a, C>
sourcefn cert(&self) -> &ValidCert<'a>
fn cert(&self) -> &ValidCert<'a>
Returns the valid amalgamation’s associated certificate. Read more
sourcefn time(&self) -> SystemTime
fn time(&self) -> SystemTime
Returns the amalgamation’s reference time. Read more
sourcefn binding_signature(&self) -> &'a Signature
fn binding_signature(&self) -> &'a Signature
Returns the component’s binding signature as of the reference time. Read more
sourcefn revocation_status(&self) -> RevocationStatus<'a>
fn revocation_status(&self) -> RevocationStatus<'a>
Returns the component’s revocation status as of the amalgamation’s reference time. Read more
sourcefn revocation_keys(&self) -> Box<dyn Iterator<Item = &'a RevocationKey> + 'a>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn revocation_keys(&self) -> Box<dyn Iterator<Item = &'a RevocationKey> + 'a>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
Returns a list of any designated revokers for this component. Read more
sourcefn map<F: Fn(&'a Signature) -> Option<T>, T>(&self, f: F) -> Option<T>
fn map<F: Fn(&'a Signature) -> Option<T>, T>(&self, f: F) -> Option<T>
Maps the given function over binding and direct key signature. Read more
sourcefn direct_key_signature(&self) -> Result<&'a Signature>
fn direct_key_signature(&self) -> Result<&'a Signature>
Returns the certificate’s direct key signature as of the reference time, if any. Read more
sourceimpl<'a, C> ValidateAmalgamation<'a, C> for ValidComponentAmalgamation<'a, C>
impl<'a, C> ValidateAmalgamation<'a, C> for ValidComponentAmalgamation<'a, C>
type V = ValidComponentAmalgamation<'a, C>
type V = ValidComponentAmalgamation<'a, C>
The type returned by with_policy
. Read more
sourcefn with_policy<T>(self, policy: &'a dyn Policy, time: T) -> Result<Self::V> where
T: Into<Option<SystemTime>>,
Self: Sized,
fn with_policy<T>(self, policy: &'a dyn Policy, time: T) -> Result<Self::V> where
T: Into<Option<SystemTime>>,
Self: Sized,
Uses the specified Policy
and reference time with the amalgamation. Read more
Auto Trait Implementations
impl<'a, C> !RefUnwindSafe for ValidComponentAmalgamation<'a, C>
impl<'a, C> Send for ValidComponentAmalgamation<'a, C> where
C: Sync,
impl<'a, C> Sync for ValidComponentAmalgamation<'a, C> where
C: Sync,
impl<'a, C> Unpin for ValidComponentAmalgamation<'a, C>
impl<'a, C> !UnwindSafe for ValidComponentAmalgamation<'a, C>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more