[][src]Struct sequoia_openpgp::packet::Key

pub struct Key { /* fields omitted */ }

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

See Section 5.5 of RFC 4880 for details.

Methods

impl Key[src]

pub fn hash<H: Hash + Write>(&self, hash: &mut H)[src]

Update the Hash with a hash of the key.

impl Key[src]

pub fn new(pk_algo: PublicKeyAlgorithm) -> Result<Self>[src]

Returns a new Key packet. This can be used to hold either a public key, a public subkey, a private key, or a private subkey.

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

Gets the key packet's version field.

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

Gets the key packet's creation time field.

pub fn set_creation_time(&mut self, timestamp: Tm)[src]

Sets the key packet's creation time field.

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

Gets the public key algorithm.

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

Sets the public key algorithm.

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

Gets the key packet's MPIs.

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

Gets a mutable reference to the key packet's MPIs.

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

Sets the key packet's MPIs.

pub fn secret(&self) -> Option<&SecretKey>[src]

Gets the key packet's SecretKey.

pub fn secret_mut(&mut self) -> Option<&mut SecretKey>[src]

Gets a mutable reference to the key packet's SecretKey.

pub fn set_secret(&mut self, secret: Option<SecretKey>)[src]

Sets the key packet's SecretKey.

pub fn to_packet(self, tag: Tag) -> Packet[src]

Convert the Key struct to a Packet.

impl Key[src]

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

Computes and returns the key's fingerprint as per Section 12.2 of RFC 4880.

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

Computes and returns the key's key ID as per Section 12.2 of RFC 4880.

Trait Implementations

impl SerializeKey for Key[src]

fn serialize<W: Write>(&self, o: &mut W, tag: Tag) -> Result<()>[src]

Writes a serialized version of the specified Key packet to o.

Errors

Returns Error::InvalidArgument if invoked on a non-version 4 key.

fn to_vec(&self, tag: Tag) -> Result<Vec<u8>>[src]

Serializes the packet to a vector.

impl Eq for Key[src]

impl PartialEq<Key> for Key[src]

impl Clone for Key[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Display for Key[src]

impl Hash for Key[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Debug for Key[src]

Auto Trait Implementations

impl Send for Key

impl !Sync for Key

Blanket Implementations

impl<T> From for T[src]

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

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

type Owned = T

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.