Skip to main content

Cipher

Trait Cipher 

Source
pub trait Cipher: Send + Sync {
    // Required methods
    fn encrypt_page(
        &self,
        nonce: &[u8; 12],
        plaintext: &[u8],
    ) -> Result<Vec<u8>>;
    fn decrypt_page(
        &self,
        nonce: &[u8; 12],
        ciphertext: &[u8],
    ) -> Result<Vec<u8>>;

    // Provided methods
    fn encrypt_page_with_aad(
        &self,
        nonce: &[u8; 12],
        plaintext: &[u8],
        aad: &[u8],
    ) -> Result<Vec<u8>> { ... }
    fn decrypt_page_with_aad(
        &self,
        nonce: &[u8; 12],
        ciphertext: &[u8],
        aad: &[u8],
    ) -> Result<Vec<u8>> { ... }
}
Expand description

Symmetric page cipher.

Required Methods§

Source

fn encrypt_page(&self, nonce: &[u8; 12], plaintext: &[u8]) -> Result<Vec<u8>>

Encrypt a page payload. nonce is the deterministic per-page nonce.

Source

fn decrypt_page(&self, nonce: &[u8; 12], ciphertext: &[u8]) -> Result<Vec<u8>>

Decrypt a page payload.

Provided Methods§

Source

fn encrypt_page_with_aad( &self, nonce: &[u8; 12], plaintext: &[u8], aad: &[u8], ) -> Result<Vec<u8>>

Source

fn decrypt_page_with_aad( &self, nonce: &[u8; 12], ciphertext: &[u8], aad: &[u8], ) -> Result<Vec<u8>>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§