Trait rsa::PublicKey

source ·
pub trait PublicKey: EncryptionPrimitive + PublicKeyParts {
    // Required methods
    fn encrypt<R: RngCore + CryptoRng>(
        &self,
        rng: &mut R,
        padding: PaddingScheme,
        msg: &[u8]
    ) -> Result<Vec<u8>>;
    fn verify(
        &self,
        padding: PaddingScheme,
        hashed: &[u8],
        sig: &[u8]
    ) -> Result<()>;
}
Expand description

Generic trait for operations on a public key.

Required Methods§

source

fn encrypt<R: RngCore + CryptoRng>( &self, rng: &mut R, padding: PaddingScheme, msg: &[u8] ) -> Result<Vec<u8>>

Encrypt the given message.

source

fn verify( &self, padding: PaddingScheme, hashed: &[u8], sig: &[u8] ) -> Result<()>

Verify a signed message. hashedmust be the result of hashing the input using the hashing function passed in through hash. If the message is valid Ok(()) is returned, otherwiese an Err indicating failure.

Object Safety§

This trait is not object safe.

Implementors§