# draw security protocol

It's about authenticated key exchange protocol, there are two parties party A and party B,they exchange some messages. At the end they compute the shared keys SK.

I know that it's vey cool to use Latex to set type, I really want to learn it. Any one can give me some advices? please help me! thanks

• Welcome to Tex.SX! I would suggest you rephrase your question into a more specific request. There are plenty of ways to "draw" that protocol in LaTeX, and knowing what you want in more detail might make it easier to help you. – MaxAxeHax Jul 25 '13 at 16:11

\documentclass{article}
$\begin{array}{@{}l@{}c@{}l@{}} \toprule \hat{A} && \hat{B} \\ A_1=g^{a_1},\quad A_2=g^{a_2} && B_1=g^{b_1},\quad B_2=g^{b_2} \\ \bar{x}\gets_R \mathbb{Z}_q,\quad x=H_1(\bar{x},a_1,a_2) && \bar{y}\gets_R \mathbb{Z}_q,\quad y=H_1(\bar{y},b_1,b_2) \\ & \xrightarrow{\textstyle X=g^x} \\ & \xleftarrow {\textstyle Y=g^y} \\ \mathit{sid}=(X,Y,\hat{A},\hat{B}) && \mathit{sid}=(X,Y,\hat{A},\hat{B}) \\ Z_1=(YB_1)^x,\quad Z_2=(YB_2)^x && Z_1=X^{y+b_1},\quad Z_2=X^{y+b_2} \\ Z_3=Y^{x+a_1},\quad Z_4=Y^{x+a_2} && Z_3=(XA_1)^y,\quad Z_4=(XA_2)^y \\ \mathit{SK}=H(Z_1,Z_2,Z_3,Z_4,\mathit{sid}) && \mathit{SK}=H(Z_1,Z_2,Z_3,Z_4,\mathit{sid}) \\ \bottomrule \end{array}$