Skip to main content

Aead

Trait Aead 

Source
pub trait Aead {
    // Required methods
    fn encrypt(
        &self,
        shared_secret: &[u8],
        plaintext: &[u8],
        aad: &[u8],
    ) -> Result<(Vec<u8>, Vec<u8>), EscrowError>;
    fn decrypt(
        &self,
        shared_secret: &[u8],
        ciphertext: &[u8],
        nonce: &[u8],
        aad: &[u8],
    ) -> Result<Vec<u8>, EscrowError>;
}
Expand description

AEAD hook — caller provides concrete AEAD implementation.

Required Methods§

Source

fn encrypt( &self, shared_secret: &[u8], plaintext: &[u8], aad: &[u8], ) -> Result<(Vec<u8>, Vec<u8>), EscrowError>

Encrypt plaintext with shared_secret as key. Returns (ciphertext, nonce).

Source

fn decrypt( &self, shared_secret: &[u8], ciphertext: &[u8], nonce: &[u8], aad: &[u8], ) -> Result<Vec<u8>, EscrowError>

Decrypt ciphertext with shared_secret as key.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§