keys2 (42)
The keys2 message is the final step in the quantum-resistant key exchange handshake initiated by an acceptAdd2 message. The original requester, having derived the shared secret, sends back the necessary components for the other party to derive the same secret.
This message ensures both parties arrive at the same symmetric keys for the session without ever exposing the keys themselves on the network.
Core Data Types
IxiBytes: See IxiBytes Encoding.IxiVarUInt: See IxiVarInt Encoding.
Payload Structure
| Field | Data Type | Min | Max | Description |
|---|---|---|---|---|
ecdhPubKey | IxiBytes | * | * | The public key part of the sender's newly generated ephemeral ECDH key pair. |
mlkemCiphertext | IxiBytes | * | * | The ML-KEM (Kyber) ciphertext generated by encapsulating a secret using the recipient's ML-KEM public key (from acceptAdd2). |
chaChaSalt | IxiBytes | 32 | 32 | A 32-byte random salt used for deriving the ChaCha symmetric key. |
capabilities | IxiVarUInt | * | * | A bitfield of StreamCapabilities supported by the sender. |
Behavioral Notes
- Sender Action: After receiving
acceptAdd2, the client (the original requester) performs two cryptographic operations:- Derives an ECDH shared secret using its own ECDH private key and the
ecdhPubKeyfrom theacceptAdd2message. - Generates a new secret and encapsulates it using the
mlkemPubKeyfrom theacceptAdd2message, producingmlkemCiphertext. It then sends its ownecdhPubKeyand themlkemCiphertextin thiskeys2message.
- Derives an ECDH shared secret using its own ECDH private key and the
- Recipient Action: The recipient of
keys2(who sentacceptAdd2) performs the final key derivation:- It derives the same ECDH shared secret using its ECDH private key and the
ecdhPubKeyfrom this message. - It decapsulates the
mlkemCiphertextusing its ML-KEM private key to reveal the same encapsulated secret. - It combines both secrets and uses the salts (
aesSaltfromacceptAdd2andchaChaSaltfromkeys2) to derive the final, identical AES and ChaCha session keys.
- It derives the same ECDH shared secret using its ECDH private key and the
- Handshake Completion: Once this message is processed, the handshake is complete (
handshakeStatus = 3), and secure, encrypted communication can begin.