* Read the key exchange data from a \c Packet that came from the server, * @param p The packet that has been received. * @return True when the data seems correct. */
| 199 | * @return True when the data seems correct. |
| 200 | */ |
| 201 | bool X25519AuthenticationHandler::ReceiveRequest(Packet &p) |
| 202 | { |
| 203 | if (p.RemainingBytesToTransfer() != X25519_KEY_SIZE + X25519_NONCE_SIZE) { |
| 204 | Debug(net, 1, "[crypto] Received auth response of illegal size; authentication aborted."); |
| 205 | return false; |
| 206 | } |
| 207 | |
| 208 | p.Recv_bytes(this->peer_public_key); |
| 209 | p.Recv_bytes(this->key_exchange_nonce); |
| 210 | return true; |
| 211 | } |
| 212 | |
| 213 | /** |
| 214 | * Perform the key exchange, and when that is correct fill the \c Packet with the appropriate data. |