[][src]Enum sequoia_openpgp::packet::Key

#[non_exhaustive]pub enum Key<P: KeyParts, R: KeyRole> {
    V4(Key4<P, R>),
}

Holds a public key, public subkey, private key or private subkey packet.

The different Key packets are described in Section 5.5 of RFC 4880.

Note: This enum cannot be exhaustively matched to allow future extensions.

Key Variants

There are four different types of keys in OpenPGP: public keys, secret keys, public subkeys, and secret subkeys. Although the semantics of each type of key are slightly different, the underlying representation is identical (even a public key and a secret key are the same: the public key variant just contains 0 bits of secret key material).

In Sequoia, we use a single type, Key, for all four variants. To improve type safety, we use marker traits rather than an enum to distinguish them. Specifically, we Key is generic over two type variables, P and R.

P and R take marker traits, which describe how any secret key material should be treated, and the key's role (primary or subordinate). The markers also determine the Key's behavior and the exposed functionality. P can be key::PublicParts, key::SecretParts, or key::UnspecifiedParts. And, R can be key::PrimaryRole, key::SubordinateRole, or key::UnspecifiedRole.

If P is key::PublicParts, any secret key material that is present is ignored. For instance, when serializing a key with this marker, any secret key material will be skipped. This is illutrated in the following example. If P is key::SecretParts, then the key definitely contains secret key material (although it is not guaranteed that the secret key material is valid), and methods that require secret key material are available.

Unlike P, R does not say anything about the Key's content. But, a key's role does influence's the key's semantics. For instance, some of a primary key's meta-data is located on the primary User ID whereas a subordinate key's meta-data is located on its binding signature.

The unspecified variants key::UnspecifiedParts and key::UnspecifiedRole exist to simplify type erasure, which is needed to mix different types of keys in a single collection. For instance, Cert::keys returns an iterator over the keys in a certificate. Since the keys have different roles (a primary key and zero or more subkeys), but the Iterator has to be over a single, fixed type, the returned keys use the key::UnspecifiedRole marker.

Examples

Serializing a public key with secret key material drops the secret key material:

use sequoia_openpgp as openpgp;
use openpgp::cert::prelude::*;
use openpgp::packet::prelude::*;
use sequoia_openpgp::parse::Parse;
use openpgp::serialize::Serialize;

// Generate a new certificate.  It has secret key material.
let (cert, _) = CertBuilder::new()
    .generate()?;

let pk = cert.primary_key().key();
assert!(pk.has_secret());

// Serializing a `Key<key::PublicParts, _>` drops the secret key
// material.
let mut bytes = Vec::new();
Packet::from(pk.clone()).serialize(&mut bytes);
let p : Packet = Packet::from_bytes(&bytes)?;

if let Packet::PublicKey(key) = p {
    assert!(! key.has_secret());
} else {
    unreachable!();
}

Conversions

Sometimes it is necessary to change a marker. For instance, to help prevent a user from inadvertently leaking secret key material, the Cert data structure never returns keys with the key::SecretParts marker. This means, to use any secret key material, e.g., when creating a Signer, the user needs to explicitly opt-in by changing the marker using Key::parts_into_secret or Key::parts_as_secret.

For P, the conversion functions are: Key::parts_into_public, Key::parts_as_public, Key::parts_into_secret, Key::parts_as_secret, Key::parts_into_unspecified, and Key::parts_as_unspecified. With the exception of converting P to key::SecretParts, these functions are infallible. Converting P to key::SecretParts may fail if the key doesn't have any secret key material. (Note: although the secret key material is required, it not checked for validity.)

For R, the conversion functions are Key::role_into_primary, Key::role_as_primary, Key::role_into_subordinate, Key::role_as_subordinate, Key::role_into_unspecified, and Key::role_as_unspecified.

It is also possible to use From.

Examples

Changing a marker:

use sequoia_openpgp as openpgp;
use openpgp::cert::prelude::*;
use openpgp::packet::prelude::*;

// Generate a new certificate.  It has secret key material.
let (cert, _) = CertBuilder::new()
    .generate()?;

let pk: &Key<key::PublicParts, key::PrimaryRole>
    = cert.primary_key().key();
// `has_secret`s is one of the few methods that ignores the
// parts type.
assert!(pk.has_secret());

// Treat it like a secret key.  This only works if `pk` really
// has secret key material (which it does in this case, see above).
let sk = pk.parts_as_secret()?;
assert!(sk.has_secret());

// And back.
let pk = sk.parts_as_public();
// Yes, the secret key material is still there.
assert!(pk.has_secret());

The Cert data structure only returns public keys. To work with any secret key material, the Key first needs to be converted to a secret key. This is necessary, for instance, when creating a Signer:

use std::time;
use sequoia_openpgp as openpgp;
use openpgp::cert::prelude::*;
use openpgp::crypto::KeyPair;
use openpgp::policy::StandardPolicy;

let p = &StandardPolicy::new();

let the_past = time::SystemTime::now() - time::Duration::from_secs(1);
let (cert, _) = CertBuilder::new()
    .set_creation_time(the_past)
    .generate()?;

// Set the certificate to expire now.  To do this, we need
// to create a new self-signature, and sign it using a
// certification-capable key.  The primary key is always
// certification capable.
let mut keypair = cert.primary_key()
    .key().clone().parts_into_secret()?.into_keypair()?;
let sigs = cert.set_expiration_time(p, None, &mut keypair,
                                    Some(time::SystemTime::now()))?;

let cert = cert.insert_packets(sigs)?;
// It's expired now.
assert!(cert.with_policy(p, None)?.alive().is_err());

Key Generation

Key is a wrapper around the different key formats. (Currently, Sequoia only supports version 4 keys, however, future versions may add limited support for version 3 keys to facilitate working with achieved messages, and RFC 4880bis includes a proposal for a new key format.) As such, it doesn't provide a mechanism to generate keys or import existing key material. Instead, use the format-specific functions (e.g., Key4::generate_ecc) and then convert the result into a Key packet, as the following example demonstrates.

Examples

use sequoia_openpgp as openpgp;
use openpgp::packet::prelude::*;
use openpgp::types::Curve;

let key: Key<key::SecretParts, key::PrimaryRole>
    = Key::from(Key4::generate_ecc(true, Curve::Ed25519)?);

Password Protection

OpenPGP provides a mechanism to password protect keys. If a key is password protected, you need to decrypt the password using Key::decrypt_secret before using its secret key material (e.g., to decrypt a message, or to generate a signature).

A note on equality

The implementation of Eq for Key compares the serialized form of Keys. Notably this includes the secret key material, but excludes the KeyParts and KeyRole marker traits. To exclude the secret key material from the comparison, use Key::public_cmp or Key::public_eq.

When merging in secret key material from untrusted sources, you need to be very careful: secret key material is not cryptographically protected by the key's self signature. Thus, an attacker can provide a valid key with a valid self signature, but invalid secret key material. If naively merged, this could overwrite valid secret key material, and thereby render the key useless. Unfortunately, the only way to find out that the secret key material is bad is to actually try using it. But, because the secret key material is usually encrypted, this can't always be done automatically.

Compare:

use sequoia_openpgp as openpgp;
use openpgp::cert::prelude::*;
use openpgp::packet::prelude::*;

// Generate a new certificate.  It has secret key material.
let (cert, _) = CertBuilder::new()
    .generate()?;

let sk = cert.primary_key().key();
assert!(sk.has_secret());

// Strip the secret key material.
let cert = cert.clone().strip_secret_key_material();
let pk = cert.primary_key().key();
assert!(! pk.has_secret());

// Eq compares both the public and the secret bits, so it
// considers pk and sk to be different.
assert_ne!(pk, sk);

// Key::public_eq only compares the public bits, so it considers
// them to be equal.
assert!(Key::public_eq(pk, sk));

Variants (Non-exhaustive)

Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
V4(Key4<P, R>)

A version 4 Key packet.

Implementations

impl<P: KeyParts, R: KeyRole> Key<P, R>[src]

pub fn encrypt(&self, data: &SessionKey) -> Result<Ciphertext>[src]

Encrypts the given data with this key.

pub fn verify(&self, sig: &Signature, digest: &[u8]) -> Result<()>[src]

Verifies the given signature.

impl<P, R> Key<P, R> where
    P: KeyParts,
    R: KeyRole
[src]

pub fn parts_into_public(self) -> Key<PublicParts, R>[src]

Changes the key's parts tag to PublicParts.

pub fn parts_as_public(&self) -> &Key<PublicParts, R>[src]

Changes the key's parts tag to PublicParts.

pub fn parts_into_secret(self) -> Result<Key<SecretParts, R>>[src]

Changes the key's parts tag to SecretParts.

pub fn parts_as_secret(&self) -> Result<&Key<SecretParts, R>>[src]

Changes the key's parts tag to SecretParts.

pub fn parts_into_unspecified(self) -> Key<UnspecifiedParts, R>[src]

Changes the key's parts tag to UnspecifiedParts.

pub fn parts_as_unspecified(&self) -> &Key<UnspecifiedParts, R>[src]

Changes the key's parts tag to UnspecifiedParts.

impl<P, R> Key<P, R> where
    P: KeyParts,
    R: KeyRole
[src]

pub fn role_into_primary(self) -> Key<P, PrimaryRole>[src]

Changes the key's role tag to PrimaryRole.

pub fn role_as_primary(&self) -> &Key<P, PrimaryRole>[src]

Changes the key's role tag to PrimaryRole.

pub fn role_into_subordinate(self) -> Key<P, SubordinateRole>[src]

Changes the key's role tag to SubordinateRole.

pub fn role_as_subordinate(&self) -> &Key<P, SubordinateRole>[src]

Changes the key's role tag to SubordinateRole.

pub fn role_into_unspecified(self) -> Key<P, UnspecifiedRole>[src]

Changes the key's role tag to UnspecifiedRole.

pub fn role_as_unspecified(&self) -> &Key<P, UnspecifiedRole>[src]

Changes the key's role tag to UnspecifiedRole.

impl<P: KeyParts, R: KeyRole> Key<P, R>[src]

pub fn version(&self) -> u8[src]

Gets the version.

pub fn public_cmp<PB, RB>(&self, b: &Key<PB, RB>) -> Ordering where
    PB: KeyParts,
    RB: KeyRole
[src]

Compares the public bits of two keys.

This returns Ordering::Equal if the public MPIs, version, creation time and algorithm of the two Keys match. This does not consider the packet's encoding, packet's tag or the secret key material.

pub fn public_eq<PB, RB>(&self, b: &Key<PB, RB>) -> bool where
    PB: KeyParts,
    RB: KeyRole
[src]

This method tests for self and other values to be equal modulo the secret key material.

This returns true if the public MPIs, creation time and algorithm of the two Keys match. This does not consider the packet's encoding, packet's tag or the secret key material.

impl<R: KeyRole> Key<SecretParts, R>[src]

pub fn into_keypair(self) -> Result<KeyPair>[src]

Creates a new key pair from a Key with an unencrypted secret key.

If the Key is password protected, you first need to decrypt it using Key::decrypt_secret.

Errors

Fails if the secret key is encrypted.

Examples

Revoke a certificate by signing a new revocation certificate:

use std::time;
use sequoia_openpgp as openpgp;
use openpgp::cert::prelude::*;
use openpgp::crypto::KeyPair;
use openpgp::types::ReasonForRevocation;

// Generate a certificate.
let (cert, _) =
    CertBuilder::general_purpose(None,
                                 Some("Alice Lovelace <alice@example.org>"))
        .generate()?;

// Use the secret key material to sign a revocation certificate.
let mut keypair = cert.primary_key()
    .key().clone().parts_into_secret()?
    .into_keypair()?;
let rev = cert.revoke(&mut keypair,
                      ReasonForRevocation::KeyCompromised,
                      b"It was the maid :/")?;

pub fn decrypt_secret(self, password: &Password) -> Result<Self>[src]

Decrypts the secret key material.

In OpenPGP, secret key material can be protected with a password. The password is usually hardened using a KDF.

This function takes ownership of the Key, decrypts the secret key material using the password, and returns a new key whose secret key material is not password protected.

If the secret key material is not password protected or if the password is wrong, this function returns an error.

Examples

Sign a new revocation certificate using a password-protected key:

use sequoia_openpgp as openpgp;
use openpgp::cert::prelude::*;
use openpgp::types::ReasonForRevocation;

// Generate a certificate whose secret key material is
// password protected.
let (cert, _) =
    CertBuilder::general_purpose(None,
                                 Some("Alice Lovelace <alice@example.org>"))
        .set_password(Some("1234".into()))
        .generate()?;

// Use the secret key material to sign a revocation certificate.
let key = cert.primary_key().key().clone().parts_into_secret()?;

// We can't turn it into a keypair without decrypting it.
assert!(key.clone().into_keypair().is_err());

// And, we need to use the right password.
assert!(key.clone()
    .decrypt_secret(&"correct horse battery staple".into())
    .is_err());

// Let's do it right:
let mut keypair = key.decrypt_secret(&"1234".into())?.into_keypair()?;
let rev = cert.revoke(&mut keypair,
                      ReasonForRevocation::KeyCompromised,
                      b"It was the maid :/")?;

pub fn encrypt_secret(self, password: &Password) -> Result<Self>[src]

Encrypts the secret key material.

In OpenPGP, secret key material can be protected with a password. The password is usually hardened using a KDF.

This function takes ownership of the Key, encrypts the secret key material using the password, and returns a new key whose secret key material is protected with the password.

If the secret key material is already password protected, this function returns an error.

Examples

Encrypt the primary key:

use sequoia_openpgp as openpgp;
use openpgp::cert::prelude::*;
use openpgp::packet::Packet;

// Generate a certificate whose secret key material is
// not password protected.
let (cert, _) =
    CertBuilder::general_purpose(None,
                                 Some("Alice Lovelace <alice@example.org>"))
        .generate()?;
let key = cert.primary_key().key().clone().parts_into_secret()?;
assert!(key.has_unencrypted_secret());

// Encrypt the key's secret key material.
let key = key.encrypt_secret(&"1234".into())?;
assert!(! key.has_unencrypted_secret());

// Merge it into the certificate.  Note: `Cert::insert_packets`
// prefers added versions of keys.  So, the encrypted version
// will override the decrypted version.
let cert = cert.insert_packets(Packet::from(key))?;

// Now the primary key's secret key material is encrypted.
let key = cert.primary_key().key().parts_as_secret()?;
assert!(! key.has_unencrypted_secret());

// We can't turn it into a keypair without decrypting it.
assert!(key.clone().into_keypair().is_err());

// And, we need to use the right password.
assert!(key.clone()
    .decrypt_secret(&"correct horse battery staple".into())
    .is_err());

// Let's do it right:
let mut keypair = key.clone()
    .decrypt_secret(&"1234".into())?.into_keypair()?;

impl<R: KeyRole> Key<PublicParts, R>[src]

Secret key handling.

pub fn take_secret(self) -> (Key<PublicParts, R>, Option<SecretKeyMaterial>)[src]

Takes the key packet's SecretKeyMaterial, if any.

pub fn add_secret(
    self,
    secret: SecretKeyMaterial
) -> (Key<SecretParts, R>, Option<SecretKeyMaterial>)
[src]

Adds SecretKeyMaterial to the packet, returning the old if any.

impl<R: KeyRole> Key<UnspecifiedParts, R>[src]

Secret key handling.

pub fn take_secret(self) -> (Key<PublicParts, R>, Option<SecretKeyMaterial>)[src]

Takes the key packet's SecretKeyMaterial, if any.

pub fn add_secret(
    self,
    secret: SecretKeyMaterial
) -> (Key<SecretParts, R>, Option<SecretKeyMaterial>)
[src]

Adds SecretKeyMaterial to the packet, returning the old if any.

impl<R: KeyRole> Key<SecretParts, R>[src]

Secret key handling.

pub fn take_secret(self) -> (Key<PublicParts, R>, SecretKeyMaterial)[src]

Takes the key packet's SecretKeyMaterial.

pub fn add_secret(
    self,
    secret: SecretKeyMaterial
) -> (Key<SecretParts, R>, SecretKeyMaterial)
[src]

Adds SecretKeyMaterial to the packet, returning the old.

impl<P: KeyParts> Key<P, SubordinateRole>[src]

pub fn bind(
    &self,
    signer: &mut dyn Signer,
    cert: &Cert,
    signature: SignatureBuilder
) -> Result<Signature>
[src]

Creates a binding signature.

The signature binds this subkey to cert. signer will be used to create a signature using signature as builder. Thehash_algo defaults to SHA512, creation_time to the current time.

Note that subkeys with signing capabilities need a primary key binding signature. If you are creating this binding signature from a previous binding signature, you can reuse the primary key binding signature if it is still valid and meets current algorithm requirements. Otherwise, you can create one using SignatureBuilder::sign_primary_key_binding.

This function adds a creation time subpacket, a issuer fingerprint subpacket, and a issuer subpacket to the signature.

Examples

This example demonstrates how to bind this key to a Cert. Note that in general, the CertBuilder is a better way to add subkeys to a Cert.

use sequoia_openpgp::policy::StandardPolicy;
let p = &StandardPolicy::new();

// Generate a Cert, and create a keypair from the primary key.
let (cert, _) = CertBuilder::new().generate()?;
let mut keypair = cert.primary_key().key().clone()
    .parts_into_secret()?.into_keypair()?;

// Let's add an encryption subkey.
let flags = KeyFlags::empty().set_storage_encryption();
assert_eq!(cert.keys().with_policy(p, None).alive().revoked(false)
               .key_flags(&flags).count(),
           0);

// Generate a subkey and a binding signature.
let subkey: Key<_, key::SubordinateRole> =
    Key4::generate_ecc(false, Curve::Cv25519)?
    .into();
let builder = signature::SignatureBuilder::new(SignatureType::SubkeyBinding)
    .set_key_flags(&flags)?;
let binding = subkey.bind(&mut keypair, &cert, builder)?;

// Now merge the key and binding signature into the Cert.
let cert = cert.insert_packets(vec![Packet::from(subkey),
                                   binding.into()])?;

// Check that we have an encryption subkey.
assert_eq!(cert.keys().with_policy(p, None).alive().revoked(false)
               .key_flags(flags).count(),
           1);

Methods from Deref<Target = Key4<P, R>>

pub fn parts_as_public(&self) -> &Key4<PublicParts, R>[src]

Changes the key's parts tag to PublicParts.

pub fn parts_as_secret(&self) -> Result<&Key4<SecretParts, R>>[src]

Changes the key's parts tag to SecretParts.

pub fn parts_as_unspecified(&self) -> &Key4<UnspecifiedParts, R>[src]

Changes the key's parts tag to UnspecifiedParts.

pub fn role_as_primary(&self) -> &Key4<P, PrimaryRole>[src]

Changes the key's role tag to PrimaryRole.

pub fn role_as_subordinate(&self) -> &Key4<P, SubordinateRole>[src]

Changes the key's role tag to SubordinateRole.

pub fn role_as_unspecified(&self) -> &Key4<P, UnspecifiedRole>[src]

Changes the key's role tag to UnspecifiedRole.

pub fn public_cmp<PB, RB>(&self, b: &Key4<PB, RB>) -> Ordering where
    PB: KeyParts,
    RB: KeyRole
[src]

Compares the public bits of two keys.

This returns Ordering::Equal if the public MPIs, creation time, and algorithm of the two Key4s match. This does not consider the packets' encodings, packets' tags or their secret key material.

pub fn public_eq<PB, RB>(&self, b: &Key4<PB, RB>) -> bool where
    PB: KeyParts,
    RB: KeyRole
[src]

Tests whether two keys are equal modulo their secret key material.

This returns true if the public MPIs, creation time and algorithm of the two Key4s match. This does not consider the packets' encodings, packets' tags or their secret key material.

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

Gets the Key's creation time.

pub fn set_creation_time<T>(&mut self, timestamp: T) -> Result<SystemTime> where
    T: Into<SystemTime>, 
[src]

Sets the Key's creation time.

timestamp is converted to OpenPGP's internal format, Timestamp: a 32-bit quantity containing the number of seconds since the Unix epoch.

timestamp is silently rounded to match the internal resolution. An error is returned if timestamp is out of range.

pub fn pk_algo(&self) -> PublicKeyAlgorithm[src]

Gets the public key algorithm.

pub fn set_pk_algo(&mut self, pk_algo: PublicKeyAlgorithm) -> PublicKeyAlgorithm[src]

Sets the public key algorithm.

Returns the old public key algorithm.

pub fn mpis(&self) -> &PublicKey[src]

Returns a reference to the Key's MPIs.

pub fn mpis_mut(&mut self) -> &mut PublicKey[src]

Returns a mutable reference to the Key's MPIs.

pub fn set_mpis(&mut self, mpis: PublicKey) -> PublicKey[src]

Sets the Key's MPIs.

This function returns the old MPIs, if any.

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

Returns whether the Key contains secret key material.

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

Returns whether the Key contains unencrypted secret key material.

This returns false if the Key doesn't contain any secret key material.

pub fn optional_secret(&self) -> Option<&SecretKeyMaterial>[src]

Returns Key's secret key material, if any.

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

Computes and returns the Key's Fingerprint and returns it as a KeyHandle.

See Section 12.2 of RFC 4880.

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

Computes and returns the Key's Fingerprint.

See Section 12.2 of RFC 4880.

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

Computes and returns the Key's Key ID.

See Section 12.2 of RFC 4880.

pub fn secret(&self) -> &SecretKeyMaterial[src]

Gets the Key's SecretKeyMaterial.

pub fn secret_mut(&mut self) -> &mut SecretKeyMaterial[src]

Gets a mutable reference to the Key's SecretKeyMaterial.

Trait Implementations

impl<P: Clone + KeyParts, R: Clone + KeyRole> Clone for Key<P, R>[src]

impl<P: Debug + KeyParts, R: Debug + KeyRole> Debug for Key<P, R>[src]

impl<P: KeyParts, R: KeyRole> Deref for Key<P, R>[src]

type Target = Key4<P, R>

The resulting type after dereferencing.

impl<P: KeyParts, R: KeyRole> DerefMut for Key<P, R>[src]

impl<P: KeyParts, R: KeyRole> Display for Key<P, R>[src]

impl<P: Eq + KeyParts, R: Eq + KeyRole> Eq for Key<P, R>[src]

impl<P, '_, '_> From<&'_ Key<P, PrimaryRole>> for &'_ Key<P, SubordinateRole> where
    P: KeyParts
[src]

impl<P, '_, '_> From<&'_ Key<P, PrimaryRole>> for &'_ Key<P, UnspecifiedRole> where
    P: KeyParts
[src]

impl<P, '_, '_> From<&'_ Key<P, SubordinateRole>> for &'_ Key<P, PrimaryRole> where
    P: KeyParts
[src]

impl<P, '_, '_> From<&'_ Key<P, SubordinateRole>> for &'_ Key<P, UnspecifiedRole> where
    P: KeyParts
[src]

impl<P, '_, '_> From<&'_ Key<P, UnspecifiedRole>> for &'_ Key<P, PrimaryRole> where
    P: KeyParts
[src]

impl<P, '_, '_> From<&'_ Key<P, UnspecifiedRole>> for &'_ Key<P, SubordinateRole> where
    P: KeyParts
[src]

impl<'_, '_> From<&'_ Key<PublicParts, PrimaryRole>> for &'_ Key<SecretParts, SubordinateRole>[src]

impl<'_, '_> From<&'_ Key<PublicParts, PrimaryRole>> for &'_ Key<SecretParts, UnspecifiedRole>[src]

impl<'_, '_> From<&'_ Key<PublicParts, PrimaryRole>> for &'_ Key<UnspecifiedParts, SubordinateRole>[src]

impl<'_, '_> From<&'_ Key<PublicParts, PrimaryRole>> for &'_ Key<UnspecifiedParts, UnspecifiedRole>[src]

impl<R, '_, '_> From<&'_ Key<PublicParts, R>> for &'_ Key<UnspecifiedParts, R> where
    R: KeyRole
[src]

impl<'_, '_> From<&'_ Key<PublicParts, SubordinateRole>> for &'_ Key<SecretParts, PrimaryRole>[src]

impl<'_, '_> From<&'_ Key<PublicParts, SubordinateRole>> for &'_ Key<SecretParts, UnspecifiedRole>[src]

impl<'_, '_> From<&'_ Key<PublicParts, SubordinateRole>> for &'_ Key<UnspecifiedParts, PrimaryRole>[src]

impl<'_, '_> From<&'_ Key<PublicParts, SubordinateRole>> for &'_ Key<UnspecifiedParts, UnspecifiedRole>[src]

impl<'_, '_> From<&'_ Key<PublicParts, UnspecifiedRole>> for &'_ Key<SecretParts, PrimaryRole>[src]

impl<'_, '_> From<&'_ Key<PublicParts, UnspecifiedRole>> for &'_ Key<SecretParts, SubordinateRole>[src]

impl<'_, '_> From<&'_ Key<PublicParts, UnspecifiedRole>> for &'_ Key<UnspecifiedParts, PrimaryRole>[src]

impl<'_, '_> From<&'_ Key<PublicParts, UnspecifiedRole>> for &'_ Key<UnspecifiedParts, SubordinateRole>[src]

impl<'_, '_> From<&'_ Key<SecretParts, PrimaryRole>> for &'_ Key<PublicParts, SubordinateRole>[src]

impl<'_, '_> From<&'_ Key<SecretParts, PrimaryRole>> for &'_ Key<PublicParts, UnspecifiedRole>[src]

impl<'_, '_> From<&'_ Key<SecretParts, PrimaryRole>> for &'_ Key<UnspecifiedParts, SubordinateRole>[src]

impl<'_, '_> From<&'_ Key<SecretParts, PrimaryRole>> for &'_ Key<UnspecifiedParts, UnspecifiedRole>[src]

impl<R, '_, '_> From<&'_ Key<SecretParts, R>> for &'_ Key<PublicParts, R> where
    R: KeyRole
[src]

impl<R, '_, '_> From<&'_ Key<SecretParts, R>> for &'_ Key<UnspecifiedParts, R> where
    R: KeyRole
[src]

impl<'_, '_> From<&'_ Key<SecretParts, SubordinateRole>> for &'_ Key<PublicParts, PrimaryRole>[src]

impl<'_, '_> From<&'_ Key<SecretParts, SubordinateRole>> for &'_ Key<PublicParts, UnspecifiedRole>[src]

impl<'_, '_> From<&'_ Key<SecretParts, SubordinateRole>> for &'_ Key<UnspecifiedParts, PrimaryRole>[src]

impl<'_, '_> From<&'_ Key<SecretParts, SubordinateRole>> for &'_ Key<UnspecifiedParts, UnspecifiedRole>[src]

impl<'_, '_> From<&'_ Key<SecretParts, UnspecifiedRole>> for &'_ Key<PublicParts, PrimaryRole>[src]

impl<'_, '_> From<&'_ Key<SecretParts, UnspecifiedRole>> for &'_ Key<PublicParts, SubordinateRole>[src]

impl<'_, '_> From<&'_ Key<SecretParts, UnspecifiedRole>> for &'_ Key<UnspecifiedParts, PrimaryRole>[src]

impl<'_, '_> From<&'_ Key<SecretParts, UnspecifiedRole>> for &'_ Key<UnspecifiedParts, SubordinateRole>[src]

impl<'_, '_> From<&'_ Key<UnspecifiedParts, PrimaryRole>> for &'_ Key<PublicParts, SubordinateRole>[src]

impl<'_, '_> From<&'_ Key<UnspecifiedParts, PrimaryRole>> for &'_ Key<PublicParts, UnspecifiedRole>[src]

impl<'_, '_> From<&'_ Key<UnspecifiedParts, PrimaryRole>> for &'_ Key<SecretParts, SubordinateRole>[src]

impl<'_, '_> From<&'_ Key<UnspecifiedParts, PrimaryRole>> for &'_ Key<SecretParts, UnspecifiedRole>[src]

impl<R, '_, '_> From<&'_ Key<UnspecifiedParts, R>> for &'_ Key<PublicParts, R> where
    R: KeyRole
[src]

impl<'_, '_> From<&'_ Key<UnspecifiedParts, SubordinateRole>> for &'_ Key<PublicParts, PrimaryRole>[src]

impl<'_, '_> From<&'_ Key<UnspecifiedParts, SubordinateRole>> for &'_ Key<PublicParts, UnspecifiedRole>[src]

impl<'_, '_> From<&'_ Key<UnspecifiedParts, SubordinateRole>> for &'_ Key<SecretParts, PrimaryRole>[src]

impl<'_, '_> From<&'_ Key<UnspecifiedParts, SubordinateRole>> for &'_ Key<SecretParts, UnspecifiedRole>[src]

impl<'_, '_> From<&'_ Key<UnspecifiedParts, UnspecifiedRole>> for &'_ Key<PublicParts, PrimaryRole>[src]

impl<'_, '_> From<&'_ Key<UnspecifiedParts, UnspecifiedRole>> for &'_ Key<PublicParts, SubordinateRole>[src]

impl<'_, '_> From<&'_ Key<UnspecifiedParts, UnspecifiedRole>> for &'_ Key<SecretParts, PrimaryRole>[src]

impl<'_, '_> From<&'_ Key<UnspecifiedParts, UnspecifiedRole>> for &'_ Key<SecretParts, SubordinateRole>[src]

impl<'a, P, R> From<&'a Key<P, R>> for Recipient<'a> where
    P: KeyParts,
    R: KeyRole
[src]

impl<P> From<Key<P, PrimaryRole>> for Key<P, SubordinateRole> where
    P: KeyParts
[src]

impl<P> From<Key<P, PrimaryRole>> for Key<P, UnspecifiedRole> where
    P: KeyParts
[src]

impl<P> From<Key<P, SubordinateRole>> for Key<P, PrimaryRole> where
    P: KeyParts
[src]

impl<P> From<Key<P, SubordinateRole>> for Key<P, UnspecifiedRole> where
    P: KeyParts
[src]

impl<P> From<Key<P, UnspecifiedRole>> for Key<P, PrimaryRole> where
    P: KeyParts
[src]

impl<P> From<Key<P, UnspecifiedRole>> for Key<P, SubordinateRole> where
    P: KeyParts
[src]

impl From<Key<PublicParts, PrimaryRole>> for Key<SecretParts, SubordinateRole>[src]

impl From<Key<PublicParts, PrimaryRole>> for Key<SecretParts, UnspecifiedRole>[src]

impl From<Key<PublicParts, PrimaryRole>> for Key<UnspecifiedParts, SubordinateRole>[src]

impl From<Key<PublicParts, PrimaryRole>> for Key<UnspecifiedParts, UnspecifiedRole>[src]

impl From<Key<PublicParts, PrimaryRole>> for Packet[src]

fn from(k: Key<PublicParts, PrimaryRole>) -> Self[src]

Convert the Key struct to a Packet.

impl<R> From<Key<PublicParts, R>> for Key<UnspecifiedParts, R> where
    R: KeyRole
[src]

impl From<Key<PublicParts, SubordinateRole>> for Key<SecretParts, PrimaryRole>[src]

impl From<Key<PublicParts, SubordinateRole>> for Key<SecretParts, UnspecifiedRole>[src]

impl From<Key<PublicParts, SubordinateRole>> for Key<UnspecifiedParts, PrimaryRole>[src]

impl From<Key<PublicParts, SubordinateRole>> for Key<UnspecifiedParts, UnspecifiedRole>[src]

impl From<Key<PublicParts, SubordinateRole>> for Packet[src]

fn from(k: Key<PublicParts, SubordinateRole>) -> Self[src]

Convert the Key struct to a Packet.

impl From<Key<PublicParts, UnspecifiedRole>> for Key<SecretParts, PrimaryRole>[src]

impl From<Key<PublicParts, UnspecifiedRole>> for Key<SecretParts, SubordinateRole>[src]

impl From<Key<PublicParts, UnspecifiedRole>> for Key<UnspecifiedParts, PrimaryRole>[src]

impl From<Key<PublicParts, UnspecifiedRole>> for Key<UnspecifiedParts, SubordinateRole>[src]

impl From<Key<SecretParts, PrimaryRole>> for Key<PublicParts, SubordinateRole>[src]

impl From<Key<SecretParts, PrimaryRole>> for Key<PublicParts, UnspecifiedRole>[src]

impl From<Key<SecretParts, PrimaryRole>> for Key<UnspecifiedParts, SubordinateRole>[src]

impl From<Key<SecretParts, PrimaryRole>> for Key<UnspecifiedParts, UnspecifiedRole>[src]

impl From<Key<SecretParts, PrimaryRole>> for Packet[src]

fn from(k: Key<SecretParts, PrimaryRole>) -> Self[src]

Convert the Key struct to a Packet.

impl<R> From<Key<SecretParts, R>> for Key<PublicParts, R> where
    R: KeyRole
[src]

impl<R> From<Key<SecretParts, R>> for Key<UnspecifiedParts, R> where
    R: KeyRole
[src]

impl From<Key<SecretParts, SubordinateRole>> for Key<PublicParts, PrimaryRole>[src]

impl From<Key<SecretParts, SubordinateRole>> for Key<PublicParts, UnspecifiedRole>[src]

impl From<Key<SecretParts, SubordinateRole>> for Key<UnspecifiedParts, PrimaryRole>[src]

impl From<Key<SecretParts, SubordinateRole>> for Key<UnspecifiedParts, UnspecifiedRole>[src]

impl From<Key<SecretParts, SubordinateRole>> for Packet[src]

fn from(k: Key<SecretParts, SubordinateRole>) -> Self[src]

Convert the Key struct to a Packet.

impl From<Key<SecretParts, UnspecifiedRole>> for Key<PublicParts, PrimaryRole>[src]

impl From<Key<SecretParts, UnspecifiedRole>> for Key<PublicParts, SubordinateRole>[src]

impl From<Key<SecretParts, UnspecifiedRole>> for Key<UnspecifiedParts, PrimaryRole>[src]

impl From<Key<SecretParts, UnspecifiedRole>> for Key<UnspecifiedParts, SubordinateRole>[src]

impl From<Key<UnspecifiedParts, PrimaryRole>> for Key<PublicParts, SubordinateRole>[src]

impl From<Key<UnspecifiedParts, PrimaryRole>> for Key<PublicParts, UnspecifiedRole>[src]

impl From<Key<UnspecifiedParts, PrimaryRole>> for Key<SecretParts, SubordinateRole>[src]

impl From<Key<UnspecifiedParts, PrimaryRole>> for Key<SecretParts, UnspecifiedRole>[src]

impl<R> From<Key<UnspecifiedParts, R>> for Key<PublicParts, R> where
    R: KeyRole
[src]

impl From<Key<UnspecifiedParts, SubordinateRole>> for Key<PublicParts, PrimaryRole>[src]

impl From<Key<UnspecifiedParts, SubordinateRole>> for Key<PublicParts, UnspecifiedRole>[src]

impl From<Key<UnspecifiedParts, SubordinateRole>> for Key<SecretParts, PrimaryRole>[src]

impl From<Key<UnspecifiedParts, SubordinateRole>> for Key<SecretParts, UnspecifiedRole>[src]

impl From<Key<UnspecifiedParts, UnspecifiedRole>> for Key<PublicParts, PrimaryRole>[src]

impl From<Key<UnspecifiedParts, UnspecifiedRole>> for Key<PublicParts, SubordinateRole>[src]

impl From<Key<UnspecifiedParts, UnspecifiedRole>> for Key<SecretParts, PrimaryRole>[src]

impl From<Key<UnspecifiedParts, UnspecifiedRole>> for Key<SecretParts, SubordinateRole>[src]

impl<P, R> From<Key4<P, R>> for Key<P, R> where
    P: KeyParts,
    R: KeyRole
[src]

impl From<KeyPair> for Key<SecretParts, UnspecifiedRole>[src]

impl<P: Hash + KeyParts, R: Hash + KeyRole> Hash for Key<P, R>[src]

impl<P, R> IntoIterator for Key<P, R> where
    P: KeyParts,
    R: KeyRole
[src]

Implement IntoIterator so that cert::insert_packets(sig) just works.

type Item = Key<P, R>

The type of the elements being iterated over.

type IntoIter = Once<Key<P, R>>

Which kind of iterator are we turning this into?

impl<P: KeyParts, R: KeyRole> Marshal for Key<P, R>[src]

impl<P: KeyParts, R: KeyRole> MarshalInto for Key<P, R>[src]

impl<'a> Parse<'a, Key<UnspecifiedParts, UnspecifiedRole>> for Key<UnspecifiedParts, UnspecifiedRole>[src]

impl<P: PartialEq + KeyParts, R: PartialEq + KeyRole> PartialEq<Key<P, R>> for Key<P, R>[src]

impl<P: KeyParts, R: KeyRole> StructuralEq for Key<P, R>[src]

impl<P: KeyParts, R: KeyRole> StructuralPartialEq for Key<P, R>[src]

impl<R, '_, '_> TryFrom<&'_ Key<PublicParts, R>> for &'_ Key<SecretParts, R> where
    R: KeyRole
[src]

type Error = Error

The type returned in the event of a conversion error.

impl<R, '_, '_> TryFrom<&'_ Key<UnspecifiedParts, R>> for &'_ Key<SecretParts, R> where
    R: KeyRole
[src]

type Error = Error

The type returned in the event of a conversion error.

impl<R> TryFrom<Key<PublicParts, R>> for Key<SecretParts, R> where
    R: KeyRole
[src]

type Error = Error

The type returned in the event of a conversion error.

impl<R> TryFrom<Key<UnspecifiedParts, R>> for Key<SecretParts, R> where
    R: KeyRole
[src]

type Error = Error

The type returned in the event of a conversion error.

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]

impl<'a, P> ValidateAmalgamation<'a, Key<P, PrimaryRole>> for PrimaryKeyAmalgamation<'a, P> where
    P: 'a + KeyParts
[src]

type V = ValidPrimaryKeyAmalgamation<'a, P>

The type returned by with_policy. Read more

impl<'a, P> ValidateAmalgamation<'a, Key<P, PrimaryRole>> for ValidPrimaryKeyAmalgamation<'a, P> where
    P: 'a + KeyParts
[src]

type V = Self

The type returned by with_policy. Read more

impl<'a, P> ValidateAmalgamation<'a, Key<P, SubordinateRole>> for SubordinateKeyAmalgamation<'a, P> where
    P: 'a + KeyParts
[src]

type V = ValidSubordinateKeyAmalgamation<'a, P>

The type returned by with_policy. Read more

impl<'a, P> ValidateAmalgamation<'a, Key<P, SubordinateRole>> for ValidSubordinateKeyAmalgamation<'a, P> where
    P: 'a + KeyParts
[src]

type V = Self

The type returned by with_policy. Read more

impl<'a, P> ValidateAmalgamation<'a, Key<P, UnspecifiedRole>> for ErasedKeyAmalgamation<'a, P> where
    P: 'a + KeyParts
[src]

type V = ValidErasedKeyAmalgamation<'a, P>

The type returned by with_policy. Read more

impl<'a, P> ValidateAmalgamation<'a, Key<P, UnspecifiedRole>> for ValidErasedKeyAmalgamation<'a, P> where
    P: 'a + KeyParts
[src]

type V = Self

The type returned by with_policy. Read more

Auto Trait Implementations

impl<P, R> RefUnwindSafe for Key<P, R> where
    P: RefUnwindSafe,
    R: RefUnwindSafe

impl<P, R> Send for Key<P, R> where
    P: Send,
    R: Send

impl<P, R> Sync for Key<P, R> where
    P: Sync,
    R: Sync

impl<P, R> Unpin for Key<P, R> where
    P: Unpin,
    R: Unpin

impl<P, R> UnwindSafe for Key<P, R> where
    P: UnwindSafe,
    R: UnwindSafe

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> DynClone for T where
    T: Clone
[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<T> Same<T> for T

type Output = T

Should always be Self

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.