Recent from talks
Nothing was collected or created yet.
One-key MAC
View on WikipediaOne-key MAC (OMAC) is a family of message authentication codes constructed from a block cipher much like the CBC-MAC algorithm. It may be used to provide assurance of the authenticity and, hence, the integrity of data. Two versions are defined:
- The original OMAC of February 2003, which is rarely used.[1] The preferred name is now "OMAC2".[2]
- The OMAC1 refinement,[2] which became an NIST recommendation in May 2005 under the name CMAC.[3]
OMAC is free for all uses: it is not covered by any patents.[4]
History
[edit]The core of the CMAC algorithm is a variation of CBC-MAC that Black and Rogaway proposed and analyzed under the name "XCBC"[5] and submitted to NIST.[6] The XCBC algorithm efficiently addresses the security deficiencies of CBC-MAC, but requires three keys.
Iwata and Kurosawa proposed an improvement of XCBC that requires less key material (just one key) and named the resulting algorithm One-Key CBC-MAC (OMAC) in their papers.[1] They later submitted the OMAC1 (= CMAC),[2] a refinement of OMAC, and additional security analysis.[7]
Algorithm
[edit]To generate an ℓ-bit CMAC tag (t) of a message (m) using a b-bit block cipher (E) and a secret key (k), one first generates two b-bit sub-keys (k1 and k2) using the following algorithm (this is equivalent to multiplication by x and x2 in a finite field GF(2b)). Let ≪ denote the standard left-shift operator and ⊕ denote bit-wise exclusive or:
- Calculate a temporary value k0 = Ek(0).
- If msb(k0) = 0, then k1 = k0 ≪ 1, else k1 = (k0 ≪ 1) ⊕ C; where C is a certain constant that depends only on b. (Specifically, C is the non-leading coefficients of the lexicographically first irreducible degree-b binary polynomial with the minimal number of ones: 0x1B for 64-bit, 0x87 for 128-bit, and 0x425 for 256-bit blocks.)
- If msb(k1) = 0, then k2 = k1 ≪ 1, else k2 = (k1 ≪ 1) ⊕ C.
- Return keys (k1, k2) for the MAC generation process.
As a small example, suppose b = 4, C = 00112, and k0 = Ek(0) = 01012. Then k1 = 10102 and k2 = 0100 ⊕ 0011 = 01112.
The CMAC tag generation process is as follows:
- Divide message into b-bit blocks m = m1 ∥ ... ∥ mn−1 ∥ mn, where m1, ..., mn−1 are complete blocks. (The empty message is treated as one incomplete block.)
- If mn is a complete block then mn′ = k1 ⊕ mn else mn′ = k2 ⊕ (mn ∥ 10...02).
- Let c0 = 00...02.
- For i = 1, ..., n − 1, calculate ci = Ek(ci−1 ⊕ mi).
- cn = Ek(cn−1 ⊕ mn′)
- Output t = msbℓ(cn).
The verification process is as follows:
- Use the above algorithm to generate the tag.
- Check that the generated tag is equal to the received tag.
Variants
[edit]CMAC-C1[8] is a variant of CMAC that provides additional commitment and context-discovery security guarantees.
Implementations
[edit]- Python implementation: see the usage of the
AES_CMAC()function in "impacket/blob/master/tests/misc/test_crypto.py", and its definition in "impacket/blob/master/impacket/crypto.py"[9] - Ruby implementation[10]
References
[edit]- ^ a b Iwata, Tetsu; Kurosawa, Kaoru (2003-02-24). "OMAC: One-Key CBC MAC". Fast Software Encryption. Lecture Notes in Computer Science. Vol. 2887. Springer, Berlin, Heidelberg. pp. 129–153. doi:10.1007/978-3-540-39887-5_11. ISBN 978-3-540-20449-7.
- ^ a b c Iwata, Tetsu; Kurosawa, Kaoru (2003). "OMAC: One-Key CBC MAC – Addendum" (PDF).
In this note, we propose OMAC1, a new choice of the parameters of OMAC-family (see [4] for the details). Test vectors are also presented. Accordingly, we rename the previous OMAC as OMAC2. (That is to say, test vectors for OMAC2 were already shown in [3].) We use OMAC as a generic name for OMAC1 and OMAC2.
{{cite journal}}: Cite journal requires|journal=(help) - ^ Dworkin, Morris (2016). "Recommendation for Block Cipher Modes of Operation: The CMAC Mode for Authentication" (PDF). doi:10.6028/nist.sp.800-38b.
{{cite journal}}: Cite journal requires|journal=(help) - ^ Rogaway, Phillip. "CMAC: Non-licensing". Retrieved May 27, 2020.
Phillip Rogaway's statement on intellectual property status of CMAC
- ^ Black, John; Rogaway, Phillip (2000-08-20). Advances in Cryptology – CRYPTO 2000. Springer, Berlin, Heidelberg. pp. 197–215. doi:10.1007/3-540-44598-6_12. ISBN 978-3540445982.
- ^ Black, J; Rogaway, P. "A Suggestion for Handling Arbitrary-Length Messages with the CBC MAC" (PDF).
{{cite journal}}: Cite journal requires|journal=(help) - ^ Iwata, Tetsu; Kurosawa, Kaoru (2003-12-08). "Stronger Security Bounds for OMAC, TMAC, and XCBC". In Johansson, Thomas; Maitra, Subhamoy (eds.). Progress in Cryptology - INDOCRYPT 2003. Lecture Notes in Computer Science. Vol. 2904. Springer Berlin Heidelberg. pp. 402–415. CiteSeerX 10.1.1.13.8229. doi:10.1007/978-3-540-24582-7_30. ISBN 9783540206095.
- ^ Bhaumik, Ritam; Chakraborty, Bishwajit; Choi, Wonseok; Dutta, Avijit; Govinden, Jérôme; Shen, Yaobin (2024). "The Committing Security of MACs with Applications to Generic Composition". In Reyzin, Leonid; Stebila, Douglas (eds.). Advances in Cryptology – CRYPTO 2024. Lecture Notes in Computer Science. Vol. 14923. Cham: Springer Nature Switzerland. pp. 425–462. doi:10.1007/978-3-031-68385-5_14. ISBN 978-3-031-68385-5.
- ^ "Impacket is a collection of Python classes for working with network protocols.: SecureAuthCorp/impacket". 15 December 2018 – via GitHub.
- ^ "Ruby C extension for the AES-CMAC keyed hash function (RFC 4493): louismullie/cmac-rb". 4 May 2016 – via GitHub.
External links
[edit]- RFC 4493 The AES-CMAC Algorithm
- RFC 4494 The AES-CMAC-96 Algorithm and Its Use with IPsec
- RFC 4615 The Advanced Encryption Standard-Cipher-based Message Authentication Code-Pseudo-Random Function-128 (AES-CMAC-PRF-128)
- OMAC Online Test
- More information on OMAC
- Rust implementation
One-key MAC
View on GrokipediaOverview
Definition and Purpose
OMAC, or One-Key CBC MAC, is a family of message authentication codes (MACs) constructed from a block cipher that produces a fixed-length authentication tag for verifying the integrity and authenticity of messages.[6] It operates on arbitrary-length messages over the domain {0,1}^* and is designed to use a single secret key of the same length as the block cipher's key size, without requiring additional keys for processing variable lengths.[6] The basic operational model involves taking a secret key and an input message as inputs, processing the message through the block cipher in a manner that accommodates its length, and outputting a tag typically of the block cipher's output size, which is then appended to the message for transmission or storage.[6] The primary purpose of OMAC is to provide data origin authentication and protection against forgery attacks, ensuring that a message has not been altered in transit and originates from a legitimate source.[6] By generating a tag that is computationally infeasible to forge without knowledge of the secret key, OMAC enables secure verification at the receiver's end, making it suitable for applications requiring message integrity in cryptographic protocols.[6] This addresses limitations in earlier MAC constructions that struggled with efficiency or security for messages of varying lengths.[6] Key characteristics of OMAC include its efficiency with block ciphers such as AES, requiring only one key scheduling operation and a number of block cipher invocations proportional to the message length (specifically, \max{1, \lceil |M|/n \rceil}, where n is the block size).[6] It is provably secure under adaptive chosen-message attacks up to the birthday bound of approximately 2^{n/2} queries, where n is the block size, providing robust protection against existential forgery.[6] OMAC builds upon the CBC-MAC as a foundational primitive to extend security to variable-length messages while minimizing key material requirements compared to alternatives like XCBC or TMAC.[6] This single-key design enhances its practicality for resource-constrained environments, and it has been standardized as CMAC in RFC 4493 for use with AES.[7]Relation to Other MACs
OMAC, or One-Key CBC MAC, builds directly upon the CBC-MAC construction, which traditionally authenticates only fixed-length messages that are multiples of the block size using a single key, but requires additional keys or modifications for variable-length messages to maintain security.[6] In contrast, OMAC employs a single key and derives two subkeys through a fixed transformation of the block cipher output on a zero block, enabling secure handling of arbitrary-length messages via padding and selective subkey XORing on the final block, thus extending CBC-MAC's efficiency while avoiding length-extension vulnerabilities inherent in the basic scheme.[6] OMAC distinguishes itself from multi-key CBC-MAC variants such as XCBC and the three-key CBC-MAC by minimizing key material requirements; XCBC, for instance, uses three distinct keys (one for full blocks and two randomized keys for the final block) to achieve security for arbitrary lengths, increasing storage and scheduling overhead compared to OMAC's single-key approach.[8] Similarly, the three-key construction proposed by Petrank and Rackoff relies on separate keys for message blocks and padding to prevent certain attacks, but OMAC achieves equivalent provable security bounds—up to roughly queries under the birthday bound for an n-bit block cipher—while reducing the total key size from 3n bits to n bits.[6][8] In comparison to unrelated MAC constructions, OMAC relies on block ciphers rather than hash functions, differing fundamentally from HMAC, which combines a cryptographic hash like SHA-256 with a secret key via inner and outer padding to provide authentication, offering broader applicability but potentially higher computational cost in environments optimized for block ciphers. Another block-cipher-based alternative, PMAC, also uses a single key but employs a parallelizable polynomial evaluation over finite fields for message processing, avoiding explicit subkey derivation and enabling better performance in parallel hardware, though at the expense of sequential efficiency similar to CBC-MAC in serial settings.[9] OMAC's design offers advantages including its patent-free status, as explicitly stated by its proposers, making it freely implementable without licensing concerns, unlike some early variants that faced intellectual property restrictions.[10] It remains block-cipher efficient, requiring a single invocation per message block akin to CBC-MAC, and is particularly suitable for hardware-accelerated block ciphers like AES, where subkey generation adds negligible overhead.[6]History
Early Developments in CBC-MAC Variants
The cipher block chaining message authentication code (CBC-MAC) emerged in the early 1980s as a fixed-length MAC constructed from a block cipher operating in CBC mode, where the final ciphertext block serves as the authentication tag after chaining each message block with the previous ciphertext via XOR before encryption. This approach was formalized in standards like ANSI X9.9 (1986) for banking applications and later in NIST FIPS 113 (1985), which specified its use with the Data Encryption Standard (DES) for authenticating fixed-length data blocks. A key limitation of the basic CBC-MAC is its insecurity for variable-length messages, as it suffers from length-extension attacks: given a valid tag for a message prefix of length (where is the block size), an attacker can compute a valid tag for an appended block simply by continuing the chaining process, without knowledge of the secret key. To address this, implementations required either padding messages to a predetermined fixed length or prepending the message length, which added overhead and restricted flexibility for arbitrary inputs.[11] During the 1990s, multi-key variants of CBC-MAC were developed to securely handle variable-length messages while minimizing key management complexity compared to using fully independent keys for each possible length. The ISO/IEC 9797-1 standard (first published in 1999) introduced several such constructions, including Algorithm 3 (often called EMAC or Encrypted CBC-MAC), which applies CBC-MAC to the message and then encrypts the resulting tag with a second key to distinguish different lengths and prevent extensions. Other variants in the standard, like Algorithm 2, used two keys for the final transformation to enhance security against multi-user settings. These approaches incurred higher key storage and derivation costs but enabled broader adoption in protocols needing variable input support. Refinements like ECBC (Encrypted CBC-MAC with independent final key) and FCBC (a fixed-parameter variant) built on these ideas in the late 1990s and early 2000s, optimizing the multi-key setup for efficiency while proving security bounds close to the basic CBC-MAC's birthday limit. ECBC, for instance, uses two keys—one for chaining and one for encrypting the output—to achieve provable pseudorandomness for messages up to roughly blocks long. However, these still required multiple keys, prompting further innovations. In 2000, Black and Rogaway proposed XCBC, a three-key CBC-MAC variant specifically designed for arbitrary-length messages, where subkeys are derived from a master key and applied based on the message length modulo the block size (e.g., one subkey for full blocks and distinct ones for partial final blocks via fixed padding constants). This construction prevents length-extension forgeries by ensuring unique processing of the last block, with a security proof establishing it as a strong pseudorandom function under standard block cipher assumptions, at the cost of only three key derivations. XCBC's efficiency and provable security made it a high-impact precursor to later single-key schemes.Proposal and Refinement of OMAC
The OMAC (One-Key CBC MAC) was proposed by Tetsu Iwata and Kaoru Kurosawa in 2002 and presented at the Fast Software Encryption (FSE) conference in 2003, introducing a single-key variant of CBC-MAC designed to securely authenticate arbitrary-length messages.[12] This construction derives two subkeys from a single master key to handle message padding, addressing inefficiencies in prior multi-key approaches like XCBC while preserving security for variable inputs. The proposal demonstrated OMAC's resistance to existential forgery under adaptive chosen-message attacks, with a security bound of approximately , where is the total number of blocks processed and is the block size.[12] In a 2003 addendum, Iwata and Kurosawa refined the original OMAC parameters to create OMAC1, selecting specific subkey derivation constants to optimize security without increasing key size or computational cost.[13] This refinement strengthened the provable security against existential forgery in the adaptive chosen-message model, tightening bounds to (where is the number of queries) and confirming OMAC1's equivalence to the most efficient one-key scheme possible.[14] The update reduced reliance on idealized assumptions in prior proofs, making OMAC1 more robust for practical deployment while maintaining the single-key paradigm.[13] NIST formalized OMAC1 as CMAC (Cipher-based MAC) in 2005 through Special Publication 800-38B, standardizing it as a block cipher mode for message authentication with AES recommended as the underlying primitive.[15] This adoption ensured interoperability and compliance in cryptographic protocols, positioning CMAC as a direct evolution of OMAC for government and industry use.[2] Iwata and Kurosawa affirmed OMAC's patent-free status in 2003, declaring no existing or pending patents and no intent to pursue any, which removed barriers to its broad implementation.[10]Algorithm
Subkey Generation
The subkey generation in One-key MAC (OMAC), also known as CMAC in its standardized form, is a preprocessing step that derives two subkeys, and , from a single master key using the underlying block cipher with block length bits. This process enables the algorithm to authenticate messages of arbitrary lengths by handling the final block differently depending on whether it is complete or partial, without requiring a second key. The generation begins by computing an intermediate value , where denotes a block of zero bits encrypted under the master key . This serves as the basis for the subkeys, leveraging the block cipher's output to create offsets that mimic the padding effects in traditional CBC-MAC variants.[4] To derive , is left-shifted by one bit position within the finite field , equivalent to a multiplication by 2. If the most significant bit (MSB) of is 1 (indicating a carry from the shift), the result is XORed with a block-size-dependent constant ; otherwise, no XOR is applied: The constant is chosen as the representation of the irreducible polynomial used in , specifically for (e.g., Triple DES) and for (e.g., AES).[4] The second subkey is then obtained by applying the same left-shift operation to , again XORing with if a carry occurs: This sequential derivation ensures that and provide the necessary adjustments for full-block and partial-block processing in the subsequent message authentication steps, maintaining efficiency with a single master key.Message Processing and Tag Computation
In the One-key MAC (OMAC) algorithm, the input message of arbitrary length is first partitioned into blocks , each of bits, where is the block size of the underlying block cipher (e.g., for AES).[1] If the length of is not a multiple of , the final block is incomplete and requires special handling during processing.[1] The computation begins with an initialization vector , and proceeds in a cipher block chaining (CBC) mode for the initial blocks. For to , each block is processed as , where denotes bitwise XOR.[1] This chaining ensures that the authentication tag depends on the entire message, propagating any alteration in earlier blocks to subsequent computations.[1] For the final block , the processing incorporates the subkeys and to handle both full and partial cases securely. If (full block), the modified block is ; otherwise, for a partial block, is padded to bits using the standard padding scheme , where denotes concatenation.[1] The final chaining step is then .[1] The authentication tag is derived by truncating the output of the final encryption to the desired length (commonly for full security with AES), taking the most significant bits of , i.e., .[1] On the verification side, the recipient independently recomputes using the shared key and the received message, accepting the message as authentic if and only if ; otherwise, it rejects the input.[1] This process ensures deterministic tag generation without requiring additional randomness.[1]Security
Provable Security Bounds
OMAC, also known as CMAC in its standardized form, has been proven secure as a pseudorandom function (PRF) in the standard model, assuming the underlying block cipher is a secure PRF.[1] This security holds for messages of arbitrary lengths, distinguishing OMAC from the basic CBC-MAC, which requires fixed-length inputs for similar guarantees. The existential forgery advantage under an adaptive chosen-message attack is bounded by \Adv_{\mathsf{mac}}^{\OMAC}(t, q, \sigma) \leq \frac{4\sigma^2 + 1}{2^n} + \Adv_{\mathsf{prp}}_E(t', q'), where is the number of queries, is the total number of blocks across all queries, is the block size in bits, is the adversary's running time, , , and \Adv_{\mathsf{prp}}_E is the distinguishing advantage against the block cipher as a pseudorandom permutation.[14] This bound improves upon earlier analyses for related schemes like XCBC by providing tighter dependency on the total message length rather than the maximum individual message length, making it more efficient for scenarios with many short queries.[14] For CMAC using AES-128, NIST confirms this level of security, inheriting the block cipher's 128-bit security margin when the total message blocks remain below approximately .[16] The proof relies on hybrid arguments and game-hopping techniques, constructing intermediate games that bound the probability of collisions in the internal state while reducing security to the PRF/PRP assumption on the block cipher.[14] Specifically, Iwata and Kurosawa's analysis for OMAC1 establishes indistinguishability from a truly random function through a sequence of hybrids that account for subkey generation and message padding, yielding the tight term.[14] A formal verification using EasyCrypt for CMAC and its variants confirms similar bounds, with the PRF advantage at most , where is the maximum query length in blocks, further validating the original results under computational soundness assumptions.[17] These bounds assume a secure underlying block cipher, such as AES-128, which provides bits of security against distinguishing attacks, ensuring the overall MAC remains secure up to roughly block operations before the birthday bound is approached.[16] The analysis holds in the multi-user setting as well, with the advantage scaling linearly with the number of users under standard reductions.[17]Known Limitations and Attacks
One-key MAC (OMAC), standardized as CMAC, avoids the length-extension vulnerability inherent to basic CBC-MAC by employing subkeys derived from a single master key and applying distinct constants (such as and ) to the last block based on its padding status, ensuring that appending data does not preserve the tag validity without knowledge of the key.[12] However, like all MACs, CMAC requires the verifier to process the entire message to compute and check the tag, preventing partial verification and exposing it to offline attacks if messages are truncated or replayed without protocol protections.[18] CMAC implementations are susceptible to side-channel attacks, including timing and power analysis, particularly during subkey generation via block cipher encryption of a constant input or in the iterative block encryptions for message processing, where variable execution paths or data-dependent operations can leak key information.[19] Mitigations involve constant-time implementations that eliminate branch conditions and use uniform memory access patterns, as recommended for secure software realizations of block-cipher-based MACs.[20] No practical cryptanalytic breaks exist for AES-CMAC, with the construction maintaining full security up to the birthday bound of approximately queries for 128-bit blocks under standard models.[21] Theoretical distinguishing attacks require more than queries, where is the key length, exceeding the provable security bounds and posing no immediate threat.[21] CMAC's security relies on the underlying block cipher, rendering it non-quantum-resistant; Grover's algorithm enables key recovery in time, halving the effective security (e.g., 64 bits for AES-128), necessitating replacement with post-quantum block ciphers for long-term use.[22] Additionally, key reuse across CMAC and encryption modes risks related-key attacks, so separate keys are recommended to preserve independence.[18] In multi-user settings, CMAC's security degrades as the number of users increases, with the forgery advantage bound scaling as , where is the total queries and the block size; concrete analyses show the bound remains tight but requires rekeying sooner for large to avoid exceeding total operations.[23]Variants
OMAC1 and CMAC Standardization
OMAC1 represents a refined variant of the original OMAC proposal, introduced in 2003 by Iwata and Kurosawa to enhance security through specific subkey generation involving left shifts by one bit and XOR operations with a constant derived from the block size.[13] This version addresses potential weaknesses in earlier parameter choices, ensuring provable security bounds for arbitrary-length messages when using a pseudorandom permutation as the underlying block cipher, and it functions equivalently to the later standardized CMAC in terms of computation.[12] The CMAC algorithm was formalized by NIST in Special Publication 800-38B in 2005 as a block cipher-based message authentication code, specifying the CMAC algorithm for use with approved block ciphers, such as AES with 128-bit blocks and keys of 128, 192, or 256 bits, or the Triple DES algorithm (TDEA) with 64-bit blocks.[2] The specification precisely defines the constant for subkey derivation—equal to where for AES, yielding —and allows truncated tag lengths of 32, 64, or 128 bits to balance security and efficiency, with 128 bits recommended for full-strength applications.[4] Compared to the original OMAC, CMAC incorporates minor adjustments for improved specification clarity and tighter security proofs, such as standardized handling of the last block padding and subkey selection based on the message length modulo the block size.[2] The variant OMAC2, which uses different constants for subkey generation, was not pursued in standardization due to its comparatively weaker security bounds against certain distinguishers.[12] In 2006, the Internet Engineering Task Force published RFC 4493, establishing AES-CMAC as an Internet standard for message authentication, complete with detailed pseudocode, key derivation rules, and test vectors to ensure interoperability across implementations.[5] AES-CMAC has seen widespread adoption as a secure primitive in protocols including IPsec for authenticating ESP and AH payloads (as specified in RFC 4494).[24]Recent Extensions like CMAC-C1
In recent years, researchers have proposed extensions to the CMAC algorithm to address emerging security requirements, particularly in the context of committing security for message authentication codes (MACs). One notable advancement is CMAC-C1, introduced in 2024 as a variant that enhances CMAC with key-committing and context-discovery security properties. These properties prevent adversaries from recovering the secret key from valid MAC tags and obscure the structure of authenticated messages, respectively, making CMAC-C1 suitable for applications where such protections are critical, such as in secure multi-party computations or protocols vulnerable to key extraction attacks. The technical modifications in CMAC-C1 focus on the final block processing step of the standard CMAC procedure. Specifically, it replaces the direct block cipher invocation on the last chained value with the Davies-Meyer construction, defined as , where is the underlying block cipher and denotes bitwise XOR. This change introduces additional masking without significantly increasing computational overhead, preserving the efficiency of CMAC for variable-length messages. Security proofs for CMAC-C1 establish it as a pseudorandom function (PRF) under the ideal-cipher model, with key-committing advantage bounded by and context-discovery advantage by for up to queries, where is the block size. These bounds demonstrate stronger notions than standard CMAC while relying on the same underlying assumptions. Beyond CMAC-C1, minor variants of OMAC and CMAC have been adapted for specific block ciphers to meet regional standards. For instance, CMAC is implemented with the SM4 block cipher, China's national standard for symmetric encryption (GB/T 32907-2016), in various cryptographic libraries and protocols to support domestic security requirements. Earlier proposals like GCBC1 and GCBC2, presented in 2009, aimed to improve processing speed for short messages by incorporating generalized chaining with variation operations, achieving performance gains of up to 1.5 times over OMAC for two-block messages while maintaining provable security.[25] However, these have seen limited adoption compared to standardized CMAC implementations. Looking ahead, ongoing research explores adaptations of CMAC-like constructions for post-quantum settings, potentially integrating sponge-based primitives (e.g., as in Ascon) or lattice-hard block ciphers to resist quantum attacks like Grover's algorithm on symmetric keys. Such extensions would require re-proving security bounds under quantum-idealized models, addressing gaps in current coverage of recent threats like quantum key recovery.Applications and Implementations
Software Libraries and Tools
The OpenSSL cryptographic library has supported CMAC since version 1.0.1, released in 2012, providing functions such asCMAC_Init, CMAC_Update, and CMAC_Final for computing AES-CMAC values. These APIs enable developers to generate message authentication tags using block ciphers like AES, with the implementation designed for constant-time operations to mitigate side-channel attacks such as timing vulnerabilities.
In Python, the cryptography library offers CMAC functionality through its hazmat.primitives.mac.cmac module, allowing secure computation of cipher-based MACs with algorithms like AES.[26] This high-level interface supports key derivation and tag verification, often validated against test vectors from RFC 4493 to ensure compliance with the AES-CMAC specification.[5] Additionally, PyCryptodome provides CMAC support via its Crypto.Hash.CMAC module for similar use cases.[27]
For Ruby developers, the cmac-rb gem provides a C extension-based implementation of AES-CMAC as defined in RFC 4493, leveraging OpenSSL for efficient computation in resource-constrained environments.[28] Released in 2014, it offers a lightweight wrapper for generating and verifying MAC tags without requiring full OpenSSL dependency management.[29]
The Bouncy Castle library for Java has included CMAC support since at least version 1.37 (2008), via the org.bouncycastle.crypto.macs.CMac class, enabling integration with JCE providers for block cipher-based authentication. This allows for flexible use in applications needing provably secure MACs, with the API supporting various block sizes and ciphers. Similarly, BouncyCastle.NET for C# provides equivalent CMAC capabilities through its cryptography APIs, facilitating .NET-based implementations of OMAC/CMAC for message integrity in enterprise software.[30]
In Rust, the cmac crate provides a pure-Rust implementation of CMAC (OMAC1), supporting AES and other block ciphers for constant-time, secure MAC computations, with ongoing audits as of 2025.
