I would like to know how to draw protocol flaw like the following picture? I don't know how to draw it exactly.
Asked
Active
Viewed 167 times
0
1 Answers
3
You do not even load any library for that. I would like to argue that it is advantageous to use as few explicit coordinates as possible and then work with relative coordinates and the pos syntax in order to arrive at a code in which you can easily add some elements.
\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}[box/.style={draw,fill=white,align=center}]
\draw [line width=2mm] (0,0) -- ++(2,0) coordinate[midway](L1)
(6,0) -- ++(2,0) coordinate[midway](R1);
\draw (L1) -- ++ (0,8)
node[box,pos=0.3] (L1a) {$e=f-\texttt{xcoord}(rY)$\\ $Ee\stackrel{?}{=}P$}
node[box,pos=0.65] (L1b) {$r\in_RZ_\ell^*$}
node[box,pos=1,label=above:{State: $x,Y$}] (L1c) {Tag $T$}
coordinate[pos=0.2] (X1) coordinate[pos=0.55] (X2);
\draw (R1) -- ++ (0,8)
node[box,pos=0.1] (R1a) {$X=e^{-1}(sP-R)\stackrel{?}{\in}\mathsf{DB}$}
node[box,pos=0.85] (R1b) {$e\in_RZ_\ell^*$}
node[box,pos=1,label=above:{Secrets: $y$~~$\mathsf{DB}:$ $\{X_i\}$}] (R1c) {Reader $T$}
coordinate[pos=0.4] (X3) coordinate[pos=0.75] (X4);
\draw[-latex] (X1) -- (X1 -| R1) node[midway,above]{$s=ex+r$};
\draw[-latex] (X2) -- (X2 -| R1) node[midway,above]{$\mathsf{xcoord}(R)=\mathsf{xcoord}(rP)$};
\draw[-latex] (X3) -- (X3 -| L1) node[midway,above]{$f=\mathsf{xcoord}(yR)+e$};
\draw[-latex] (X4) -- (X4 -| L1) node[midway,above]{$\mathsf{xcoord}(E)=\mathsf{xcoord}(e^{-1}P)$};
\end{tikzpicture}
\end{document}


mscis a package for this: https://tex.stackexchange.com/a/54390/1952 – Ignasi Sep 20 '18 at 13:29