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
impl SignedPublicKey
pub fn new( primary_key: PublicKey, details: SignedKeyDetails, public_subkeys: Vec<SignedPublicSubKey>, ) -> Self
Sourcepub fn expires_at(&self) -> Option<DateTime<Utc>>
pub fn expires_at(&self) -> Option<DateTime<Utc>>
Get the public key expiration as a date.
pub fn verify(&self) -> Result<()>
pub fn to_armored_writer( &self, writer: &mut impl Write, opts: ArmorOptions<'_>, ) -> Result<()>
pub fn to_armored_bytes(&self, opts: ArmorOptions<'_>) -> Result<Vec<u8>>
pub fn to_armored_string(&self, opts: ArmorOptions<'_>) -> Result<String>
pub fn as_unsigned(&self) -> PublicKey
Trait Implementations§
Source§impl Clone for SignedPublicKey
impl Clone for SignedPublicKey
Source§fn clone(&self) -> SignedPublicKey
fn clone(&self) -> SignedPublicKey
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SignedPublicKey
impl Debug for SignedPublicKey
Source§impl Deserializable for SignedPublicKey
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>
fn from_packets<'a, I: Iterator<Item = Result<Packet>> + 'a>( packets: Peekable<I>, ) -> Box<dyn Iterator<Item = Result<Self>> + 'a>
Parse a transferable key from packets. Ref: https://www.rfc-editor.org/rfc/rfc9580.html#name-transferable-public-keys
Source§fn matches_block_type(typ: BlockType) -> bool
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>
fn from_bytes(bytes: impl Read) -> Result<Self>
Parse a single byte encoded composition.
Source§fn from_string(input: &str) -> Result<(Self, Headers)>
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)>
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_many<'a, R: Read + 'a>(
input: R,
) -> Result<(Box<dyn Iterator<Item = Result<Self>> + 'a>, Headers)>
fn from_armor_many<'a, R: Read + 'a>( input: R, ) -> Result<(Box<dyn Iterator<Item = Result<Self>> + 'a>, Headers)>
Armored ascii data.
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>
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>)>
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
fn from_reader_single_buf<'a, R: BufRead + 'a>( input: R, ) -> Result<(Self, Option<Headers>)>
Source§impl From<SignedSecretKey> for SignedPublicKey
impl From<SignedSecretKey> for SignedPublicKey
Source§fn from(value: SignedSecretKey) -> Self
fn from(value: SignedSecretKey) -> Self
Converts to this type from the input type.
Source§impl PartialEq for SignedPublicKey
impl PartialEq for SignedPublicKey
Source§impl PublicKeyTrait for SignedPublicKey
impl PublicKeyTrait for SignedPublicKey
Source§fn verify_signature(
&self,
hash: HashAlgorithm,
data: &[u8],
sig: &SignatureBytes,
) -> Result<()>
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>
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<()>
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.
fn public_params(&self) -> &PublicParams
fn version(&self) -> KeyVersion
fn fingerprint(&self) -> Fingerprint
fn algorithm(&self) -> PublicKeyAlgorithm
fn created_at(&self) -> &DateTime<Utc>
fn expiration(&self) -> Option<u16>
fn is_signing_key(&self) -> bool
fn is_encryption_key(&self) -> bool
Source§impl Serialize for SignedPublicKey
impl Serialize for SignedPublicKey
impl Eq for SignedPublicKey
impl StructuralPartialEq for SignedPublicKey
Auto Trait Implementations§
impl Freeze for SignedPublicKey
impl RefUnwindSafe for SignedPublicKey
impl Send for SignedPublicKey
impl Sync for SignedPublicKey
impl Unpin for SignedPublicKey
impl UnwindSafe for SignedPublicKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more