I have two questions regarding Tor (onion routing).
How do I receive responds from a server when I use onion routing, I've read that, the last node(exit node) will use the same path I used but in the reverse order, but that means that the last node will know who I am. It was never clear anywhere but I guess that the exit node(node 100) has saved only the node before it , only knows node99 , and node99 knows only node98 etc, but that still doesn't make any sense since if the exit node , knows only the node before it, it will encrypt only with the public key of the node before it, etc.. . So the communication is still not safe.
If I the website use SSL how will the onion routing work? If its like this me->encryption node1->encryption node2->...->encryption node100->website running SSL. Will I be the one to encrypt the connection from node100 to the website running SSL, or will node100 do that work? Meaning can node100 view the message I want to send the the website running the SSL and then encrypt the message with the public key of the website, or do I encrypt it the first place making impossible for node100 to view the message. And when the website responds , it will respond encrypting the message with the public key of node 100, right?
Edit to reply to @Phillip
[Me]=>Node=>Node...=Node[Exit]=>SSL-Site , exit node doesn't know the clear text cause I encrypted with the site's public key(SSL).
SSL-Site=>(SSL encrypted with my public key)Node[Exit]=> Node[Exit-1]=>...=>[Me]
How does the site know that the message should be encrypted with my public key, and If it does isnt it easy for an attacker to find out who am I(if he controls that SSL site), also how does Node[Exit] know how to send the response back to me? Is Node[Exit] a trusted node that can betray me or keep me anonymous, meaning all my anonymity depends on how trusted that node is?