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>,
K::MontyParams: CtModulusParams;
}Expand description
Padding scheme used for encryption.
Required Methods§
Sourcefn decrypt<Rng: TryCryptoRng + ?Sized>(
self,
rng: Option<&mut Rng>,
priv_key: &RsaPrivateKey,
ciphertext: &[u8],
) -> Result<Vec<u8>>
Available on crate feature alloc only.
fn decrypt<Rng: TryCryptoRng + ?Sized>( self, rng: Option<&mut Rng>, priv_key: &RsaPrivateKey, ciphertext: &[u8], ) -> Result<Vec<u8>>
alloc 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.
Sourcefn 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>,
K::MontyParams: CtModulusParams,
Available on crate feature alloc only.
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>,
K::MontyParams: CtModulusParams,
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§
impl PaddingScheme for Pkcs1v15Encrypt
impl<D, MGD> PaddingScheme for Oaep<D, MGD>
Available on crate feature
alloc only.