10

I know that when sending data from the Tor client to a server it is encrypted and gradually get decrypted on the way there.

This question is about when the server responds. The data must be encrypted or the entry guard (who knows your location) can read it and work out exactly what you are doing.

My assumption is that the exit node encrypts the response, sends it to the middle.

Then I wonder if the middle node encrypts it more before sending to the entry node and then the entry node encrypts it more before it sends it to the Tor user to decrypt, or if it just sends it without encrypting any more (as more encryption is unnecessary).

I've been trying to find this in the documentation and have been unsuccessful so far.

1 Answer 1

8

The circuit: [ Tor user <-> Guard node <-> Middle node <-> Exit node <-> Server ]

Sending data to server:

  1. The Tor client always encrypt the data for the exit node
  2. And then encrypts it again (another layer) for the middle node
  3. And then again (yet another layer) for the guard node

This way one layer need to be peeled of at each hop in the network. If end-to-end encryption the data is also encrypted for the server first, in yet another layer (HTTPS/TLS, not by Tor).

Recieving data from server:

  1. The exit node encrypts answer data for the Tor user
  2. Then the middle node encrypts it again for the Tor user
  3. Then the guard node adds yet another layer encryption for the Tor user
  4. Tor user decrypts all layers

The process is reversed in other words. Simplified, the nodes just "add back" the encryption they peeled of when sending back the answer. If this wasn't done there wouldn't be any purpose of using multiple hops, because it would be possible for an adversay running Tor nodes to track where the answer data travels.

5
  • Thank you, this is what I expect. Do you know if there is any official documentation stating this?
    – puser
    Jan 16, 2014 at 15:35
  • No, that is how onion routing (which Tor uses) is defined. There should be papers on it. A quick web search brings up Wikipedia article on onion routing that says the same things I said above.
    – Rhin
    Jan 16, 2014 at 16:22
  • 2
    You can find a description in the Tor design document
    – Jens Kubieziel
    Jan 17, 2014 at 14:13
  • "When an OR later replies to Alice with a relay cell, it encrypts the cell's relay header and payload with the single key it shares with Alice, and sends the cell back toward Alice along the circuit. Subsequent ORs add further layers of encryption as they relay the cell back to Alice." that was from the tor design document. Thanks all. Though there doesn't seem to be an explanation as to why it does this in the documentation.
    – puser
    Jan 17, 2014 at 16:16
  • The above solution sounds perfect. May I please know what keys does A,B,C use to encrypt data while sending back from the server to the client. Thank you! Jun 9, 2017 at 15:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .