use crate::error::CasResult;
pub trait CASAES256Encryption {
fn generate_key() -> Vec<u8>;
fn encrypt_plaintext(aes_key: Vec<u8>, nonce: Vec<u8>, plaintext: Vec<u8>) -> CasResult<Vec<u8>>;
fn decrypt_ciphertext(aes_key: Vec<u8>, nonce: Vec<u8>, ciphertext: Vec<u8>) -> CasResult<Vec<u8>>;
fn key_from_x25519_shared_secret(shared_secret: Vec<u8>) -> CasResult<Vec<u8>>;
fn generate_nonce() -> Vec<u8>;
fn key_from_vec(key_slice: Vec<u8>) -> CasResult<Vec<u8>>;
}
pub trait CASAES128Encryption {
fn generate_key() -> Vec<u8>;
fn encrypt_plaintext(aes_key: Vec<u8>, nonce: Vec<u8>, plaintext: Vec<u8>) -> CasResult<Vec<u8>>;
fn decrypt_ciphertext(aes_key: Vec<u8>, nonce: Vec<u8>, ciphertext: Vec<u8>) -> CasResult<Vec<u8>>;
fn key_from_x25519_shared_secret(shared_secret: Vec<u8>) -> CasResult<Vec<u8>>;
fn generate_nonce() -> Vec<u8>;
fn key_from_vec(key_slice: Vec<u8>) -> CasResult<Vec<u8>>;
}
pub trait CASAES256AadEncryption {
fn encrypt_plaintext_with_aad(aes_key: Vec<u8>, nonce: Vec<u8>, plaintext: Vec<u8>, aad: Vec<u8>) -> CasResult<Vec<u8>>;
fn decrypt_ciphertext_with_aad(aes_key: Vec<u8>, nonce: Vec<u8>, ciphertext: Vec<u8>, aad: Vec<u8>) -> CasResult<Vec<u8>>;
}
pub trait CASAES128AadEncryption {
fn encrypt_plaintext_with_aad(aes_key: Vec<u8>, nonce: Vec<u8>, plaintext: Vec<u8>, aad: Vec<u8>) -> CasResult<Vec<u8>>;
fn decrypt_ciphertext_with_aad(aes_key: Vec<u8>, nonce: Vec<u8>, ciphertext: Vec<u8>, aad: Vec<u8>) -> CasResult<Vec<u8>>;
}
pub trait CASAES256SIVEncryption {
fn generate_key() -> Vec<u8>;
fn encrypt_plaintext(aes_key: Vec<u8>, nonce: Vec<u8>, plaintext: Vec<u8>) -> CasResult<Vec<u8>>;
fn decrypt_ciphertext(aes_key: Vec<u8>, nonce: Vec<u8>, ciphertext: Vec<u8>) -> CasResult<Vec<u8>>;
fn key_from_x25519_shared_secret(shared_secret: Vec<u8>) -> CasResult<Vec<u8>>;
fn generate_nonce() -> Vec<u8>;
fn key_from_vec(key_slice: Vec<u8>) -> CasResult<Vec<u8>>;
}
pub trait CASAES128SIVEncryption {
fn generate_key() -> Vec<u8>;
fn encrypt_plaintext(aes_key: Vec<u8>, nonce: Vec<u8>, plaintext: Vec<u8>) -> CasResult<Vec<u8>>;
fn decrypt_ciphertext(aes_key: Vec<u8>, nonce: Vec<u8>, ciphertext: Vec<u8>) -> CasResult<Vec<u8>>;
fn key_from_x25519_shared_secret(shared_secret: Vec<u8>) -> CasResult<Vec<u8>>;
fn generate_nonce() -> Vec<u8>;
fn key_from_vec(key_slice: Vec<u8>) -> CasResult<Vec<u8>>;
}
pub trait CASAES256KeyWrap {
fn generate_kek() -> Vec<u8>;
fn wrap_key(kek: Vec<u8>, key_to_wrap: Vec<u8>) -> CasResult<Vec<u8>>;
fn unwrap_key(kek: Vec<u8>, wrapped_key: Vec<u8>) -> CasResult<Vec<u8>>;
fn wrap_key_with_padding(kek: Vec<u8>, key_to_wrap: Vec<u8>) -> CasResult<Vec<u8>>;
fn unwrap_key_with_padding(kek: Vec<u8>, wrapped_key: Vec<u8>) -> CasResult<Vec<u8>>;
}
pub trait CASAES128KeyWrap {
fn generate_kek() -> Vec<u8>;
fn wrap_key(kek: Vec<u8>, key_to_wrap: Vec<u8>) -> CasResult<Vec<u8>>;
fn unwrap_key(kek: Vec<u8>, wrapped_key: Vec<u8>) -> CasResult<Vec<u8>>;
fn wrap_key_with_padding(kek: Vec<u8>, key_to_wrap: Vec<u8>) -> CasResult<Vec<u8>>;
fn unwrap_key_with_padding(kek: Vec<u8>, wrapped_key: Vec<u8>) -> CasResult<Vec<u8>>;
}
pub trait Chacha20Poly1305Encryption {
fn generate_key() -> Vec<u8>;
fn encrypt_plaintext(aes_key: Vec<u8>, nonce: Vec<u8>, plaintext: Vec<u8>) -> CasResult<Vec<u8>>;
fn decrypt_ciphertext(aes_key: Vec<u8>, nonce: Vec<u8>, ciphertext: Vec<u8>) -> CasResult<Vec<u8>>;
fn generate_nonce() -> Vec<u8>;
}