I'm currently implementing, with crypto++, and AES tranmsission system, whose key is based on a previous MasterSecret of 256 bits (which has been expanded using PBKDF2).
This MasterSecret is then split into a key and an iv, to encrypt a message using AES-GCM.
I must work with AES-256, so my key must be 256-bit long. The iv for GCM is always 128-bit long.
So, briefly, I must extract from a 256-bit MasterSecret a 256-bit key and a 128-bit IV.
How to do it ?
I thought of taking the MasterSecret as the key, and then hashing the key to get then the iv of the desired length.
Is there a more efficient/elegant way to obtain 384 bits from a 256 bit MasterSecret ?