pub struct PublicKey { /* private fields */ }
Implementations
sourceimpl PublicKey
impl PublicKey
sourcepub fn new(
packet_version: Version,
version: KeyVersion,
algorithm: PublicKeyAlgorithm,
created_at: DateTime<Utc>,
expiration: Option<u16>,
public_params: PublicParams
) -> Result<Self>
pub fn new(
packet_version: Version,
version: KeyVersion,
algorithm: PublicKeyAlgorithm,
created_at: DateTime<Utc>,
expiration: Option<u16>,
public_params: PublicParams
) -> Result<Self>
Create a new PublicKeyKey
packet from underlying parameters.
sourcepub fn from_slice(packet_version: Version, input: &[u8]) -> Result<Self>
pub fn from_slice(packet_version: Version, input: &[u8]) -> Result<Self>
Parses a PublicKeyKey
packet from the given slice.
pub fn version(&self) -> KeyVersion
pub fn created_at(&self) -> &DateTime<Utc>
pub fn expiration(&self) -> Option<u16>
pub fn public_params(&self) -> &PublicParams
pub fn verify(&self) -> Result<()>
pub fn sign<F>(&self, key: &impl SecretKeyTrait, key_pw: F) -> Result<Signature> where
F: FnOnce() -> String,
Trait Implementations
sourceimpl KeyTrait for PublicKey
impl KeyTrait for PublicKey
sourcefn fingerprint(&self) -> Vec<u8>
fn fingerprint(&self) -> Vec<u8>
Returns the fingerprint of this key.
fn algorithm(&self) -> PublicKeyAlgorithm
fn is_signing_key(&self) -> bool
fn is_encryption_key(&self) -> bool
sourceimpl PacketTrait for PublicKey
impl PacketTrait for PublicKey
sourceimpl PublicKeyTrait for PublicKey
impl PublicKeyTrait for PublicKey
sourcefn verify_signature(
&self,
hash: HashAlgorithm,
hashed: &[u8],
sig: &[Mpi]
) -> Result<()>
fn verify_signature(
&self,
hash: HashAlgorithm,
hashed: &[u8],
sig: &[Mpi]
) -> Result<()>
Verify a signed message.
Data will be hashed using hash
, before verifying. Read more
sourcefn encrypt<R: CryptoRng + Rng>(
&self,
rng: &mut R,
plain: &[u8]
) -> Result<Vec<Mpi>>
fn encrypt<R: CryptoRng + Rng>(
&self,
rng: &mut R,
plain: &[u8]
) -> Result<Vec<Mpi>>
Encrypt the given plain
for this key.
sourcefn to_writer_old(&self, writer: &mut impl Write) -> Result<()>
fn to_writer_old(&self, writer: &mut impl Write) -> Result<()>
This is the data used for hashing in a signature. Only uses the public portion of the key.
impl Eq for PublicKey
impl StructuralEq for PublicKey
impl StructuralPartialEq for PublicKey
Auto Trait Implementations
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin for PublicKey
impl UnwindSafe for PublicKey
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more