Skip to main content

PaddingScheme

Trait PaddingScheme 

Source
pub trait PaddingScheme {
    // Required methods
    fn decrypt<Rng: TryCryptoRng + ?Sized>(
        self,
        rng: Option<&mut Rng>,
        priv_key: &RsaPrivateKey,
        ciphertext: &[u8],
    ) -> Result<Vec<u8>>;
    fn encrypt<Rng, K, T>(
        self,
        rng: &mut Rng,
        pub_key: &K,
        msg: &[u8],
    ) -> Result<Vec<u8>>
       where Rng: TryCryptoRng + ?Sized,
             T: UnsignedModularInt,
             K: PublicKeyParts<T>;
}
Expand description

Padding scheme used for encryption.

Required Methods§

Source

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

Available on crate feature private-key only.

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, K, T>( self, rng: &mut Rng, pub_key: &K, msg: &[u8], ) -> Result<Vec<u8>>

Available on crate feature alloc only.

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".

Implementors§

Source§

impl PaddingScheme for Pkcs1v15Encrypt

Source§

impl<D, MGD> PaddingScheme for Oaep<D, MGD>

Available on crate feature alloc only.