if i calculate a AES_CMAC for 64 Bytes, i get a 16 Byte CMAC.
Is it ok to use only the first 4 Bytes for authentication?
Can i assume that if the first 4 bytes are correct, the other bytes must be ok too?
Thank you!
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It only takes a minute to sign up.
Sign up to join this communityWith AES_CMAC, tag truncation acts like you would expect; if an attacker generates a message and a random tag, then they have a $2^{-32}$ (or one in 4 billion chance) of happening to pick the correct random tag (and getting the message accepted), and with AES_CMAC, there's nothing they can do to improve on that.
Is a $2^{-32}$ success probability per attempt by the attacker acceptable? Well, that depends on what your authenticating (and the cost to you of accepting an invalid message); in some scenarios, that might be quite acceptable, in others (e.g. doing financial transfers) it might not.
No, you cannot assume that if the first four bytes are correct, the other bytes are correct, too.
Truncating the CMAC tag to four bytes means that an adversary will be able to forge a valid tag value (without knowing the secret key) with a success probability of about $2^{-32} \approx 4\cdot 10^{-9}$. This value is usually considered in most threat models as being way too large, i.e., not secure enough.