embassy-crypto-driver

Crates

git

Versions

default

Flavors

Skip to main content

Aes256Ccm

Trait Aes256Ccm 

Source
pub trait Aes256Ccm {
    type Context: Clone;

    // Required methods
    fn init(key: &[u8; 32]) -> Self::Context;
    fn encrypt(
        ctx: &Self::Context,
        nonce: &[u8],
        aad: &[u8],
        buffer: InOutBuf<'_, '_, u8>,
        tag: &mut [u8],
    ) -> Result<(), CryptoError>;
    fn decrypt(
        ctx: &Self::Context,
        nonce: &[u8],
        aad: &[u8],
        buffer: InOutBuf<'_, '_, u8>,
        tag: &[u8],
    ) -> Result<(), CryptoError>;
}
Expand description

AES-256 CCM AEAD trait.

The tag and nonce sizes are validated at runtime by the HAL.

Required Associated Types§

Source

type Context: Clone

Opaque storage for the implementation’s key schedule.

Required Methods§

Source

fn init(key: &[u8; 32]) -> Self::Context

Initialize with a 256-bit key.

Source

fn encrypt( ctx: &Self::Context, nonce: &[u8], aad: &[u8], buffer: InOutBuf<'_, '_, u8>, tag: &mut [u8], ) -> Result<(), CryptoError>

Encrypt plaintext in-place and produce an authentication tag. The tag length is determined by the length of the tag slice.

Source

fn decrypt( ctx: &Self::Context, nonce: &[u8], aad: &[u8], buffer: InOutBuf<'_, '_, u8>, tag: &[u8], ) -> Result<(), CryptoError>

Decrypt ciphertext in-place and verify an authentication tag. The tag length is determined by the length of the tag slice.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§