I have a hard time understanding how a message is transmitted, when the Public Keys are used and when the Session Keys.
- Tor Client connects to a directory server to get a list of active relays & exit relays with their policies (address, public key). I verify these list.
- Tor Client automatically chooses three relays with a compatible exit policy
- I start building my Tor-Circuit One-Hop at a time.
- I send a Create Cell to the Relay 1 (Is this encrypted with 1 Layer through the Public Key of Relay 1?)
- The First Hop and the Tor Client establish a temporarily Session Key through the Diffi-Hellmann-Key-Exchange
- The Tor Client requests Relay 1 to extend his Tor-Circuit with another Hop to Relay 2 (Is this encrypted with 2 Layers through the Public Key of Relay 1, Relay 2?)
- A second Session Key is established between the Tor Client and Relay 2, trough the Tor-Circuit. (Also encrypted in 2 Layers?)
- The Tor Client requests Relay 2 to extend the Tor-Circuit with another Hop to Relay 3
If this step isn't encrypted with 2 Layers (with the PK of Relay 1 & Relay 2), Relay 1 would know the address of Relay 3, or does it encrypt the Create Cell(R3) with the temporarily Session Keys.
If it uses the Session Keys to encrypt why would we need the Public Keys, to identify the Relays?
I thought the Session Key is only used for the response and the Public Keys for the Request, or do I understand something completly wrong?
In my current view the Request has three layers of Encryption with the Public Keys, on each layer it reveals the next target to forward the message. (but the relay already knows the next target, since it had to establish a tor-circuit)
The request is encrypted at each relay with the temporarily Session Key, the Client then can decrypt all three layers since it established these Key with the respective relay.
I'm no nativ english speaker, so I hope its understandable.