jedisct1 / libhydrogen

A lightweight, secure, easy-to-use crypto library suitable for constrained environments.
https://libhydrogen.org
Other
594 stars 88 forks source link

Leaked public keys of KK_variant? #133

Closed KamiK2K closed 1 year ago

KamiK2K commented 1 year ago

Hi,

I am trying to use the KK_variant of the key exchange mechanism, where public keys of parties (generated using hydro_kx_keygen function) is exchanged in the clear. Does this endanger the security of the tx and rx session key pairs?

This is considering the fact that I have authenticated both sides with signature verification. Detailed steps is the attached picture (both sides know each other public keys for signature verification).

image

Crest commented 1 year ago

Is the connection between device and PC in step 3 trusted in your design?

KamiK2K commented 1 year ago

No its not trusted in that step, its a Bluetooth or USB connection,

In other words the ephemeral public key of the device generated at step 3 can be sniffed by other devices,

But I regenerate those keys using hydro_kx_keygen() function call to provide forward secrecy for each session,

each session usually lasts few hours,

so in this case, my main question is if the public keys of both sides generated using hydro_kx_keygen() function for each session gets received by other devices, does that impose a threat for security of that session? Can the attacker somehow recover the session keys? and decrypt the exchanged messages?

Can I ask for you help @jedisct1 on this please?

jedisct1 commented 1 year ago

This is perfectly fine. Public keys can be leaked (hence "public"); it doesn't allow an attacker to recover the session key without the corresponding secret key.