MAC · Block Cipher NIST SP 800-38B RFC 4493 §4 Verified

AES-CMAC

AES-CMAC of a 40-byte message, checked against RFC 4493.

Open in app Download .ncw

Overview & Cryptographic Context

CMAC (Cipher-based Message Authentication Code), specified in NIST SP 800-38B and IETF RFC 4493, eliminates the variable-length message forgery vulnerabilities of raw CBC-MAC by XORing the final block with one of two secret subkeys (K1 or K2) derived from the block cipher key. If the message length is a positive multiple of the 16-byte block size, the final block is XORed with K1; otherwise, the partial final block is padded with 10* (0x80 0x00..., ISO/IEC 9797-1 Method 2) and XORed with K2.

This workflow verifies RFC 4493 §4 Example 3, where a 40-byte message (two full 16-byte blocks followed by an 8-byte partial block) is authenticated under a 128-bit AES key, exercising the 10* padding and K2 subkey masking path. To inspect how K1 and K2 are derived inside CMAC, see the companion CMAC subkey generation workflow.

Pipeline Architecture & Wiring Flow

Workflow Input (Key 16B, Message 40B) ──► CMAC Generator (cipher = AES) ──► Workflow Output (MAC 16B)
  1. Inputs (Workflow Input): Supplies the 16-byte AES-128 key and the 40-byte NIST test message.
  2. Block-Cipher Authentication (CMAC Generator): Configured with cipher = "AES". Internally derives subkeys (K1, K2), pads the 8-byte tail block to 16 bytes with 8000000000000000, XORs it with K2, and runs 3 blocks of AES-128-CBC with a zero IV.
  3. Tag Output (Workflow Output): Emits the final 16-byte (128-bit) CMAC tag.

Nodes & Configuration

NodeNode Role & Key ParametersCount
Workflow InputSupplies Key (16 B) and Message (40 B)1
CMAC GeneratorConfigured with cipher = "AES"1
Workflow OutputCollects the 16-byte MAC output1

Node reference → · NIST SP 800-38B Padding →

Inputs, Outputs & Test Vector Verification

Verification Source: RFC 4493 §4 (Example 3, len = 40)

Inputs

NameTypeValue (Hex)
Keybytes (16 B)2b7e151628aed2a6abf7158809cf4f3c
Messagebytes (40 B)6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411

Expected Outputs

NameTypeValue (Hex)
MACbytes (16 B)dfa66747de9ae63030ca32611497c827