pub trait KeyGeneration<PK,SK>: EncryptionOfZeros<PK, SK>{
fn generate_keypair(&self) -> (PK, SK);
fn generate_key(&self) -> SK;
}
pub trait EncryptionOfZeros<CT, SK>{
fn encrypt_zero_sk(&self, sk: &SK) -> CT;
fn encrypt_zero(&self, pk: &CT) -> CT;
}
pub trait SKEncryption<CT, PT, SK>: KeyGeneration<CT, SK>{
fn encrypt_sk(&self, pt: &PT, sk: &SK) -> CT;
fn decrypt(&self, ct: &CT, sk: &SK) -> PT;
}
pub trait PKEncryption<CT, PT, SK>: SKEncryption<CT, PT, SK> {
fn encrypt(&self, pt: &PT, pk: &CT) -> CT;
}
pub trait CipherPlainAddition<CT, PT>: {
fn add_plain_inplace(&self, ct1: &mut CT, pt: &PT);
}
pub trait AdditiveHomomorphicScheme<CT, SK>: EncryptionOfZeros<CT, SK> {
fn add_inplace(&self, ct1: &mut CT, ct2: &CT);
fn rerandomize(&self, ct: &mut CT, pk: &CT);
}
pub trait Serializable{
fn to_bytes(&self) -> Vec<u8>;
fn from_bytes(bytes: &Vec<u8>) -> Self;
}
pub trait NTT<T>: Clone {
fn is_ntt_form(&self) -> bool;
fn set_ntt_form(&mut self, value: bool);
fn forward_transform(&mut self);
fn inverse_transform(&mut self);
}
pub trait FastPolyMultiply<T>: NTT<T> {
fn multiply_fast(&self, other: &Self) -> Self;
fn coeffwise_multiply(&self, other: &Self) -> Self;
}