Can someone elaborate on how 'signing' is done using AES- CMAC and AES-HMAC?

HMAC Signing as I understand: Compute the HMAC( Hash the key and the input concatenated in a special way) Verification: Verify if for the given input and secret key the calculated HMAC(signature) is the same as that is computed. But how is AES used in conjunction with this? is it HMAC(AES(Data)) then what is CMAC?

CMAC signing as I understand: is to encrypt the input using the key by applying AES algorithm and then calculating a MAC by applying a special concatenation step of the key and resulting encrypted data??. For verification, the signature should be compared with the newly computed CMAC of input and key at the receiving end.

Please clarify


Also, does openSSL libs support AES CMAC and AES HMAC?

  • 8
    $\begingroup$ Where did you read about AES HMAC? Perhaps you misunderstood and the source was talking about authenticated encryption that encrypts using AES (e.g. in CTR mode) and adds HMAC-SHA-* for integrity? $\endgroup$ Jan 13, 2016 at 8:43
  • $\begingroup$ Read about Message Authentication Codes in general. HMAC and CMAC are MACs. $\endgroup$
    – Z.T.
    Jan 13, 2016 at 9:38

1 Answer 1


A similar question as been asked before: Use cases for CMAC vs. HMAC?

To resume it, AES-CMAC is a MAC function. It can be seen as a special case of One-Key CBC MAC1 (OMAC1) which also a MAC function that relies on a block cipher (so AES in the present case).

HMAC is also a MAC function but which relies on a hash function (SHA256 for HMAC-SHA256 for example).

So the term AES-HMAC isn't really appropriate. If you read it somewhere, it could signify the process of computing a HMAC on the message you want to encrypt to ensure the integrity property (AES$[message ||$ HMAC$(message)]$ for example).

Note that there exists authenticated ciphers that simultaneously ensure confidentiality, integrity and authenticity.

Also, does openSSL libs support AES CMAC and AES HMAC?

OpenSSL supports HMAC primitive and also the AES-CMAC one (see How to calculate AES CMAC using OpenSSL?)

  • 3
    $\begingroup$ AES-HMAC might also refer to cipher=AES(Ke,message), and then transmit cipher||HMAC(Kh,cipher) (in other words, encrypt-then-mac) $\endgroup$ Aug 19, 2019 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.