Struct SignedPublicKey

Source
pub struct SignedPublicKey {
    pub primary_key: PublicKey,
    pub details: SignedKeyDetails,
    pub public_subkeys: Vec<SignedPublicSubKey>,
}
Expand description

A Public OpenPGP key (“Transferable Public Key”), complete with self-signatures (and optionally third party signatures). This format can be used to transfer a public key to other OpenPGP users.

An OpenPGP Transferable Public Key is also known as an OpenPGP certificate.

Fields§

§primary_key: PublicKey§details: SignedKeyDetails§public_subkeys: Vec<SignedPublicSubKey>

Implementations§

Source§

impl SignedPublicKey

Source

pub fn new( primary_key: PublicKey, details: SignedKeyDetails, public_subkeys: Vec<SignedPublicSubKey>, ) -> Self

Source

pub fn expires_at(&self) -> Option<DateTime<Utc>>

Get the public key expiration as a date.

Source

pub fn verify(&self) -> Result<()>

Source

pub fn to_armored_writer( &self, writer: &mut impl Write, opts: ArmorOptions<'_>, ) -> Result<()>

Source

pub fn to_armored_bytes(&self, opts: ArmorOptions<'_>) -> Result<Vec<u8>>

Source

pub fn to_armored_string(&self, opts: ArmorOptions<'_>) -> Result<String>

Source

pub fn as_unsigned(&self) -> PublicKey

Trait Implementations§

Source§

impl Clone for SignedPublicKey

Source§

fn clone(&self) -> SignedPublicKey

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SignedPublicKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deserializable for SignedPublicKey

Source§

fn from_packets<'a, I: Iterator<Item = Result<Packet>> + 'a>( packets: Peekable<I>, ) -> Box<dyn Iterator<Item = Result<Self>> + 'a>

Source§

fn matches_block_type(typ: BlockType) -> bool

Check if the given typ is a valid block type for this type.
Source§

fn from_bytes(bytes: impl Read) -> Result<Self>

Parse a single byte encoded composition.
Source§

fn from_string(input: &str) -> Result<(Self, Headers)>

Parse a single armor encoded composition.
Source§

fn from_string_many<'a>( input: &'a str, ) -> Result<(Box<dyn Iterator<Item = Result<Self>> + 'a>, Headers)>

Parse an armor encoded list of compositions.
Source§

fn from_armor_single<R: Read>(input: R) -> Result<(Self, Headers)>

Armored ascii data.
Source§

fn from_armor_single_buf<R: BufRead>(input: R) -> Result<(Self, Headers)>

Armored ascii data.
Source§

fn from_armor_many<'a, R: Read + 'a>( input: R, ) -> Result<(Box<dyn Iterator<Item = Result<Self>> + 'a>, Headers)>

Armored ascii data.
Source§

fn from_armor_many_buf<'a, R: BufRead + 'a>( input: R, ) -> Result<(Box<dyn Iterator<Item = Result<Self>> + 'a>, Headers)>

Source§

fn from_bytes_many<'a>( bytes: impl Read + 'a, ) -> Box<dyn Iterator<Item = Result<Self>> + 'a>

Parse a list of compositions in raw byte format.
Source§

fn from_reader_single<'a, R: Read + 'a>( input: R, ) -> Result<(Self, Option<Headers>)>

Parses a single composition, from either ASCII-armored or binary OpenPGP data. Read more
Source§

fn from_reader_single_buf<'a, R: BufRead + 'a>( input: R, ) -> Result<(Self, Option<Headers>)>

Source§

fn from_reader_many<'a, R: Read + 'a>( input: R, ) -> Result<(Box<dyn Iterator<Item = Result<Self>> + 'a>, Option<Headers>)>

Parses a list of compositions, from either ASCII-armored or binary OpenPGP data. Read more
Source§

fn from_reader_many_buf<'a, R: BufRead + 'a>( input: R, ) -> Result<(Box<dyn Iterator<Item = Result<Self>> + 'a>, Option<Headers>)>

Parses a list of compositions, from either ASCII-armored or binary OpenPGP data. Read more
Source§

impl From<SignedSecretKey> for SignedPublicKey

Source§

fn from(value: SignedSecretKey) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for SignedPublicKey

Source§

fn eq(&self, other: &SignedPublicKey) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PublicKeyTrait for SignedPublicKey

Source§

fn verify_signature( &self, hash: HashAlgorithm, data: &[u8], sig: &SignatureBytes, ) -> Result<()>

Verify a signed message. Data will be hashed using hash, before verifying.
Source§

fn encrypt<R: Rng + CryptoRng>( &self, rng: R, plain: &[u8], typ: EskType, ) -> Result<PkeskBytes>

Encrypt the given plain for this key.
Source§

fn serialize_for_hashing(&self, writer: &mut impl Write) -> Result<()>

This is the data used for hashing in a signature. Only uses the public portion of the key.
Source§

fn public_params(&self) -> &PublicParams

Source§

fn version(&self) -> KeyVersion

Source§

fn fingerprint(&self) -> Fingerprint

Source§

fn key_id(&self) -> KeyId

Returns the Key ID of the associated primary key.
Source§

fn algorithm(&self) -> PublicKeyAlgorithm

Source§

fn created_at(&self) -> &DateTime<Utc>

Source§

fn expiration(&self) -> Option<u16>

Source§

fn is_signing_key(&self) -> bool

Source§

fn is_encryption_key(&self) -> bool

Source§

impl Serialize for SignedPublicKey

Source§

fn to_writer<W: Write>(&self, writer: &mut W) -> Result<()>

Source§

fn to_bytes(&self) -> Result<Vec<u8>>

Source§

impl Eq for SignedPublicKey

Source§

impl StructuralPartialEq for SignedPublicKey

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V