I have been able to exchange session keys on two devices using Libhydrogen's Key exchange using the N variant method. I also want to authenticate both devices to have some protection against the Man in the middle attack. Can I use libhydrogen's Public key signatures method for that? If yes, how to use it with key exchange?

Q 1: This method generates a key pair for signing. Should I first transfer the public key of the server to the client? The client can then sign the session key and send it back to the server for verification? Would this work?

Q 2: Should the I use libhydrogen's signature method for authentication before the key exchange or after?

Any help would be appreciated.


1 Answer 1


All the key exchange schemes provided by libhydrogen (actually the Noise protocol) are secure against MITM.

With the N variant, the client has to know the server's public key, and will not return a valid shared key pair unless the response comes from a server that has the corresponding secret key.

If you need the server to authenticate the client as well, use the KK variant instead.

Signatures are not needed, unless you want keys to be signed by a certificate authority.


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.