Skip to main content

AeadWithMetadata

Trait AeadWithMetadata 

Source
pub trait AeadWithMetadata: Aead {
    // Required method
    fn metadata(&self) -> &'static AeadMetadata;

    // Provided methods
    fn algorithm(&self) -> Algorithm { ... }
    fn key_size(&self) -> usize { ... }
    fn nonce_size(&self) -> usize { ... }
    fn tag_size(&self) -> usize { ... }
    fn security_level(&self) -> u32 { ... }
    fn algorithm_name(&self) -> &'static str { ... }
    fn algorithm_description(&self) -> &'static str { ... }
    fn supports_semantic_decrypt(&self) -> bool { ... }
    fn validate_key(&self, key: &AeadKey) -> Result<()> { ... }
    fn validate_nonce(&self, nonce: &Nonce) -> Result<()> { ... }
    fn validate_ciphertext_size(&self, ciphertext_size: usize) -> Result<()> { ... }
}
Expand description

Trait for AEAD implementations that provide metadata

Required Methods§

Source

fn metadata(&self) -> &'static AeadMetadata

Get the algorithm metadata

Provided Methods§

Source

fn algorithm(&self) -> Algorithm

Get the algorithm identifier

Source

fn key_size(&self) -> usize

Get the key size in bytes

Source

fn nonce_size(&self) -> usize

Get the nonce size in bytes

Source

fn tag_size(&self) -> usize

Get the tag size in bytes

Source

fn security_level(&self) -> u32

Get the security level

Source

fn algorithm_name(&self) -> &'static str

Get the algorithm name

Source

fn algorithm_description(&self) -> &'static str

Get the algorithm description

Source

fn supports_semantic_decrypt(&self) -> bool

Whether this algorithm’s reference stack implements lib_q_core::AeadDecryptSemantic (Layer B), per AeadMetadata::supports_semantic_decrypt.

Custom dyn AeadWithMetadata implementations that are not full algorithm facades should override this to return false when they do not implement semantic decrypt.

Source

fn validate_key(&self, key: &AeadKey) -> Result<()>

Validate key size

Source

fn validate_nonce(&self, nonce: &Nonce) -> Result<()>

Validate nonce size

Source

fn validate_ciphertext_size(&self, ciphertext_size: usize) -> Result<()>

Validate ciphertext size (must be at least tag size)

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§