How can we link AES with Elliptic Curve Diffie-Hellman Key Exchange Method

Actually, I am working on a project to combine symmetric and asymmetric cryptographic algorithms.

The shared secret key for AES will be generated through the Elliptic Curve Diffie Hellman Key Exchange (ECDH) Method. I have one question that ECDH will generate a shared secret key of 256 bit or more length key. For AES-128 I need a secret key of 128 bit but ECDH is not generating the 128-bit key.

So how can I convert the variable-length key into 128 bit?

• In SO, if the answer is useful, one usually upvotes, and if you are the asker, if the answer satisfies you, you can accept the answer. Have fun. Oct 19, 2021 at 14:44

ECIES also authenticates the ciphertext as Encrypted-then-MAC. In order to use MAC, you need another key. You can use HKDF to derive many keys by providing different info parameters for each required key. Since your key is random you don't need the extract part of the HKDF, if available, just use expand part.