There are Client and Server.
Client have previously send public keys for x25519 and ed25519 to the server. And now need to prove that it has private keys for them.
I have found similar solutions in description of ssh protocol by Digital Ocean: https://www.digitalocean.com/community/tutorials/understanding-the-ssh-encryption-and-connection-process#authenticating-the-user's-access-to-the-server
And in SSH Authentication Protocol RFC: https://tools.ietf.org/html/rfc4252#section-7
- Server generates some 'nonce'. Encrypts it with x25519 public key of the client and sends to the client.
- Client decrypts the 'nonce' with corresponding x25519 private key. Signs it with ed25519 private key and sends original data with the signature attached.
- Server checks that the data equals to the one was send in (1). And checks signature. Proof-of-Possession is done.
I have two questions:
- Is this scheme correct ? What should I review/read to make it correct ?
- In the article from Digital Ocean you can find that client doesn't send raw data back to server but gets md5 of it and sends only md5. Why so ? What's the point of that operation ? Should I do the same ?