My end goal is to encrypt data with AES-128, send it to other process and decrypt it there. While using DH key exchange protocol.
I have used DH to generate a 256 bytes shared secret, but I can't use that key to fit the 128-bit encrypting function.
I read that the secret needs to be fed through a "Key-based key derivation function" (KBKDF), but as I understand that gives you a hash which then you won't be able to dehash... so how does the other program can decrypt the message?
Can I just truncate the secret message to 128-bit? (I don't think this is the right solution though).
How would the encryption and decryption of the hashed secret work?
Side note. I am trying to do all this with OpenSSL library in C
Thanks.