use crate::error::PluginResult;
use crate::options::OptionView;
pub struct KemEncapsulateResult {
pub ciphertext: Vec<u8>,
pub shared_secret: Vec<u8>,
}
pub struct KemKeypair {
pub public_key: Vec<u8>,
pub secret_key: Vec<u8>,
}
pub trait KemPlugin: Sized {
fn encapsulator_create(
algorithm: &str,
recipient_pubkey: &[u8],
opts: Option<OptionView<'_>>,
) -> PluginResult<Self>;
fn encapsulate(
&mut self,
ct_out: &mut [u8],
ss_out: &mut [u8],
) -> PluginResult<KemEncapsulateResult>;
fn decapsulator_create(
algorithm: &str,
recipient_seckey: &[u8],
opts: Option<OptionView<'_>>,
) -> PluginResult<Self>;
fn decapsulate(&mut self, ciphertext: &[u8], ss_out: &mut [u8]) -> PluginResult<usize>;
fn shared_secret_size(algorithm: &str) -> PluginResult<u32>;
fn keypair_generate(
algorithm: &str,
seed: Option<&[u8]>,
opts: Option<OptionView<'_>>,
) -> PluginResult<KemKeypair>;
}