\begin{frame}{Toward Anonymous Communications}
  \tikzsetnextfilename{anonintro2}
  \begin{tikzpicture}[scale=1]
    \node (cp1) at (0,0) {\includegraphics[scale=0.26]{img/computer.pdf}};
    \node[below = 0cm of cp1] (cp1t) {Alice};
    \node (np1) at (2.4,0) {\includegraphics[scale=1]{img/network-provider.pdf}};
    \node[below = 0.1cm of np1, text width = 2cm,align=center] (cp1t) {Network Provider};
    \draw[<->, solid, black, line width=1mm] (cp1) edge (np1);

  %\only<1> {
  %  \node (sp) at (4.75,0) {\includegraphics[scale=1]{img/service-provider.pdf}};
  %  \node[above=-1.2cm of sp] (ssp) {\includegraphics[scale=0.10]{img/eye.pdf}};
  %  \node[below = 0.1cm of sp, text width = 2cm,align=center] (spt) {Service Provider};
  %  \draw[<->, solid, black, line width=1mm] (np1) edge (sp);
  %  \draw[<->, solid, black, line width=1mm] (sp) edge (np2);
  %}
  
  %\only<1,2> {
  %  \node[above=-1.2cm of np1] (ssp1) {\includegraphics[scale=0.10]{img/eye.pdf}};
  %  %\node[above=-1.2cm of np2] (ssp2) {\includegraphics[scale=0.10]{img/eye.pdf}};
  %  \node (np2) at (7.1,0) {\includegraphics[scale=1]{img/network-provider.pdf}};
  %  \node[below = 0.1cm of np2, text width = 2cm,align=center] (spt) {Network Provider};
  %  \node (cp2) at (9.5,0) {\includegraphics[scale=0.26]{img/computer.pdf}};
  %  \node[below = 0cm of cp2] (cp2t) {Bob};
  %  \draw[<->, solid, black, line width=1mm] (np2) edge (cp2);
  %  \node[above=-1.2cm of np2] (ssp2) {\includegraphics[scale=0.10]{img/eye.pdf}};

  %}

  %\only<2> {
  %  \draw[<->, solid, black, line width=1mm] (np1) edge (np2);
  %}

  %\only<3> {
    \node (anet) at (4.75,0) {\includegraphics[scale=1]{img/anet.pdf}};
    \draw[<->, solid, black, line width=1mm] (np1) edge (anet);
    \node[below = 0cm of anet, text width = 2cm,align=center] (anett) {Anonymization\\Network};
    \node (qs) at (9.5,0) {\includegraphics[scale=1.3]{img/question.pdf}};
    \draw[<->, solid, black, line width=1mm] (anet) edge (qs);
    \node[below = 0cm of qs, text width = 2cm,align=center] (qst) {Unknown\\Destination};
    \node[above=-1.4cm of np1] (cloud1) {\includegraphics[scale=0.8]{img/cloud.pdf}};
  %}
  \end{tikzpicture}
\begin{center}
%\only<1> {
%  \Large All Providers eavesdrop\\on communications
%}
%\only<2> {
%  \Large Network Providers can still eavesdrop\\on direct communications
%}

%\only<3> {
  \emph{"[A] system to hide who a participant communicates with [...] in spite of an \underline{unsecured telecommunication system}"}~\footnotemark[4]
\footnotetext[4]{\fullcite{chaum1981untraceable}}
%}
\end{center}
\end{frame}

\begin{frame}[t]{Preliminary Definitions}
\tikzsetnextfilename{onsch}
\begin{tikzpicture}[scale=1]
  \node (anet) {\includegraphics[scale=2]{img/anet.pdf}};
  \node[right = 0cm of anet,text width=9cm,align=left] (anett) {\Large \underline{Onion Routing} is a type of\\anonymization network \\
    \normalsize It favors \underline{performances}\\over \underline{resistance} to global attackers};

  \node[below=0cm of anet] (reli) {\includegraphics[scale=2]{img/arelay.pdf}};
  \node[right = 0cm of reli, text width=9cm] (relit) {\Large \underline{Relays} constitutes the network \\
  \normalsize Relays are \underline{generic} servers executing a \underline{daemon}. They are often run by \underline{volunteers}.};

  \node[below = 0cm of reli] (tor) {\includegraphics[scale=0.3]{img/tor.pdf}};
  \node[right = 0cm of tor,text width=9cm,align=left] (tort) {\Large \underline{Tor} is an onion routing software \\
    \normalsize Tor counts \underline{6k relays} to serve \underline{2M+ users}\\(values are approximations)};


\end{tikzpicture}
\end{frame}

\begin{frame}[t]{Circuits: Transporting Data in the Network}
\tikzsetnextfilename{circuits}
\begin{tikzpicture}[scale=1]
  \node (arel1) at (3.3,3) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel3) at (3.8,5.6) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel4) at (3,7.2) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel5) at (5.3,3.3) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel6) at (4.9,4.6) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel8) at (5,6.8) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel10) at (7.6,4.2) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel11) at (6.8,5.5) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel12) at (7.3,7.0) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel2) at (3.1,4.2) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel7) at (5.8,5.6) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel9) at (7.1,2.9) {\includegraphics[scale=1]{img/arelay.pdf}};

  \node (alice) at (1,5) {\includegraphics[scale=0.26]{img/computer.pdf}};
  \node[below=0cm of alice] (alicet) {Alice};
  \node (q) at (10,5) {\includegraphics[scale=1]{img/question.pdf}};
  \node[below=0cm of q] (qt) {Destination};

  \node[circle,fill=black,minimum size=1mm,right=0cm of alice] (j0) {};
  \node[circle,fill=black,minimum size=1mm,left=0cm of q] (j4) {};

\only<1> {
  \node[circle,fill=red,minimum size=1mm] (j1) at (3.1,4.2) {};
  \node[circle,fill=red,minimum size=1mm] (j2) at (5.8,5.6) {};
  \node[circle,fill=red,minimum size=1mm] (j3) at (7.1,2.9) {};
  \draw[-, solid, red, line width=1mm] (j0) edge (j1);
  \draw[-, solid, red, line width=1mm] (j1) edge (j2);
  \draw[-, solid, red, line width=1mm] (j2) edge (j3);
  \draw[-, dashed, black, line width=1mm] (j3) edge (j4);

  \node (circd) at (5.5,1.7) {\Large Data is carried through \textcolor{red}{\underline{Circuits}}};
  \node[below=0cm of circd, text width=10cm,align=center] (circdd) {Circuits are \underline{3-relay-long} over Tor\\Relays are chosen by \underline{Alice}: this is Alice's circuit};
}

\only<2> {
  \node[circle,fill=blue,minimum size=1mm] (j1) at (3.1,4.2) {};
  \node[circle,fill=green,minimum size=1mm] (j2) at (5.8,5.6) {};
  \node[circle,fill=magenta,minimum size=1mm] (j3) at (7.1,2.9) {};
  \draw[-, solid, red] (j0) edge (j1);
  \draw[-, solid, red] (j1) edge (j2);
  \draw[-, solid, red] (j2) edge (j3);
  \draw[-, dashed, black] (j3) edge (j4);
  \draw[->, solid, blue,line width=1mm] (j1) edge[bend right] (j0);
  \draw[->, solid, blue,line width=1mm] (j1) edge[bend left] (j2);
  \draw[->, solid, green,line width=1mm] (j2) edge[bend left] (j1);
  \draw[->, solid, green,line width=1mm] (j2) edge[bend right] (j3);
  \draw[->, solid, magenta,line width=1mm] (j3) edge[bend right] (j2);
  \draw[->, solid, magenta,line width=1mm] (j3) edge[bend left] (j4);

  \node[text width=10cm,align=center] (circd) at (5.5,1.3) {\Large Relays know only their \underline{neighbors} \\
    \normalsize \textcolor{blue}{Relay} \tikz\node[circle,fill=blue,minimum size=1mm] (j1) at (0,0) {}; knows Alice but not the destination \\
    \textcolor{magenta}{Relay} \tikz\node[circle,fill=magenta,minimum size=1mm] (j1) at (0,0) {}; knows the destination but not Alice };
}

\end{tikzpicture}
\end{frame}

\begin{frame}[t]{Exit Mode}
\tikzsetnextfilename{exitmode}
\begin{tikzpicture}[scale=1]
  \node (arel1) at (3.3,3) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel3) at (3.8,5.6) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel4) at (3,7.2) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel5) at (5.3,3.3) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel6) at (4.9,4.6) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel8) at (5,6.8) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel10) at (7.6,4.2) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel11) at (6.8,5.5) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel12) at (7.3,7.0) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel2) at (3.1,4.2) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel7) at (5.8,5.6) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel9) at (7.1,2.9) {\includegraphics[scale=1]{img/arelay.pdf}};

  \node (alice) at (1,5) {\includegraphics[scale=0.26]{img/computer.pdf}};
  \node[below=0cm of alice] (alicet) {Alice};
  \node (wiki) at (10,5) {\includegraphics[scale=1]{img/service-provider.pdf}};
  \node[below = 0.1cm of wiki, text width = 2cm,align=center] (spt) {Service Provider};

  \node[circle,fill=red,minimum size=1mm] (j1) at (3.1,4.2) {};
  \node[circle,fill=red,minimum size=1mm] (j2) at (5.8,5.6) {};
  \node[circle,fill=red,minimum size=1mm] (j3) at (7.1,2.9) {};
  \node[circle,fill=black,minimum size=1mm,left=0cm of wiki] (j4) {};


\only<1> {
  \node[circle,fill=black,minimum size=1mm,right=0cm of alice] (j0) {};
  \node (circd) at (5.5,1.7) {\Large Alice connects \underline{directly} her circuit to her target};
  \node[below=0cm of circd, text width=10cm,align=center] (circdd) {This is Tor's default mode, we name it \underline{Exit Mode}};
  \draw[-, solid, red, line width=1mm] (j0) edge (j1);
  \draw[-, solid, red, line width=1mm] (j1) edge (j2);
  \draw[-, solid, red, line width=1mm] (j2) edge (j3);
  \draw[-, solid, black, line width=1mm] (j3) edge (j4);
}

\only<2> {
  \node[circle,fill=blue,minimum size=1mm,right=0cm of alice] (j0) {};
  \draw[-, solid, red] (j0) edge (j1);
  \draw[-, solid, red] (j1) edge (j2);
  \draw[-, solid, red] (j2) edge (j3);
  \draw[-, solid, black] (j3) edge (j4);
  \draw[->, solid, blue, line width=1mm] (j0) edge[bend left=60] (j4);
  \draw[->, solid, blue, line width=1mm] (j0) edge[bend right] (j1);
  \draw[->, solid, blue, line width=1mm] (j0) edge[bend left] (j2);
  \draw[->, solid, blue, line width=1mm] (j0) edge[bend right=60] (j3);
  \node (circd) at (5.5,1.7) {\Large Alice knows all the relays and her target};
  \node[below=0cm of circd, text width=10cm,align=center] (circdd) {
  Only Alice is anonymous: \underline{1-way anonymity}};
}
\end{tikzpicture}
\end{frame}


\begin{frame}[t]{Onion Service Mode}
\tikzsetnextfilename{osmode}
\begin{tikzpicture}[scale=1]
  \node (arel1) at (3.3,3) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel3) at (3.8,5.6) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel4) at (3,7.2) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel5) at (5.3,3.3) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel6) at (4.9,4.6) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel8) at (5,6.8) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel10) at (7.6,4.2) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel11) at (6.8,5.5) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel12) at (7.3,7.0) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel2) at (3.1,4.2) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel7) at (5.8,5.6) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel9) at (7.1,2.9) {\includegraphics[scale=1]{img/arelay.pdf}};

  \node (alice) at (1,5) {\includegraphics[scale=0.26]{img/computer.pdf}};
  \node[below=0cm of alice] (alicet) {Alice};
  \node (bob) at (10,5) {\includegraphics[scale=0.26]{img/computer.pdf}};
  \node[below=0cm of bob] (bobt) {Bob};
  \node[below=0cm of arel5] (rdv) {RDV};

  \node[circle,fill=black,minimum size=1mm,right=0cm of alice] (j0) {};
  \node[circle,fill=red,minimum size=1mm] (j1) at (3.1,4.2) {};
  \node[circle,fill=red,minimum size=1mm] (j2) at (5.8,5.6) {};
  \node[circle,fill=red,minimum size=1mm] (j3) at (7.1,2.9) {};
  \node[circle,fill=black,minimum size=1mm,left=0cm of bob] (j4) {};
  \node[circle,fill=orange,minimum size=1mm] (j5) at (7.3,7.0) {};
  \node[circle,fill=orange,minimum size=1mm] (j6) at (3,7.2) {};
  \node[circle,fill=orange,minimum size=1mm] (j7) at (5.3,3.3) {};


  \draw[-, solid, red, line width=1mm] (j0) edge (j1);
  \draw[-, solid, red, line width=1mm] (j1) edge (j2);
  \draw[-, solid, red, line width=1mm] (j2) edge (j3);
  \draw[-, solid, red, line width=1mm] (j3) edge (j7);
  \draw[-, solid, orange, line width=1mm] (j7) edge (j6);
  \draw[-, solid, orange, line width=1mm] (j6) edge (j5);
  \draw[-, solid, orange, line width=1mm] (j5) edge (j4);

  \node (circd) at (5.5,1.7) {\Large Alice connects her circuit to Bob's one};
  \node[below=0cm of circd, text width=10cm,align=center] (circdd) {This feature is named \underline{Onion Service Mode} \\
  Both Alice and Bob are anonymous: \underline{2-way anonymity}};
\end{tikzpicture}
\end{frame}

\begin{frame}[t]{Sending Cells over Circuits}
\tikzsetnextfilename{cells}
\begin{tikzpicture}[scale=1]
\only<1> {
  \node (arel1) at (3.3,3) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel3) at (3.8,5.6) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel4) at (3,7.2) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel5) at (5.3,3.3) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel6) at (4.9,4.6) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel8) at (5,6.8) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel10) at (7.6,4.2) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel11) at (6.8,5.5) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel12) at (7.3,7.0) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel2) at (3.1,4.2) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel7) at (5.8,5.6) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel9) at (7.1,2.9) {\includegraphics[scale=1]{img/arelay.pdf}};
}

  \node (alice) at (1,5) {\includegraphics[scale=0.26]{img/computer.pdf}};
  \node[below=0cm of alice] (alicet) {Alice};
  \node (wiki) at (10,5) {\includegraphics[scale=1]{img/service-provider.pdf}};
  \node[below = 0.1cm of wiki, text width = 2cm,align=center] (spt) {Service Provider};

  \node[circle,fill=black,minimum size=1mm,right=0cm of alice] (j0) {};
  \node[circle,fill=black,minimum size=1mm,left=0cm of wiki] (j4) {};

  \node[circle,fill=red,minimum size=1mm] (j1) at (3.1,4.2) {};
  \node[circle,fill=red,minimum size=1mm] (j2) at (5.8,5.6) {};
  \node[circle,fill=red,minimum size=1mm] (j3) at (7.1,2.9) {};
  \draw[-, solid, red, line width=1mm] (j0) edge (j1);
  \draw[-, solid, red, line width=1mm] (j1) edge (j2);
  \draw[-, solid, red, line width=1mm] (j2) edge (j3);
  \draw[-, solid, black, line width=1mm] (j3) edge (j4);

\only<2-17> {
  \node (kr) at (0.5,6.2) {\includegraphics[scale=0.03]{img/key-red.pdf} $K_{1,2,3}$};
  \node (kr2) at (3.1,3.5) {\includegraphics[scale=0.03]{img/key-red.pdf} $K_1$};
  \node (kg2) at (5.8,6.1) {\includegraphics[scale=0.03]{img/key-red.pdf} $K_2$};
  \node (kb2) at (7.1,2.2) {\includegraphics[scale=0.03]{img/key-red.pdf} $K_3$};
}

\only<2-5> {
  \node (doc) at (1.2,0) {\includegraphics[scale=1]{img/document.pdf}};
  \node[circle,fill=cyan,minimum size=1.2mm,right=0cm of alice] (j0) {};
}
\only<3-5> {
  \draw[color=black!30!blue] let \p1 = (doc.north east) in (doc.south west) rectangle ($(\x1,\y1) + (0.3,0)$);
  \path let \p1 = (doc.north east) in node (kb3) at ($(\x1,0) + (0.2,0)$) {\includegraphics[scale=0.03]{img/key-blue.pdf}};
}
\only<4-5> {
  \draw[color=black!30!green] let \p1 = (doc.north east), \p2 = (doc.south west) in ($(\x2,\y2) - (0.2,0.2)$) rectangle ($(\x1,\y1) + (1,0.2)$);
  \path let \p1 = (doc.north east) in node (kg3) at ($(\x1,0) + (1,0)$) {\includegraphics[scale=0.03]{img/key-green.pdf}};
}
\only<5> {
  \draw[color=black!30!red] let \p1 = (doc.north east), \p2 = (doc.south west) in ($(\x2,\y2) - (0.4,0.4)$) rectangle ($(\x1,\y1) + (1.8,0.4)$);
  \path let \p1 = (doc.north east) in node (kr3) at ($(\x1,0) + (1.8,0)$) {\includegraphics[scale=0.03]{img/key-red.pdf}};
}
\only<6> {
  \node (doc) at (3.1,0) {\includegraphics[scale=1]{img/document.pdf}};
  \node[circle,fill=cyan,minimum size=1.2mm] (j1) at (3.1,4.2) {};
  \draw[color=black!30!blue] let \p1 = (doc.north east) in (doc.south west) rectangle ($(\x1,\y1) + (0.3,0)$);
  \path let \p1 = (doc.north east) in node (kb3) at ($(\x1,0) + (0.2,0)$) {\includegraphics[scale=0.03]{img/key-blue.pdf}};
  \draw[color=black!30!green] let \p1 = (doc.north east), \p2 = (doc.south west) in ($(\x2,\y2) - (0.2,0.2)$) rectangle ($(\x1,\y1) + (1,0.2)$);
  \path let \p1 = (doc.north east) in node (kg3) at ($(\x1,0) + (1,0)$) {\includegraphics[scale=0.03]{img/key-green.pdf}};
}
\only<7> {
  \node (doc) at (5.8,0) {\includegraphics[scale=1]{img/document.pdf}};
  \node[circle,fill=cyan,minimum size=1.2mm] (j2) at (5.8,5.6) {};
  \draw[color=black!30!blue] let \p1 = (doc.north east) in (doc.south west) rectangle ($(\x1,\y1) + (0.3,0)$);
  \path let \p1 = (doc.north east) in node (kb3) at ($(\x1,0) + (0.2,0)$) {\includegraphics[scale=0.03]{img/key-blue.pdf}};
}
\only<8> {
  \node (doc) at (7.1,0) {\includegraphics[scale=1]{img/document.pdf}};
  \node[circle,fill=cyan,minimum size=1.2mm] (j3) at (7.1,2.9) {};
}
\only<9> {
  \node (doc) at (10,0) {\includegraphics[scale=1]{img/document.pdf}};
  \node[circle,fill=cyan,minimum size=1.2mm,left=0cm of wiki] (j4) {};
}

\only<10> {
  \node (doc) at (10,0) {\includegraphics[scale=1]{img/ok.pdf}};
  \node[circle,fill=cyan,minimum size=1.2mm,left=0cm of wiki] (j4) {};
}
\only<11> {
  \node (doc) at (7.1,0) {\includegraphics[scale=1]{img/ok.pdf}};
  \node[circle,fill=cyan,minimum size=1.2mm] (j3) at (7.1,2.9) {};
  \draw[color=black!30!blue] let \p1 = (doc.north east) in (doc.south west) rectangle ($(\x1,\y1) + (0.3,0)$);
  \path let \p1 = (doc.north east) in node (kb3) at ($(\x1,0) + (0.2,0)$) {\includegraphics[scale=0.03]{img/key-blue.pdf}};
}
\only<12> {
  \node (doc) at (5.8,0) {\includegraphics[scale=1]{img/ok.pdf}};
  \node[circle,fill=cyan,minimum size=1.2mm] (j2) at (5.8,5.6) {};
  \draw[color=black!30!blue] let \p1 = (doc.north east) in (doc.south west) rectangle ($(\x1,\y1) + (0.3,0)$);
  \path let \p1 = (doc.north east) in node (kb3) at ($(\x1,0) + (0.2,0)$) {\includegraphics[scale=0.03]{img/key-blue.pdf}};
  \draw[color=black!30!green] let \p1 = (doc.north east), \p2 = (doc.south west) in ($(\x2,\y2) - (0.2,0.2)$) rectangle ($(\x1,\y1) + (1,0.2)$);
  \path let \p1 = (doc.north east) in node (kg3) at ($(\x1,0) + (1,0)$) {\includegraphics[scale=0.03]{img/key-green.pdf}};
}
\only<13> {
  \node (doc) at (3.1,0) {\includegraphics[scale=1]{img/ok.pdf}};
  \node[circle,fill=cyan,minimum size=1.2mm] (j1) at (3.1,4.2) {};
  \draw[color=black!30!blue] let \p1 = (doc.north east) in (doc.south west) rectangle ($(\x1,\y1) + (0.3,0)$);
  \path let \p1 = (doc.north east) in node (kb3) at ($(\x1,0) + (0.2,0)$) {\includegraphics[scale=0.03]{img/key-blue.pdf}};
  \draw[color=black!30!green] let \p1 = (doc.north east), \p2 = (doc.south west) in ($(\x2,\y2) - (0.2,0.2)$) rectangle ($(\x1,\y1) + (1,0.2)$);
  \path let \p1 = (doc.north east) in node (kg3) at ($(\x1,0) + (1,0)$) {\includegraphics[scale=0.03]{img/key-green.pdf}};
  \draw[color=black!30!red] let \p1 = (doc.north east), \p2 = (doc.south west) in ($(\x2,\y2) - (0.4,0.4)$) rectangle ($(\x1,\y1) + (1.8,0.4)$);
  \path let \p1 = (doc.north east) in node (kr3) at ($(\x1,0) + (1.8,0)$) {\includegraphics[scale=0.03]{img/key-red.pdf}};
}
\only<14-17> {
  \node (doc) at (1.2,0) {\includegraphics[scale=1]{img/ok.pdf}};
  \node[circle,fill=cyan,minimum size=1.2mm,right=0cm of alice] (j0) {};
}
\only<14-16> {
  \draw[color=black!30!blue] let \p1 = (doc.north east) in (doc.south west) rectangle ($(\x1,\y1) + (0.3,0)$);
  \path let \p1 = (doc.north east) in node (kb3) at ($(\x1,0) + (0.2,0)$) {\includegraphics[scale=0.03]{img/key-blue.pdf}};
}
\only<14-15> {
  \draw[color=black!30!green] let \p1 = (doc.north east), \p2 = (doc.south west) in ($(\x2,\y2) - (0.2,0.2)$) rectangle ($(\x1,\y1) + (1,0.2)$);
  \path let \p1 = (doc.north east) in node (kg3) at ($(\x1,0) + (1,0)$) {\includegraphics[scale=0.03]{img/key-green.pdf}};
}
\only<14> {
  \draw[color=black!30!red] let \p1 = (doc.north east), \p2 = (doc.south west) in ($(\x2,\y2) - (0.4,0.4)$) rectangle ($(\x1,\y1) + (1.8,0.4)$);
  \path let \p1 = (doc.north east) in node (kr3) at ($(\x1,0) + (1.8,0)$) {\includegraphics[scale=0.03]{img/key-red.pdf}};
}

\end{tikzpicture}
\end{frame}

\begin{frame}[t]{Telescoping Circuit Building}
  \begin{figure}
  \tikzsetnextfilename{telescope}
  \begin{tikzpicture}[scale=1]
  \node (alice) at (1,5) {\includegraphics[scale=0.26]{img/computer.pdf}};
  \node[below=0cm of alice] (alicet) {Alice};
  \node[circle,fill=black,minimum size=1mm,right=0cm of alice] (j0) {};

  \node[circle,fill=red,minimum size=1mm] (j1) at (4,5) {};
  \node[circle,draw=red,minimum size=1mm] (j2) at (7,5) {};
  \node[circle,draw=red,minimum size=1mm] (j3) at (10,5) {};

  \draw[-, solid, red, line width=1mm] (j0) edge (j1);
  \draw[-, solid, magenta, line width=1mm] (j1) edge (j2);

  \node[above=0cm of j1] (j1t) {\includegraphics[height=0.5cm]{img/key-blue.pdf} $(sk_A, pk_A)$};
  \node[above=0cm of j2] (j2t) {\includegraphics[height=0.5cm]{img/key-blue.pdf} $(sk_B, pk_B)$};
  \node[above=0cm of j3] (j3t) {\includegraphics[height=0.5cm]{img/key-blue.pdf} $(sk_C, pk_C)$};
  \node[above=0cm of j1t] (j1tt) {\includegraphics[height=0.5cm]{img/key-red.pdf} $K_1$};
  \node[above=0cm of alice] (kl) {\includegraphics[height=0.5cm]{img/key-red.pdf} $K_1$};
    
  \node (alpt) at (2,4.5) {};
  \node (rpt) at (7,4.5) {};

  \only<1> {
    \node[text width=10cm,align=center] (expl) at (5.5, 2) {
    \Large
    Tor circuits provide \underline{Perfect Forward Secrecy}
    \\
    \normalsize
    Its \underline{Telescoping} protocol builds circuits one relay at a time\\
    For each relay, it runs the \underline{Tor Authentication Protocol}
    };
  }
    \only<2> {

    \node[above=0cm of kl] (kl2) {\includegraphics[height=0.5cm]{img/business.pdf} \color{magenta}$a$};
    \draw[->, solid, magenta, line width=0.4mm] (alpt) edge node[sloped,anchor=north]{$Enc(pk_{B},g^a)$} (rpt);

    \node[text width=10cm,align=center] (expl) at (5.5, 2) {
    \Large
    Based on a Diffie-Hellman Key Exchange 
    \\
    \normalsize
    Alice and relays agreed on a base $g$\\
    Alice generates $a$\\
    Alice sends $g^a$ to the configured relay
    };
    }

    \only<3> {
      \node[above=0cm of kl] (kl2) {\includegraphics[height=0.5cm]{img/business.pdf} a};
      \node[above=0cm of j2t] (j2tt) {\includegraphics[height=0.5cm]{img/business.pdf} \color{magenta}$g^a, b$};
      \draw[<-, solid, magenta, line width=0.4mm] (alpt) edge node[sloped,anchor=north]{$g^b$} (rpt);

    \node[text width=10cm,align=center] (expl) at (5.5, 2) {
    \Large
    Based on a Diffie-Hellman Key Exchange 
    \\
    \normalsize
    Relay generates $b$\\
    Relay sends $g^b$ to Alice
    };
    }
    \only<4> {
      \node[above=0cm of kl,text width=2cm] (kl2) {\includegraphics[height=0.5cm]{img/business.pdf}$a,$  \color{magenta}$g^b$ \\ $\implies g^{ba}$};
      \node[above=0cm of j2t,text width=2cm] (j2tt) {\includegraphics[height=0.5cm]{img/business.pdf} $g^a, b$ \\ \color{magenta}$\implies g^{ab}$};
     \node[text width=10cm,align=center] (expl) at (5.5, 2) {
     \Large
     Based on a Diffie-Hellman Key Exchange 
     \\
     \normalsize
     Alice and Bob have a shared secret $g^{ab} = g^{ba}$\\
     The secret has not been sent on wire
    };

    }

    \only<5> {
  \draw[-, solid, red, line width=1mm] (j1) edge (j2);
  \draw[-, solid, magenta, line width=1mm] (j2) edge (j3);
  \node[circle,fill=red,minimum size=1mm] (j2) at (7,5) {};
      \node[above=0cm of j2t] (j2tt) {\includegraphics[height=0.5cm]{img/key-red.pdf} $K_2$};
      \node[above=0cm of kl] (kl2) {\includegraphics[height=0.5cm]{img/key-red.pdf} $K_2$};
     \node[text width=10cm,align=center] (expl) at (5.5, 2) {
     \Large
     The $2^{nd}$ relay has been configured \\
     \normalsize
     The $3^{rd}$ can now be configured
    };
    }
  \end{tikzpicture}
\end{figure}

\end{frame}

\begin{frame}[t]{Correlation Attacks}
\tikzsetnextfilename{coratt}
\begin{tikzpicture}[scale=1]
\only<1> {
  \node (arel1) at (3.3,3) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel3) at (3.8,5.6) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel4) at (3,7.2) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel5) at (5.3,3.3) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel6) at (4.9,4.6) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel8) at (5,6.8) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel10) at (7.6,4.2) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel11) at (6.8,5.5) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel12) at (7.3,7.0) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel2) at (3.1,4.2) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel7) at (5.8,5.6) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (arel9) at (7.1,2.9) {\includegraphics[scale=1]{img/arelay.pdf}};
  \node (desc) at (5.5,1.5) {\Large  Anyone can run relays without prior authorization};
}
\only<2-4> {
  \node (arel1) at (3.3,3) {\includegraphics[scale=0.8]{img/good.pdf}};
  \node (arel3) at (3.8,5.6) {\includegraphics[scale=0.8]{img/good.pdf}};
  \node (arel4) at (3,7.2) {\includegraphics[scale=0.8]{img/bad.pdf}};
  \node (arel5) at (5.3,3.3) {\includegraphics[scale=0.8]{img/good.pdf}};
  \node (arel6) at (4.9,4 .6) {\includegraphics[scale=0.8]{img/bad.pdf}};
  \node (arel8) at (5,6.8) {\includegraphics[scale=0.8]{img/good.pdf}};
  \node (arel10) at (7.6,4.2) {\includegraphics[scale=0.8]{img/good.pdf}};
  \node (arel11) at (6.8,5.5) {\includegraphics[scale=0.8]{img/bad.pdf}};
  \node (arel12) at (7.3,7.0) {\includegraphics[scale=0.8]{img/bad.pdf}};
  \node (arel2) at (3.1,4.2) {\includegraphics[scale=0.8]{img/good.pdf}};
  \node (arel7) at (5.8,5.6) {\includegraphics[scale=0.8]{img/good.pdf}};
  \node (arel9) at (7.1,2.9) {\includegraphics[scale=0.8]{img/good.pdf}};
} 

  \node (alice) at (1,5) {\includegraphics[scale=0.26]{img/computer.pdf}};
  \node[below=0cm of alice] (alicet) {Alice};
  \node (wiki) at (10,5) {\includegraphics[scale=1]{img/service-provider.pdf}};
  \node[below = 0.1cm of wiki, text width = 2cm,align=center] (spt) {Service Provider};

  \node[circle,fill=black,minimum size=1mm,right=0cm of alice] (j0) {};
  \node[circle,fill=black,minimum size=1mm,left=0cm of wiki] (j4) {};

  \only<1-2> {
  \node[circle,fill=red,minimum size=1mm] (j1) at (3.1,4.2) {};
  \node[circle,fill=red,minimum size=1mm] (j2) at (5.8,5.6) {};
  \node[circle,fill=red,minimum size=1mm] (j3) at (7.1,2.9) {};
  \draw[-, solid, red, line width=1mm] (j0) edge (j1);
  \draw[-, solid, red, line width=1mm] (j1) edge (j2);
  \draw[-, solid, red, line width=1mm] (j2) edge (j3);
  \draw[-, solid, black, line width=1mm] (j3) edge (j4);
  }

  \only<2> {
    \node[text width=10cm,align=center] (desc) at (5.5,1.5) {\Large 
    Attacker run multiple relays \\
    \normalsize
    and make them \underline{collude} to de-anonymize Alice
    };
  }

  \only<3> {
  \node[circle,fill=red,minimum size=1mm] (j1) at (arel4.center) {};
  \node[circle,fill=red,minimum size=1mm] (j2) at (arel6.center) {};
  \node[circle,fill=red,minimum size=1mm] (j3) at (arel11.center) {};
  \draw[-, solid, red, line width=1mm] (j0) edge (j1);
  \draw[-, solid, red, line width=1mm] (j1) edge (j2);
  \draw[-, solid, red, line width=1mm] (j2) edge (j3);
  \draw[-, solid, black, line width=1mm] (j3) edge (j4);
  \node (dea) at (5.5,1.5) {\color{red} \Large  Alice is de-anonymized};
  \node[left=0cm of dea] (dead) {\includegraphics{img/fail.pdf}};

  }

 \only<4> {
  \node[circle,fill=red,minimum size=1mm] (j1) at (arel6.center) {};
  \node[circle,fill=red,minimum size=1mm] (j2) at (arel8.center) {};
  \node[circle,fill=red,minimum size=1mm] (j3) at (arel12.center) {};
  \draw[-, solid, red, line width=1mm] (j0) edge (j1);
  \draw[-, solid, red, line width=1mm] (j1) edge (j2);
  \draw[-, solid, red, line width=1mm] (j2) edge (j3);
  \draw[-, solid, black, line width=1mm] (j3) edge (j4);
  \node[text width=7cm,align=center] (dea) at (5.5,1.5) {\Large \color{red} 
  Alice is still de-anonymized \\
  \normalsize 
  It suffices to corrupt the first and last relay
  };
  \node[left=0cm of dea] (dead) {\includegraphics{img/fail.pdf}};
  } 

\end{tikzpicture}
\end{frame}


\begin{frame}[t]{The Need for Guards}
\tikzsetnextfilename{guards}
\begin{tikzpicture}[scale=1]
  \node (arel1) at (3.3,3) {\includegraphics[scale=0.8]{img/good.pdf}};
  \node (arel3) at (3.8,5.6) {\includegraphics[scale=0.8]{img/good.pdf}};
  \node (arel4) at (3,7.2) {\includegraphics[scale=0.8]{img/bad.pdf}};
  \node (arel5) at (5.3,3.3) {\includegraphics[scale=0.8]{img/good.pdf}};
  \node (arel6) at (4.9,4 .6) {\includegraphics[scale=0.8]{img/bad.pdf}};
  \node (arel8) at (5,6.8) {\includegraphics[scale=0.8]{img/good.pdf}};
  \node (arel10) at (7.6,4.2) {\includegraphics[scale=0.8]{img/good.pdf}};
  \node (arel11) at (6.8,5.5) {\includegraphics[scale=0.8]{img/bad.pdf}};
  \node (arel12) at (7.3,7.0) {\includegraphics[scale=0.8]{img/bad.pdf}};
  \node (arel2) at (3.1,4.2) {\includegraphics[scale=0.8]{img/good.pdf}};
  \node (arel7) at (5.8,5.6) {\includegraphics[scale=0.8]{img/good.pdf}};
  \node (arel9) at (7.1,2.9) {\includegraphics[scale=0.8]{img/good.pdf}};

  \coordinate (c1) at (3.3,3);
  \coordinate (c3) at (3.8,5.6); 
  \coordinate (c4) at (3,7.2) ;
  \coordinate (c5) at (5.3,3.3); 
  \coordinate (c6) at (4.9,4.6) ;
  \coordinate (c8) at (5,6.8) ;
  \coordinate (c10) at (7.6,4.2); 
  \coordinate (c11) at (6.8,5.5) ;
  \coordinate (c12) at (7.3,7.0) ;
  \coordinate (c2) at (3.1,4.2) ;
  \coordinate (c7) at (5.8,5.6) ;
  \coordinate (c9) at (7.1,2.9) ;

  \node (alice) at (1,5) {\includegraphics[scale=0.26]{img/computer.pdf}};
  \node[below=0cm of alice] (alicet) {Alice};
  \node (wiki) at (10,5) {\includegraphics[scale=1]{img/service-provider.pdf}};
  \node[below = 0.1cm of wiki, text width = 2cm,align=center] (spt) {Service Provider};

\only<1> {
  \node[circle,fill=black,minimum size=1mm,right=0cm of alice] (j0) {};
  \node[circle,fill=black,minimum size=1mm,left=0cm of wiki] (j4) {};
  \draw[-, solid, magenta,line width=1mm] (j0) -- (c1) -- (c8) -- (c9) -- (j4);
  \draw[-, solid, cyan,line width=1mm] (j0) -- (c4) -- (c6) -- (c12) -- (j4);
  \draw[-, solid, green,line width=1mm] (j0) -- (c6) -- (c9) -- (c11) -- (j4);
  \draw[-, solid, orange,line width=1mm] (j0) -- (c3) -- (c5) -- (c10) -- (j4);

  \node[text width=9cm,align=center] (desc) at (6.5,1.1) {\Large 
    \color{red}
    \underline{Over a long time}, Alice will inevitably\\end up de-anonymized};
  \node[left=0cm of desc] (illu) {\includegraphics{img/stop.pdf}};
  }

  \only<2> {
  \node[circle,fill=black,minimum size=1mm,right=0cm of alice] (j0) {};
  \node[circle,fill=black,minimum size=1mm,left=0cm of wiki] (j4) {};
  \draw[-, solid, magenta,line width=1mm] (j0) to [bend left=10]  (c1) -- (c8) -- (c9) -- (j4);
  \draw[-, solid, cyan,line width=1mm] (j0) to [bend left=10]  (c3) -- (c6) -- (c12) -- (j4);
  \draw[-, solid, green,line width=1mm] (j0) to [bend right=10]  (c1) -- (c9) -- (c11) -- (j4);
  \draw[-, solid, orange,line width=1mm] (j0) to [bend right=10]  (c3) -- (c5) -- (c10) -- (j4);
  \node[below=0.5cm of c1] (g1) {\textcolor{blue}{Guard 1}};
  \node[above=0.5cm of c3] (g2) {\textcolor{blue}{Guard 2}};

  \node[text width=10cm,align=center] (desc) at (5.5,1.1) {\Large Alice always picks the same two first relays\\They are her \textcolor{blue}{\underline{Guards}}};
  }
\end{tikzpicture}
\end{frame}




\iffalse
\only<5-9> {
  \node (alice) at (1,5) {\includegraphics[scale=0.26]{img/computer.pdf}};
  \node[below=0cm of alice] (alicet) {Alice};
  \node (wiki) at (10,5) {\includegraphics[scale=0.5]{img/wiki.pdf}};
}

\only<5> {
  \node (aliwiki) at (5.5,1.5) {\Large \underline{1 way anonymity}: only Alice is anonymous};
  \node[below=0cm of aliwiki] (aliwikid) {Alice wants to post an article \includegraphics[scale=0.3]{img/document.pdf} on Wikipedia};
}

\only<6> {
  \node[below=-1.6cm of arel2] (arel2s) {\includegraphics[scale=1]{img/sel.pdf}};
  \node (alisel) at (5.5,1) {\Large Alice selects 3 relays randomly};
  \node[below=0cm of alisel] (aliseld) {Some constraints apply on the selection};
}

\only<6-7> {
  \node[below=-1.6cm of arel7] (arel7s) {\includegraphics[scale=1]{img/sel.pdf}};
}

\only<6-8> {
  \node[below=-1.6cm of arel9] (arel9s) {\includegraphics[scale=1]{img/sel.pdf}};
}

\only<7> {
  \node (alico1) at (5.5,1) {\Large Alice connects to the 1st one};

}
\fi
