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§
sourcefn decrypt<Rng: CryptoRngCore>(
self,
rng: Option<&mut Rng>,
priv_key: &RsaPrivateKey,
ciphertext: &[u8],
) -> Result<Vec<u8>>
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.
sourcefn encrypt<Rng: CryptoRngCore>(
self,
rng: &mut Rng,
pub_key: &RsaPublicKey,
msg: &[u8],
) -> Result<Vec<u8>>
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.
Object Safety§
This trait is not object safe.