# The Authentication and Message Exchange Protocol

[A]lice wants to communicate with [B]ob privately.

## Protocol Steps

1. Authenticate to the server and establish communication.
   1. A tells the server to open a communication.
      2. A sends an id_code to the server.
      3. If someone answered with the same id_code, A gets a comm_id from the server.
   2. B tells the server to answer A's communication request.
      2. B sends A's id_code to the server.
      3. The server checks if it matches and returns a comm_id to B.
2. Generate and exchange an ephemeral key.
   1. A and B generate RSA public-private key pairs.
   2. A and B exchange public keys.
   3. A and B encrypt their chosen secret value and send them to each other.
   4. A and B decrypt the received secret values and add them to their secret value.
   5. The result is the ephemeral key.
3. Instantiate symmetric encryption using the ephemeral key.
   1. AES, CTR-mode
4. Authenticate each other directly.
5. (?) Check communication transcript (avoid malicious server).