#[cfg(feature = "alloc")]
use alloc::vec::Vec;
use rand_core::TryCryptoRng;
use crate::errors::Result;
#[cfg(feature = "private-key")]
use crate::key::RsaPrivateKey;
use crate::traits::{PublicKeyParts, UnsignedModularInt};
pub trait PaddingScheme {
#[cfg(feature = "private-key")]
fn decrypt<Rng: TryCryptoRng + ?Sized>(
self,
rng: Option<&mut Rng>,
priv_key: &RsaPrivateKey,
ciphertext: &[u8],
) -> Result<Vec<u8>>;
#[cfg(feature = "alloc")]
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>;
}
pub trait SignatureScheme {
#[cfg(feature = "private-key")]
fn sign<Rng: TryCryptoRng + ?Sized>(
self,
rng: Option<&mut Rng>,
priv_key: &RsaPrivateKey,
hashed: &[u8],
) -> Result<Vec<u8>>;
fn verify<K, T>(self, pub_key: &K, hashed: &[u8], sig: &[u8]) -> Result<()>
where
T: UnsignedModularInt,
K: PublicKeyParts<T>;
}