We have safenet HSM. Our system requires us to generate AES-256 keys. Which approach shall I take ?
Instruct HSM to generate AES keys.
Use HSM to create an input key material and use HKDF to derive keys.
HSM is supposed to be able to generate high quality keys. Is there a need for the second approach ?
Looking at the RFC 5869 for HKDF, in the Information section :
Implying that if you were to use the HRNG (Hardware Random Number Generator) of the HSM and then used the HKDF, you would essentially be injecting
Pseudo-Randomnessinto your AES Key, which totally defeats the purpose.The option #1 becomes then obviously the right choice, otherwise the whole point of using the RNG of the HSM is defeated.