AES-CMAC
AES-CMAC of a 40-byte message, checked against RFC 4493.
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
- Inputs (
Workflow Input): Supplies the 16-byte AES-128 key and the 40-byte NIST test message. - Block-Cipher Authentication (
CMAC Generator): Configured withcipher = "AES". Internally derives subkeys (K1, K2), pads the 8-byte tail block to 16 bytes with8000000000000000, XORs it with K2, and runs 3 blocks of AES-128-CBC with a zero IV. - Tag Output (
Workflow Output): Emits the final 16-byte (128-bit) CMAC tag.
Nodes & Configuration
| Node | Node Role & Key Parameters | Count |
|---|---|---|
| Workflow Input | Supplies Key (16 B) and Message (40 B) | 1 |
| CMAC Generator | Configured with cipher = "AES" | 1 |
| Workflow Output | Collects the 16-byte MAC output | 1 |
Inputs, Outputs & Test Vector Verification
Verification Source: RFC 4493 §4 (Example 3, len = 40)
Inputs
| Name | Type | Value (Hex) |
|---|---|---|
Key | bytes (16 B) | 2b7e151628aed2a6abf7158809cf4f3c |
Message | bytes (40 B) | 6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411 |
Expected Outputs
| Name | Type | Value (Hex) |
|---|---|---|
MAC | bytes (16 B) | dfa66747de9ae63030ca32611497c827 |