[][src]Struct sequoia_openpgp::cert::prelude::ValidKeyAmalgamationIter

pub struct ValidKeyAmalgamationIter<'a, P, R> where
    P: KeyParts,
    R: KeyRole
{ /* fields omitted */ }

An iterator over all valid Keys in a certificate.

A key is valid at time t if it was not created after t and it has a live self-signature at time t. Note: this does not mean that the key or the certificate is also live at time t; the key or certificate may be expired, but the self-signature is still valid.

ValidKeyAmalgamationIter follows the builder pattern. There is no need to explicitly finalize it, however: it already implements the Iterator trait.

Implementations

impl<'a, P, R> ValidKeyAmalgamationIter<'a, P, R> where
    P: KeyParts,
    R: KeyRole
[src]

pub fn key_flags<F>(self, flags: F) -> Self where
    F: Borrow<KeyFlags>, 
[src]

Returns keys that have the at least one of the flags specified in flags.

If you call this function (or one of for_certification or for_signing functions) multiple times, the union of the values is used. Thus, cert.flags().for_certification().for_signing() will return keys that are certification capable or signing capable.

If you need more complex filtering, e.g., you want a key that is both certification and signing capable, then use Iterator::filter.

pub fn for_certification(self) -> Self[src]

Returns keys that are certification capable.

See key_flags for caveats.

pub fn for_signing(self) -> Self[src]

Returns keys that are signing capable.

See key_flags for caveats.

pub fn for_authentication(self) -> Self[src]

Returns keys that are authentication capable.

See key_flags for caveats.

pub fn for_storage_encryption(self) -> Self[src]

Returns keys that are capable of encrypting data at rest.

See key_flags for caveats.

pub fn for_transport_encryption(self) -> Self[src]

Returns keys that are capable of encrypting data for transport.

See key_flags for caveats.

pub fn alive(self) -> Self[src]

Only returns keys that are alive.

Note: this only checks if the key is alive; it does not check whether the certificate is alive.

pub fn revoked<T>(self, revoked: T) -> Self where
    T: Into<Option<bool>>, 
[src]

Filters by whether a key is definitely revoked.

A value of None disables this filter.

Note: If you call this function multiple times on the same iterator, only the last value is used.

Note: This only checks if the key is not revoked; it does not check whether the certificate not revoked.

This filter checks whether a key's revocation status is RevocationStatus::Revoked or not. The latter (i.e., revoked(false)) is equivalent to:

extern crate sequoia_openpgp as openpgp;
use openpgp::types::RevocationStatus;
use openpgp::cert::prelude::*;
use sequoia_openpgp::policy::StandardPolicy;

let p = &StandardPolicy::new();

let non_revoked_keys = cert
    .keys()
    .with_policy(p, timestamp)
    .filter(|ka| {
        match ka.revoked() {
            RevocationStatus::Revoked(_) =>
                // It's definitely revoked, skip it.
                false,
            RevocationStatus::CouldBe(_) =>
                // There is a designated revoker that we
                // should check, but don't (or can't).  To
                // avoid a denial of service arising from fake
                // revocations, we assume that the key has not
                // been revoked and return it.
                true,
            RevocationStatus::NotAsFarAsWeKnow =>
                // We have no evidence to suggest that the key
                // is revoked.
                true,
        }
    })
    .map(|ka| ka.key())
    .collect::<Vec<_>>();

As the example shows, this filter is significantly less flexible than using KeyAmalgamation::revoked. However, this filter implements a typical policy, and does not preclude using filter to realize alternative policies.

pub fn secret(self) -> ValidKeyAmalgamationIter<'a, SecretParts, R>[src]

Changes the filter to only return keys with secret key material.

pub fn unencrypted_secret(self) -> ValidKeyAmalgamationIter<'a, SecretParts, R>[src]

Changes the filter to only return keys with unencrypted secret key material.

pub fn key_handle<H>(self, h: H) -> Self where
    H: Into<KeyHandle>, 
[src]

Only returns a key if it matches the specified handle.

Note: this function is cumulative. If you call this function (or key_handles) multiple times, then the iterator returns a key if it matches any of the specified handles.

pub fn key_handles<'b>(self, h: impl Iterator<Item = &'b KeyHandle>) -> Self where
    'a: 'b, 
[src]

Only returns a key if it matches any of the specified handles.

Note: this function is cumulative. If you call this function (or key_handle) multiple times, then the iterator returns a key if it matches any of the specified handles.

pub fn subkeys(self) -> ValidKeyAmalgamationIter<'a, P, SubordinateRole>[src]

Changes the iterator to skip the primary key.

Trait Implementations

impl<'a, P, R> Debug for ValidKeyAmalgamationIter<'a, P, R> where
    P: KeyParts,
    R: KeyRole
[src]

impl<'a> Iterator for ValidKeyAmalgamationIter<'a, PublicParts, PrimaryRole>[src]

type Item = ValidPrimaryKeyAmalgamation<'a, PublicParts>

The type of the elements being iterated over.

impl<'a> Iterator for ValidKeyAmalgamationIter<'a, SecretParts, PrimaryRole>[src]

type Item = ValidPrimaryKeyAmalgamation<'a, SecretParts>

The type of the elements being iterated over.

impl<'a> Iterator for ValidKeyAmalgamationIter<'a, UnspecifiedParts, PrimaryRole>[src]

type Item = ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>

The type of the elements being iterated over.

impl<'a> Iterator for ValidKeyAmalgamationIter<'a, PublicParts, SubordinateRole>[src]

type Item = ValidSubordinateKeyAmalgamation<'a, PublicParts>

The type of the elements being iterated over.

impl<'a> Iterator for ValidKeyAmalgamationIter<'a, SecretParts, SubordinateRole>[src]

type Item = ValidSubordinateKeyAmalgamation<'a, SecretParts>

The type of the elements being iterated over.

impl<'a> Iterator for ValidKeyAmalgamationIter<'a, UnspecifiedParts, SubordinateRole>[src]

type Item = ValidSubordinateKeyAmalgamation<'a, UnspecifiedParts>

The type of the elements being iterated over.

impl<'a> Iterator for ValidKeyAmalgamationIter<'a, PublicParts, UnspecifiedRole>[src]

type Item = ValidErasedKeyAmalgamation<'a, PublicParts>

The type of the elements being iterated over.

impl<'a> Iterator for ValidKeyAmalgamationIter<'a, SecretParts, UnspecifiedRole>[src]

type Item = ValidErasedKeyAmalgamation<'a, SecretParts>

The type of the elements being iterated over.

impl<'a> Iterator for ValidKeyAmalgamationIter<'a, UnspecifiedParts, UnspecifiedRole>[src]

type Item = ValidErasedKeyAmalgamation<'a, UnspecifiedParts>

The type of the elements being iterated over.

Auto Trait Implementations

impl<'a, P, R> !RefUnwindSafe for ValidKeyAmalgamationIter<'a, P, R>

impl<'a, P, R> !Send for ValidKeyAmalgamationIter<'a, P, R>

impl<'a, P, R> !Sync for ValidKeyAmalgamationIter<'a, P, R>

impl<'a, P, R> Unpin for ValidKeyAmalgamationIter<'a, P, R> where
    P: Unpin,
    R: Unpin

impl<'a, P, R> !UnwindSafe for ValidKeyAmalgamationIter<'a, P, R>

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<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<I> IteratorRandom for I where
    I: Iterator
[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<I> UnicodeNormalization<I> for I where
    I: Iterator<Item = char>, 

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