Skip to main content

Module aes256_cbc_hmac_sha256_aead

Module aes256_cbc_hmac_sha256_aead 

Source
Expand description

ยงAES-256-CBC-HMAC-SHA256 operations

An extended construction of AES-256-CBC-HMAC-SHA256. It is used when an AES256-CBC-HMAC-SHA256 key is used for authenticated encryption in the context of COSE.

Structsยง

Aes256CbcHmacSha256Aead ๐Ÿ”’
AES-256-CBC-HMAC-SHA256 authenticated encryption with associated data.
Aes256CbcHmacSha256AeadCiphertext ๐Ÿ”’
Aes256CbcHmacSha256AeadNonce ๐Ÿ”’
A 128-bit AES-256-CBC-HMAC-SHA256 IV.

Constantsยง

ENC_KEY_SIZE ๐Ÿ”’
KEY_SIZE ๐Ÿ”’
MAC_DOMAIN_SEPARATOR ๐Ÿ”’
Domain separation label prefixed to the MAC input. It distinguishes this construction from the legacy Aes256CbcHmacSha256 Encrypt-then-MAC construction, which MACs iv || ciphertext under the same MAC sub-key, so that a tag produced by one construction can never be a valid tag for the other.
MAC_KEY_SIZE ๐Ÿ”’
MAC_SIZE ๐Ÿ”’
NONCE_SIZE ๐Ÿ”’

Functionsยง

calculate_mac_with_aad ๐Ÿ”’
Computes the HMAC-SHA256 MAC over MAC_DOMAIN_SEPARATOR || iv || len(data) || data || len(associated_data) || associated_data, where lengths are encoded as 8-byte big-endian u64s.
split_to_subkeys ๐Ÿ”’
Splits the 64-byte composite key into zero-copy views over its encryption and MAC halves.

Type Aliasesยง

HmacSha256 ๐Ÿ”’