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.