use crate::algorithm::SignatureAlgorithm;
use crate::error::Result;
pub trait Signer: Send + Sync {
fn algorithm(&self) -> SignatureAlgorithm;
fn sign(&self, data: &[u8]) -> Result<Vec<u8>>;
}
pub trait Verifier: Send + Sync {
fn algorithm(&self) -> SignatureAlgorithm;
fn verify(&self, data: &[u8], signature: &[u8]) -> Result<bool>;
}
pub trait Decryptor: Send + Sync {
fn decrypt(&self, ciphertext: &[u8]) -> Result<Vec<u8>>;
}
pub trait Encryptor: Send + Sync {
fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>>;
}
pub trait KeyWrapper: Send + Sync {
fn wrap(&self, key_data: &[u8]) -> Result<Vec<u8>>;
fn unwrap(&self, wrapped: &[u8]) -> Result<Vec<u8>>;
}
pub trait KeyAgreement: Send + Sync {
fn agree(&self, peer_public_key: &[u8]) -> Result<Vec<u8>>;
}
#[cfg(feature = "post-quantum")]
pub trait Encapsulator: Send + Sync {
fn algorithm(&self) -> crate::algorithm::KemAlgorithm;
fn encapsulate(&self) -> Result<(Vec<u8>, zeroize::Zeroizing<Vec<u8>>)>;
}
#[cfg(feature = "post-quantum")]
pub trait Decapsulator: Send + Sync {
fn algorithm(&self) -> crate::algorithm::KemAlgorithm;
fn decapsulate(&self, ciphertext: &[u8]) -> Result<zeroize::Zeroizing<Vec<u8>>>;
}