简体   繁体   中英

How to use HKDF with ECDiffieHellmanCng

I am attempting to use the ECDiffieHellmanCng class to perform key exchange operations between a desktop and a device connected over BLE. The specs of the system require that HKDF be used to derive the key. That doesn't appear to be an option for the hash functions in the ECDiffieHellmanCng class. Is there a way to do this? I would then need to take the resulting key and pass it into a AesCng object.

The ECDiffieHellmanCng sucks since it forces you to use one of three pre-defined post processing key derivation functions (Hash, Hmac or Tls). If none of these match your protocol you are out of luck.

You might be able to use the Hmac variant however since that is the first internal operation for HKDF ("extract"). Just set the HmacKey property to the salt in HKDF. Then manually perform the second Hmac operation yourself ("expand") to get the final HKDF result.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM