[][src]Trait sequoia_openpgp::cert::amalgamation::ValidAmalgamation

pub trait ValidAmalgamation<'a, C: 'a>: Sealed {
    pub fn cert(&self) -> &ValidCert<'a>;
pub fn time(&self) -> SystemTime;
pub fn policy(&self) -> &'a dyn Policy;
pub fn binding_signature(&self) -> &'a Signature;
pub fn revocation_status(&self) -> RevocationStatus<'a>; pub fn map<F: Fn(&'a Signature) -> Option<T>, T>(&self, f: F) -> Option<T> { ... }
pub fn direct_key_signature(&self) -> Result<&'a Signature> { ... } }

Methods for valid amalgamations.

The methods exposed by a ValidComponentAmalgamation are similar to those exposed by a ComponentAmalgamation, but the policy and reference time are included in the ValidComponentAmalgamation. This helps prevent using different policies or different reference times when using a component, which can easily happen when the checks span multiple functions.

Sealed trait

This trait is sealed and cannot be implemented for types outside this crate. Therefore it can be extended in a non-breaking way. If you want to implement the trait inside the crate you also need to implement the seal::Sealed marker trait.

Required methods

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

Returns the valid amalgamation's associated certificate.

Examples

fn f(ua: &ValidUserIDAmalgamation) {
    let cert = ua.cert();
    // ...
}

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

Returns the amalgamation's reference time.

Examples

fn f(ua: &ValidUserIDAmalgamation) {
    let t = ua.time();
    // ...
}

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

Returns the amalgamation's policy.

Examples

fn f(ua: &ValidUserIDAmalgamation) {
    let policy = ua.policy();
    // ...
}

pub fn binding_signature(&self) -> &'a Signature[src]

Returns the component's binding signature as of the reference time.

Examples

fn f(ua: &ValidUserIDAmalgamation) {
    let sig = ua.binding_signature();
    // ...
}

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

Returns the component's revocation status as of the amalgamation's reference time.

This does not check whether the certificate has been revoked. For that, use Cert::revocation_status().

Note, as per RFC 4880, a key is considered to be revoked at some time if there were no soft revocations created as of that time, and no hard revocations:

If a key has been revoked because of a compromise, all signatures created by that key are suspect. However, if it was merely superseded or retired, old signatures are still valid.

Examples

use openpgp::cert::prelude::*;
use openpgp::types::RevocationStatus;

match ua.revocation_status() {
    RevocationStatus::Revoked(revs) => {
        // The certificate holder revoked the User ID.
    }
    RevocationStatus::CouldBe(revs) => {
        // There are third-party revocations.  You still need
        // to check that they are valid (this is necessary,
        // because without the Certificates are not normally
        // available to Sequoia).
    }
    RevocationStatus::NotAsFarAsWeKnow => {
        // We have no evidence that the User ID is revoked.
    }
}
Loading content...

Provided methods

pub fn map<F: Fn(&'a Signature) -> Option<T>, T>(&self, f: F) -> Option<T>[src]

Maps the given function over binding and direct key signature.

Makes f consider both the binding signature and the direct key signature. Information in the binding signature takes precedence over the direct key signature. See also Section 5.2.3.3 of RFC 4880.

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, cf. Section 5.2.3.3 of RFC 4880.

Examples

fn f(ua: &ValidUserIDAmalgamation) {
    let sig = ua.direct_key_signature();
    // ...
}
Loading content...

Implementors

impl<'a, C> ValidAmalgamation<'a, C> for ValidComponentAmalgamation<'a, C>[src]

impl<'a, P, R, R2> ValidAmalgamation<'a, Key<P, R>> for ValidKeyAmalgamation<'a, P, R, R2> where
    P: 'a + KeyParts,
    R: 'a + KeyRole,
    R2: Copy,
    Self: PrimaryKey<'a, P, R>, 
[src]

Loading content...