pub trait ValidateAmalgamation<'a, C: 'a>: Sealed {
    type V;

    // Required method
    fn with_policy<T>(self, policy: &'a dyn Policy, time: T) -> Result<Self::V>
       where T: Into<Option<SystemTime>>,
             Self: Sized;
}
Expand description

Embeds a policy and a reference time in an amalgamation.

This is used to turn a ComponentAmalgamation into a ValidComponentAmalgamation, and a KeyAmalgamation into a ValidKeyAmalgamation.

A certificate or a component is considered valid if:

  • It has a self signature that is live at time t.

  • The policy considers it acceptable.

  • The certificate is valid.

§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.

§Examples

use openpgp::cert::prelude::*;
use openpgp::policy::{Policy, StandardPolicy};

const POLICY: &dyn Policy = &StandardPolicy::new();

fn f(ua: UserIDAmalgamation) -> openpgp::Result<()> {
    let ua = ua.with_policy(POLICY, None)?;
    // ...
}

Required Associated Types§

source

type V

The type returned by with_policy.

This is either a ValidComponentAmalgamation or a ValidKeyAmalgamation.

Required Methods§

source

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.

If time is None, the current time is used.

Implementors§