I know that a client needs to establish a rendezvous point in order to connect to a hidden service but the rendezvous points neither knows the hidden service nor can it decrypt the data. If it doesn't know the hidden service how does the rendezvous point know what relay to send traffic for the hidden service too. Another question I had is which relay would know what circuit is used by the hidden service to connect to the rendezvous point?
It works like this: 1. Lets say Bob want to publish hidden service.
Bob first need to deploy the service on the server. Then we need to allow Bob to select the contact point for the service, these contact points are known as introduction point.
Bob’s Tor client generate the public key and sends the key to introduction point. Bob made tor circuit with introduction point instead of direct connection so Bob’s identity can be kept private. Introduction points only receive public key for the service not the IP address of the service.
Hidden service assembles a hidden service descriptor which contains public key , introduction point and sign it with service’s private key. This descriptor is uploaded in distributed hash table .
This descriptor can be found by client by requesting xyz.onion where xyz is 16-character name derived from public key of the service.
2. Lets say Alice has learned about Bob service and she want to access the service. She already knows descriptor of Bob’s service
Alice want to communicate anonymously. Her Tor client creates tor circuit by randomly picking relay and asks it to act as rendezvous point
Alice send rendezvous cookie to one of the Introduction point. Cookie contains information about rendezvous point and introduction message encrypted using service public key. This communication take place via Tor circuit
The hidden service get the request and obtain address of rendezvous point and send the one time secret to it in a rendezvous message.
At this point it is very important that hidden service sticks to same set of entry guard when creating new circuit. Entry guard is set of relays which is always picked as first node while creating circuit. These entry guard are chosen randomly
3. In the last step, the rendezvous point notifies the client about successful connection establishment. After that, both client and hidden service can use their circuits to the rendezvous point for communicating with each other. The rendezvous point simply relays (end-to-end encrypted) messages from client to service and vice versa.
Once rendezvous point get the response from service it informs client that connection is established and now client and service can talk with each other through rendezvous point using their circuit.
In general there are 6 relays used in end to end communication. Three of them are chosen by service (a.k.a introduction point) and three are chosen by client including rendezvous point