Is it safe to use CTR encryption mode and authenticate it with HMAC(message, key), where key is the cipher encryption key, and the key is unique for each message? Would it be safer if I change the key a little? For example, flip a lower bit. Or I need to have independent secret for HMAC?

  • $\begingroup$ "Would it be safer if I change the key a little?"; might you mean 'change the IV..." $\endgroup$
    – poncho
    Aug 19, 2022 at 17:55
  • $\begingroup$ It's probably safe to use the same key for AES and HMAC because of how distinct the algorithms are. However, it's not recommended and not difficult to just derive two separate keys from the same input keying material/master key using a KDF. $\endgroup$ Aug 19, 2022 at 18:35


Your Answer

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

Browse other questions tagged or ask your own question.