[][src]Struct sequoia_openpgp::cert::ValidCert

pub struct ValidCert<'a> { /* fields omitted */ }

A certificate under a given policy at a given time.

Implementations

impl<'a> ValidCert<'a>[src]

pub fn cert(&self) -> &'a Cert[src]

Returns the certificate.

pub fn time(&self) -> SystemTime[src]

Returns the amalgamation's reference time.

For queries that are with respect to a point in time, this determines that point in time.

pub fn policy(&self) -> &'a dyn Policy[src]

Returns the amalgamation's policy.

pub fn with_policy<T>(
    self,
    policy: &'a dyn Policy,
    time: T
) -> Result<ValidCert<'a>> where
    T: Into<Option<SystemTime>>, 
[src]

Changes the amalgamation's policy.

If time is None, the current time is used.

Returns an error if the certificate is not valid for the given policy at the given time.

pub fn direct_key_signature(&self) -> Result<&'a Signature>[src]

Returns the Certificate's direct key signature as of the reference time, if any.

Subpackets on direct key signatures apply to all components of the certificate.

pub fn revoked(&self) -> RevocationStatus<'a>[src]

Returns the Cert's revocation status.

A Cert is revoked if:

  • There is a live revocation that is newer than all live self signatures, 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 Cert is revoked; it does not imply anything about the Cert or other components.

pub fn alive(&self) -> Result<()>[src]

Returns whether or not the Cert is alive.

pub fn primary_key(&self) -> ValidPrimaryKeyAmalgamation<'a, PublicParts>[src]

Returns the amalgamated primary key.

pub fn keys(&self) -> ValidKeyAmalgamationIter<PublicParts, UnspecifiedRole>[src]

Returns an iterator over the certificate's keys.

That is, this returns an iterator over the primary key and any subkeys.

pub fn primary_userid(&self) -> Result<ValidComponentAmalgamation<'a, UserID>>[src]

Returns the amalgamated primary userid, if any.

pub fn userids(&self) -> ValidComponentBundleIter<UserID>[src]

Returns an iterator over the Cert's userids.

pub fn primary_user_attribute(
    &self
) -> Result<ValidComponentAmalgamation<'a, UserAttribute>>
[src]

Returns the amalgamated primary user attribute, if any.

pub fn user_attributes(&self) -> ValidComponentBundleIter<UserAttribute>[src]

Returns an iterator over the Cert's UserAttributeBundles.

Methods from Deref<Target = Cert>

pub fn primary_key(&self) -> PrimaryKeyAmalgamation<PublicParts>[src]

Returns the amalgamated primary key.

pub fn direct_key_signature<T>(
    &self,
    policy: &dyn Policy,
    t: T
) -> Result<&Signature> where
    T: Into<Option<SystemTime>>, 
[src]

Returns the Certificate's direct key signature as of the reference time, if any.

Subpackets on direct key signatures apply to all components of the certificate.

pub fn revoked<T>(&self, policy: &dyn Policy, t: T) -> RevocationStatus where
    T: Into<Option<SystemTime>>, 
[src]

Returns the Cert's revocation status at time t.

A Cert is revoked at time t if:

  • There is a live revocation at time t that is newer than all live self signatures at time t, 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 Cert is revoked; it does not imply anything about the Cert or other components.

pub fn alive<T>(&self, policy: &dyn Policy, t: T) -> Result<()> where
    T: Into<Option<SystemTime>>, 
[src]

Returns whether or not the Cert is alive at t.

pub fn primary_userid<'a, T>(
    &'a self,
    policy: &'a dyn Policy,
    t: T
) -> Result<ValidComponentAmalgamation<'a, UserID>> where
    T: Into<Option<SystemTime>>, 
[src]

Returns the amalgamated primary userid at t, if any.

pub fn userids(&self) -> ComponentBundleIter<UserID>[src]

Returns an iterator over the Cert's userids.

pub fn primary_user_attribute<'a, T>(
    &'a self,
    policy: &'a dyn Policy,
    t: T
) -> Result<ValidComponentAmalgamation<'a, UserAttribute>> where
    T: Into<Option<SystemTime>>, 
[src]

Returns the amalgamated primary user attribute at t, if any.

pub fn user_attributes(&self) -> ComponentBundleIter<UserAttribute>[src]

Returns an iterator over the Cert's UserAttributeBundles.

pub fn unknowns(&self) -> ComponentBundleIter<Unknown>[src]

Returns an iterator over the Cert's unknown components.

pub fn bad_signatures(&self) -> &[Signature][src]

Returns a slice containing all bad signatures.

Bad signatures are signatures that we could not associate with one of the components.

pub fn keys(&self) -> KeyAmalgamationIter<PublicParts, UnspecifiedRole>[src]

Returns an iterator over the certificate's keys.

That is, this returns an iterator over the primary key and any subkeys.

pub fn key_handle(&self) -> KeyHandle[src]

Returns the Cert's fingerprint.

pub fn fingerprint(&self) -> Fingerprint[src]

Returns the Cert's fingerprint.

pub fn keyid(&self) -> KeyID[src]

Returns the Cert's keyid.

pub fn is_tsk(&self) -> bool[src]

Returns whether at least one of the keys includes a secret part.

pub fn with_policy<'a, T>(
    &'a self,
    policy: &'a dyn Policy,
    time: T
) -> Result<ValidCert<'a>> where
    T: Into<Option<SystemTime>>, 
[src]

Fixes a time and policy for use with this certificate.

If time is None, the current time is used.

Returns an error if the certificate is not valid for the given policy at the given time.

pub fn as_tsk<'a>(&'a self) -> TSK<'a>[src]

Derive a TSK object from this key.

This object writes out secret keys during serialization.

pub fn armor_headers(&self) -> Vec<String>[src]

Creates descriptive armor headers.

Returns armor headers that describe this Cert. The Cert's 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 armored<'a>(&'a self) -> impl Serialize + SerializeInto + 'a[src]

Wraps this Cert in an armor structure when serialized.

Derives an object from this Cert that adds an armor structure to the serialized Cert when it is serialized. Additionally, the Cert's userids are added as comments, so that it is easier to identify the Cert when looking at the armored data.

Example

use sequoia_openpgp as openpgp;
use openpgp::cert::prelude::*;
use openpgp::serialize::SerializeInto;

let (cert, _) =
    CertBuilder::general_purpose(None, Some("Mr. Pink ☮☮☮"))
    .generate()?;
let armored = String::from_utf8(cert.armored().to_vec()?)?;

assert!(armored.starts_with("-----BEGIN PGP PUBLIC KEY BLOCK-----"));
assert!(armored.contains("Mr. Pink ☮☮☮"));

Trait Implementations

impl<'a> Clone for ValidCert<'a>[src]

impl<'a> Debug for ValidCert<'a>[src]

impl<'a> Deref for ValidCert<'a>[src]

type Target = Cert

The resulting type after dereferencing.

impl<'a> Display for ValidCert<'a>[src]

impl<'a> Preferences<'a> for ValidCert<'a>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for ValidCert<'a>

impl<'a> !Send for ValidCert<'a>

impl<'a> !Sync for ValidCert<'a>

impl<'a> Unpin for ValidCert<'a>

impl<'a> !UnwindSafe for ValidCert<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,