Trait rsa::PaddingScheme

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

Padding scheme used for encryption.

Required Methods§

source

fn decrypt<Rng: CryptoRngCore, Priv: PrivateKey>( self, rng: Option<&mut Rng>, priv_key: &Priv, 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, Pub: PublicKey>( self, rng: &mut Rng, pub_key: &Pub, msg: &[u8] ) -> Result<Vec<u8>>

Encrypt the given message using the given public key.

Implementors§