I am puzzled by the question if not only the data, but also the header of a relay cell in Tor is onion-encrypted.

I understand that when an OR receives an outbound relay cell and peels off one layer of encryption, the relay header's 'recognized' field being 0 tells the OR if it is the last hop (if the relay digest confirms this). This sounds like the relay header is onion-encrypted, just like the actual data contained in the relay cell.

But then, the other relay header fields (relay_command, stream_id, payload_len) seem to be visible (and identical) at every hop, independent of it being the final hop or an intermediate relay. This sounds like the relay header isn't onion-encrypted.

Clearly, I must be missing something? Grateful for any clues!

2 Answers 2


In addition to the circuit encryption layer, each individual link between two relays is encrypted with TLS. This hides the contents of the encrypted circuit (including the header) from any eavesdropping adversary. Only the relay and its peer know the TLS shared secret.

This means that, while the client does know all three circuit keys for all three relays, it does not know the link key used between the guard and the middle, or between the middle and the exit.

See section 2 of tor-spec.


Tor Project Overview


To create a private network pathway with Tor, the user's software or client incrementally builds a circuit of encrypted connections through relays on the network. The circuit is extended one hop at a time, and each relay along the way knows only which relay gave it data and which relay it is giving data to. No individual relay ever knows the complete path that a data packet has taken. The client negotiates a separate set of encryption keys for each hop along the circuit to ensure that each hop can't trace these connections as they pass through.

Bold is my emphasis.

  • I'm not sure how this is an answer to the question. The fact that each relay only knows its neighbor relays does not have anything to do with whether or not headers in circuit cells are also encrypted.
    – forest
    Commented Nov 24, 2022 at 1:09
  • @forest - If the headers were not encrypted the relays would know more than its immediate neighbor. I'm not sure why this isn't obvious. Commented Nov 25, 2022 at 21:49
  • OP is not talking about IP headers but about onion cell headers (and because they're encapsulated, a given relay only sees its immediate neighbors).
    – forest
    Commented Nov 27, 2022 at 0:13
  • @forest - You're saying the same thing I said only I stated it as a contrapositive. Commented Nov 28, 2022 at 4:43

You must log in to answer this question.

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