I have 16 byte shared secret , I am using HKDF-SHA256 to derive 2 ,32 byte keys , one for encryption aes256-gcm and another hmac-256 , the salt info used for HKDF are sent publicly along with the encrypted message will it be a problem if an attacker tampers these values.

is there anyway to detect tampering.


1 Answer 1


No, usually you have to validate some kind of authentication tag after agreeing keys. So together with the key establishment you can already calculate e.g. a HMAC value over the previous messages and verify that HMAC once the shared secret is computed over there as well. This is e.g. how TLS works.

Of course, you can also detect tampering after receiving an authenticated message, but in that case you have the trouble that you don't know which part of the protocol was perturbed. This may not sound that big of a problem, but in many protocols it is the difference between entity and message authentication, and this may for sure complicate error handling within the protocol.

This was for instance an issue with the EAC/PACE protocol in ePassports which was fixed in the German EAC2.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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