I'm trying to implement, as an exercise, a protocol based on the cipher suite ECDHE-RSA-AES256-GCM-SHA384
.
As I understand things, ECDHE
is used for the key exchange, RSA
for the authenticity of the ECDHE public key, AES (in GCM) for encipherment, and SHA to get a random-like key to use with AES from the ECDHE derived secret key.
Now the thing I don't understand is that AES256 requires a 256 bits key but SHA384 produces a 384 digest. So I have two questions:
- Why not simply use SHA256 here to produce a digest whose size matches the expected size for the cipher algorithm key ? (Has it something to do with the fact that both AES256 and SHA384 operate faster on 64 bits architectures ?)
- What operation should one perform to use the 384 bits digest as an AES256 key ? Just keep the first 256 bits ? Or am I missing something ?