Trait sarkara::aead::AeadCipher [] [src]

pub trait AeadCipher {
    fn new(key: &[u8]) -> Self;
    fn key_length() -> usize;
    fn tag_length() -> usize;
    fn nonce_length() -> usize;
    fn with_aad(&mut self, aad: &[u8]) -> &mut Self;
    fn encrypt(&mut self, nonce: &[u8], data: &[u8]) -> Vec<u8>;
    fn decrypt(&mut self, nonce: &[u8], data: &[u8]) -> Result<Vec<u8>, DecryptFail>;
}

AeadCipher trait.

Required Methods

Create a new AeadCipher.

Key length.

Tag length.

Nonce length.

Set associated data.

Encryption.

Decryption

Fail When:

  • Ciphertext length error.
  • Tag authentication fail.
  • Other error.

Implementors