PaddingScheme

Trait PaddingScheme 

Source
pub trait PaddingScheme {
    // Required methods
    fn decrypt<Rng: CryptoRngCore>(
        self,
        rng: Option<&mut Rng>,
        priv_key: &RsaPrivateKey,
        ciphertext: &[u8],
    ) -> Result<Vec<u8>>;
    fn encrypt<Rng: CryptoRngCore>(
        self,
        rng: &mut Rng,
        pub_key: &RsaPublicKey,
        msg: &[u8],
    ) -> Result<Vec<u8>>;
}
Expand description

Padding scheme used for encryption.

Required Methods§

Source

fn decrypt<Rng: CryptoRngCore>( self, rng: Option<&mut Rng>, priv_key: &RsaPrivateKey, ciphertext: &[u8], ) -> Result<Vec<u8>>

Decrypt the given message using the given private key.

If an rng is passed, it uses RSA blinding to help mitigate timing side-channel attacks.

Source

fn encrypt<Rng: CryptoRngCore>( self, rng: &mut Rng, pub_key: &RsaPublicKey, msg: &[u8], ) -> Result<Vec<u8>>

Encrypt the given message using the given public key.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§