Let's assume we use DH with a cyclic group modulo p. As I know safe length of p must be at least 1024 bits. That means that generated key could be very big. But what do next? What kind of symmetric-key algorithm to use? DES requires key length to be exactly 56 bits. AES - 128/192/256 bits. We have no guarantee that key generated by DH will be n bits. It could be longer or even shorter. Do we have to reduce or extend key to fit it in AES or (3)DES? Or is there an algorithm that works with any key length?


1 Answer 1


What you are looking for is a key-derivation function.

As you have correctly observed one can make mistakes when using a shared secret and the KDF does exactly what you want.

A typical implementation would be a hash.

Note that short keys are not really an issue here. They should only occur with appropriately small probability and when padded with zeros would be acceptable keys.


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.