Trait pgp::types::PublicKeyTrait

source ·
pub trait PublicKeyTrait: KeyTrait {
    // Required methods
    fn verify_signature(
        &self,
        hash: HashAlgorithm,
        data: &[u8],
        sig: &[Mpi]
    ) -> Result<()>;
    fn encrypt<R: CryptoRng + Rng>(
        &self,
        rng: &mut R,
        plain: &[u8]
    ) -> Result<Vec<Mpi>>;
    fn to_writer_old(&self, writer: &mut impl Write) -> Result<()>;
}

Required Methods§

source

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

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

source

fn encrypt<R: CryptoRng + Rng>( &self, rng: &mut R, plain: &[u8] ) -> Result<Vec<Mpi>>

Encrypt the given plain for this key.

source

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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a, T: PublicKeyTrait> PublicKeyTrait for &'a T

source§

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

source§

fn encrypt<R: CryptoRng + Rng>( &self, rng: &mut R, plain: &[u8] ) -> Result<Vec<Mpi>>

source§

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

Implementors§