I got a question with the RFC of HKDF https://tools.ietf.org/html/rfc5869.

There is a maximum specified for the output keying material. The length of the OKM shall be <= 255*HashLen. What does it mean? For example there is a hashfunction with output of 32 byte. Is my maximum OKM then 255*32 = 8160 Byte? Or does it mean, my maximum repetition in the loop is smaller or equal than 8160? So that would mean, that you can generate 8160 (rounds) * 32 (per round output) 261120 Byte output.

I am a little bit confused...thanks for help.


The former. Maximum output must be <= 255*HashLen. So for SHA256 which has a digest of 32 bytes, max HKDF output would be <= 8160 bytes. For SHA512 which has a digest of 64 bytes, max output must be <= 16320 bytes. I can't imagine you would need a key longer than 8160 bytes. If you require multiple keys you can use the 'info' parameter for different contexts/keys from the same PRK.

  • 1
    $\begingroup$ That last sentence scored an instant +1 from my side. I would also use a specific info parameter for an for a deterministic IV, in case one needs to be derived from the master key material. Note that e.g. in hardware tokens you often need to explicitly derive each key. In software you can just split a byte string, but try to do the same in a Cryptoki (PKCS#11) implementation and you'll run into problems. $\endgroup$ – Maarten Bodewes Nov 23 '16 at 15:26

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.