I have an application that receives certain pseudo-random input values and computes their keyed hash using HMAC-SHA256. The hashing key itself is 256-bits long, generated at random by a CSRNG.

Two questions:

  1. Which category does the hashing key fall under in NIST's 2016 Recommendations? Is it a "Symmetric Data Encryption Key"?

  2. If it doesn't fall under any of those categories, is there a recommended cryptoperiod for it, or can I use it ad eternum?

(I suspect that this is an irrelevant detail, but the pseudo-random input values the application is processing are themselves HMACs of other input values. However, they are computed by a third party. So, since I do not know or have access to the hashing key they use, I'm treating them as "pseudo-random.")

  • $\begingroup$ Cryptographically it should be good forever. Changing keys might still be useful to limit the impact of a compromised key. $\endgroup$ Commented Jun 6, 2017 at 21:10

1 Answer 1


Theoretically as pointed out by @CodesInChaos there is no need to rotate keys as long as they remain secret.

Also as @CodesInChaos points out, you need to architect the system for key rotation in the event of key compromise.

The best way to do that is to build key rotation into the app and operational tooling, and then put procedures in place to rotate keys regularly. That way you know key rotation will actually work when you really need it.

During the Heartbleed incident there were banks that were unable to re-key many of their certificates for several months despite regulator requirements that they be changed immediately. Rekeying was an infrequent manual process on their varied and ancient systems; some had never been re-keyed and nobody in house knew how to do it. It simply couldn't be done in a timely manner.

Regular exercise of key rotation prevents this sort of problem. Automation makes it easy. Think of it as DR planning and testing for your crypto keys.

  • $\begingroup$ That's a good suggestion, thanks. Just one final question: would you say that an HMAC key should be considered a symmetric authentication key or a symmetric encryption key (or neither) under NIST SP800-57 Part 1? $\endgroup$
    – G Santos
    Commented Jun 8, 2017 at 15:21
  • $\begingroup$ @GSantos HMAC = Hashed Message Authentication Code. $\endgroup$
    – rmalayter
    Commented Jun 9, 2017 at 1:52

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.