Debian Codegraph @

texmf-dist/doc/latex/aspen/aspen-doc.ltx

raw
1 \documentclass{article}
2
3 \usepackage{rcs}
4 \RCS$Date: 2026/05/12 10:02:53 $
5 \RCS$RCSfile: aspen-doc.ltx,v $
6 \RCS$Revision: 2.8 $
7 \RCS$State: Exp $
8 \RCS$Author: aa $
9
10 \edef\AADate{\RCSDate}
11 \edef\AARawDate{\RCSRawDate}
12 %\typeout{XXX: \AARawDate}
13
14 \usepackage[T1]{fontenc}
15 \usepackage[utf8]{inputenc}
16
17 \usepackage[color,ban=aa]{aspen}
18
19 \usepackage[charter,expert]{mathdesign}
20 \usepackage[scaled=.96,osf]{XCharter}% matches the size used in math
21 \linespread{1.04}
22
23 \usepackage[a4paper,margin=2.8cm]{geometry}
24
25 \usepackage{graphicx}
26 \usepackage[dvipsnames,x11names]{xcolor}
27 \usepackage[most]{tcolorbox}
28 \usepackage{xltabular}
29 \usepackage{makecell}
30 %\usepackage{amssymb}
31 %\usepackage{wasysym}
32 \usepackage{fancyvrb}
33 \usepackage{fvextra}
34 \usepackage{hologo}
35 \usepackage{comment}
36
37 % This is used for MetaPost figures in the text. Some figures might
38 % use my two MetaPost packages aamisc and aaobj:
39 % https://www.pg12.org/dist/texmf/mp/aaobj/
40 \usepackage{luamplib}
41 \everymplib{
42 verbatimtex
43 %&latex
44 \documentclass{article}
45 \usepackage[color,ban=aa]{aspen}
46 \usepackage[charter,expert]{mathdesign}
47 \usepackage[scaled=.96,osf]{XCharter}% matches the size used in math
48 \linespread{1.04}
49 \begin{document}
50 etex
51 input aamisc;
52 input aaobj;
53 numeric width, height, orad, v;
54 orad:=0.5cm;
55 width:=5orad;
56 height:=3orad;
57 v:=27;
58 pair p[], q[], c, d;
59 ahlength:=2.5;
60 beginfig(0); }
61 \everyendmplib{ endfig; }
62
63 \usepackage[hang,flushmargin]{footmisc}
64 \usepackage{caption}
65 \usepackage[numbib,nottoc]{tocbibind}
66
67 \usepackage{hyperref}
68 % \hypersetup{
69 % colorlinks=true,
70 % linkcolor=blue,
71 % filecolor=magenta,
72 % urlcolor=cyan,
73 % pdftitle={Overleaf Example},
74 % pdfpagemode=FullScreen,
75 % }
76
77 \parindent=0pt
78 \parskip=\bigskipamount
79 \renewenvironment{quotation}{\begin{quote}}{\end{quote}}
80 \topsep=0pt
81 \partopsep=0pt
82 \setcounter{tocdepth}{2}
83
84 %\usepackage{minted2} % TEMP work-around: should be minted
85 %\usemintedstyle{manni}
86 %\usemintedstyle{autumn}
87
88 \makeatletter
89
90 \def\latex{L\kern -.29em{\sbox \z@ T\vbox to\ht \z@ {\hbox {\check@mathfonts \fontsize \sf@size \z@ \math@fontsfalse \selectfont A}\vss }}\kern -.12em\TeX}
91
92 \renewcommand{\LaTeX}{\latex}
93
94 \renewenvironment{quote}{%
95 \list{}{\listparindent=0em
96 %\itemindent=\listparindent
97 %\leftmargin=\parindent
98 \rightmargin=\leftmargin
99 \topsep=0em
100 \partopsep=0em
101 \parsep\z@\@plus\p@}%
102 \item\relax}{\endlist}
103
104 \makeatother
105
106 \colorlet{LightLightCyan}{LightCyan2!40!}
107 \colorlet{LightLightGrey}{gray!15!}
108 \colorlet{LightGrey}{gray!80!}
109 \colorlet{LightCyan}{cyan!80!}
110
111 \newcommand{\extxt}[1]{\textcolor{gray}{#1}}
112 \newcommand{\givesarrow}{\extxt{\ensuremath{\rightarrow}}}
113 \newcommand{\gives}{\ensuremath{\quad\givesarrow\quad}}
114 % \NewDocumentCommand{\cs}{mo}{%
115 % \ACmd{\textbackslash #1}%
116 % \IfNoValueTF{#2}{}{\texttt{\{#2\}}}}
117 %\def\cs#1{\ACmd{\textbackslash #1}}
118
119 %\newcommand{\imptxt}[1]{\textcolor{NavyBlue}{#1}}
120 %\newcommand{\impcmd}[1]{\imptxt{\texttt{#1}}}
121
122 % \tcbset{on line,
123 % boxsep=4pt,left=0pt,right=0pt,top=0pt,bottom=0pt,
124 % colframe=white,colback=LightLightCyan,
125 % highlight math style={enhanced}}
126
127 \newtcbox{\exbox}{on line,
128 boxsep=4pt,left=0pt,right=0pt,top=-2pt,bottom=0pt,
129 colframe=white,colback=LightLightGrey,
130 highlight math style={enhanced}}
131 \newtcbox{\shadedbox}{on line,
132 boxsep=0pt,left=0pt,right=0pt,top=0pt,bottom=4pt,
133 colframe=white,colback=white,
134 highlight math style={enhanced}}
135 \newcommand{\example}[1]{\hspace*{\fill}\shadedbox{\exbox{\small \ensuremath{%
136 \begin{array}{@{\hskip 2pt\relax}c@{\hskip 2pt\relax}}#1\end{array}}}}\hspace*{\fill}}
137 %\DeclareRobustCommand\iff{\;\Longleftrightarrow\;}
138
139 % Inspired by the example environment in
140 % https://tug.ctan.org/macros/latex/contrib/minted/minted.dtx
141
142 \fvset{formatcom=\color{NavyBlue}}
143 \newlength{\codewith}
144
145 \newif\iftolfileexists
146 \newcommand\ttol[2]{\hyperlink{ttol:#1}{\emph{#2}}}
147 \newcommand\tableoflisting{%
148 \IfFileExists{aspen-doc.tol}{\tolfileexiststrue}{\tolfileexistsfalse}%
149 \begin{tabular}{@{\qquad}ll}
150 \iftolfileexists
151 \input{aspen-doc.tol}
152 \fi
153 \end{tabular}\vspace*{-\baselineskip} % Compensate for last \\
154 \newwrite\tolfile
155 \immediate\openout\tolfile=\jobname.tol
156 }
157 \newcommand\tol[2]{%
158 \hypertarget{ttol:#1}{\subsection*{#2}}%{\textbf{#2}~}
159 \immediate\write\tolfile{\unexpanded{$\bullet$\quad\ttol}{#1}{#2} &
160 {\unexpanded{\latex}} code: \unexpanded{\refltxcode}{#1}
161 \unexpanded{\\}}}
162
163 \newwrite\locfile
164 \immediate\openout\locfile=\jobname.loc
165 \newenvironment{ltxcode}[2]{%
166 % #1 label / file name
167 % #2 Title / description
168 \VerbatimEnvironment
169 \def\lblfn{#1}%
170 \def\locdesc{#2}%
171 \begin{VerbatimOut}[gobble=2]{loc/#1.tex}}
172 {\end{VerbatimOut}%
173 \immediate\write\locfile{\unexpanded{\subsubsection}{\locdesc}}%
174 \immediate\write\locfile{\unexpanded{\label}{loc:\lblfn}}%
175 \immediate\write\locfile{\unexpanded{\VerbatimInput}{loc/\lblfn .tex}}%
176 \immediate\write\locfile{\unexpanded{\global\let\ASteplabel\AEatit}}%
177 \immediate\write\locfile{\unexpanded{\input}{loc/\lblfn .tex}}%
178 \immediate\write\locfile{\unexpanded{\global\let\ASteplabel\label}}}
179
180 \newcommand\useltxcode[1]{\input{loc/#1.tex}}
181 \newcommand\showltxcode[1]{\VerbatimInput{loc/#1.tex}}
182 \newcommand\refltxcode[1]{\ref{loc:#1}}
183 \newcommand\pagerefltxcode[1]{\pageref{loc:#1}}
184
185 \newenvironment{ltxex}[2]{%
186 \VerbatimEnvironment
187 \def\lfn{#1}%
188 \def\ltitle{#2}%
189 \begin{ltxcode}{#1}{#2}}
190 {\end{ltxcode}%
191 \qquad
192 \begin{tabular}{@{\hskip 1pt\relax}l@{}}
193 \emph{\ltitle} \\\hline
194 \\[-1.3\medskipamount]
195 \begin{tabular}{@{}l@{}}
196 \useltxcode{\lfn}
197 \end{tabular}
198 \end{tabular}}
199
200 \newenvironment{ltxexample}[1]{%
201 \setlength{\codewith}{#1}%
202 \VerbatimEnvironment
203 \begin{VerbatimOut}[gobble=2]{example.out}}
204 {\end{VerbatimOut}%
205 \begin{center}
206 \fbox{%
207 \begin{minipage}[c]{\codewith}%
208 % \inputminted[resetmargins]{latex}{example.out}%
209 \VerbatimInput{example.out}%
210 \vspace*{-2ex}% % The \fvset adds extra space (bug?)
211 \end{minipage}%
212 \vrule
213 \input{example.out}\hspace{-0.5em}}%
214 \end{center}}
215
216 \newenvironment{ltxexample*}[1]{%
217 \setlength{\codewith}{#1}%
218 \VerbatimEnvironment
219 \begin{VerbatimOut}[gobble=2]{example.out}}
220 {\end{VerbatimOut}%
221 \begin{center}
222 \fbox{%
223 \begin{minipage}[c]{\codewith}%
224 % \inputminted[resetmargins]{latex}{example.out}%
225 \VerbatimInput{example.out}%
226 \vspace*{-2ex}% % The \fvset adds extra space (bug?)
227 \end{minipage}}%
228 \end{center}}
229
230 % \newcommand\cmdargs[2]{\ACmd{\textbackslash\Verb|#1|}: \ACmd{\Verb|#2|}}
231 \NewDocumentCommand\cmdargs{mmo}{%
232 \ACmd{\textbackslash\Verb|#1|}: \ACmd{\Verb|#2|}%
233 \IfValueT{#3}{\AReturns{\ACmd{\Verb|#3|}}}}
234
235 \NewDocumentCommand\cmdmarg{m}{%
236 \ACmd{\{\emph{<#1>}\}}}
237 \NewDocumentCommand\cmdoarg{m}{%
238 \ACmd{[\emph{<#1>}]}}
239 \NewDocumentCommand\cmdparg{m}{%
240 \ACmd{(\emph{<#1>})}}
241 \NewDocumentCommand\cmdtarg{m}{%
242 \ACmd{\emph{<#1>}}}
243 \NewDocumentCommand\cmdkarg{}{%
244 \cmdtarg{T}}
245 \NewDocumentCommand\cmdsarg{}{%
246 \cmdtarg{*}}
247 \NewDocumentCommand\cmdearg{}{%
248 \ACmd{\Verb|_|\{\emph{<embellishment>}\}}}
249 \NewDocumentCommand\cmdargexx{mm}{%
250 \ACmd{\emph{\textbackslash\Verb|#1|}#2}}
251 \NewDocumentCommand\cmdargex{mmo}{%
252 \ACmd{\textbackslash\Verb|#1|#2}%
253 \IfValueT{#3}{\newline\AReturns{#3}}}
254
255 \DeclareFontFamily{U}{lasy}{}
256 \DeclareFontShape{U}{lasy}{m}{n}{
257 <-5.5> lasy5
258 <5.5-6.5> lasy6
259 <6.5-7.5> lasy7
260 <7.5-8.5> lasy8
261 <8.5-9.5> lasy9
262 <9.5-> lasy10
263 }{}
264 \DeclareFontShape{U}{lasy}{m}{b}{
265 <-5.5> lasy5
266 <5.5-6.5> lasy6
267 <6.5-7.5> lasy7
268 <7.5-8.5> lasy8
269 <8.5-9.5> lasyb10
270 <9.5-> lasyb10
271 }{}
272 % \DeclareRobustCommand{\Leadsto}{%
273 % \mathrel{\text{\usefont{U}{lasy}{m}{b}\symbol{"3B}}}%
274 % }
275 %\DeclareRobustCommand{\rLeadsto}{%
276 % \mathrel{\text{\reflectbox{\usefont{U}{lasy}{m}{n}\symbol{"3B}}}}%
277 %}
278
279
280 \begin{document}
281
282 \title{{\Aspen}\\[.5\baselineskip]
283 A security protocol notation}
284 \author{Anders Andersen\\[.3\baselineskip]
285 UiT The Arctic University of Norway}
286 \date{\AARawDate\\[.2\baselineskip]
287 (\ACmd{aspen.sty} version \RCSRevision)}
288
289 \maketitle
290 \thispagestyle{empty}
291
292 In security literature, different notations for cryptographic values,
293 functions and protocols have been used and suggested. Three often
294 cited references for such notations are ``Kerberos: An Authentication
295 Service for Open Network Systems''~\cite{steiner1988a}, ``Exploring
296 Kerberos, the Protocol for Distributed Security in Windows
297 2000''~\cite{chappell1999a}, and ``A Formal Semantics for Protocol
298 Narrations''~\cite{briais2005a}. The notation {\Aspen} presented here
299 is strongly inspired by notations found in these three references,
300 notations found in text books~\cite{anderson2020a}, and the notation
301 used in my own publications, teaching and presentations. {\Aspen} is
302 closely related to what is often called ``security protocol
303 notation'', ``standard protocol engineering
304 notation''~\cite{anderson2001a,anderson2008a}, ``standard protocol
305 notation''~\cite{anderson2020a}, or ``protocol
306 narrations''~\cite{briais2005a}.
307
308 This text documents the {\Aspen}\footnotemark{} notation
309 %\cite{andersen2026c}
310 and how this notation can be used in {\latex} documents using the
311 {\latex} package \Verb|aspen|~\cite{andersen2026b}. Since the
312 {\latex} package \Verb|aspen| optionally provides support for the BAN
313 logic notation, the BAN logic notation is included in the
314 documentation.
315
316 \parbox[t]{.47\linewidth}{%
317 The {\Aspen} notation is \emph{not} a formalism, like BAN
318 (Burrows–Abadi–Needham) logic~\cite{burrows1990a}, or a calculus for
319 analysis of cryptographic protocols, like Spi
320 calculus~\cite{abadi1999a}. For a more detailed analysis of
321 cryptographic protocols, more expressive notations like BAN logic,
322 Spi calculus, or something similar should be considered. Other
323 references presenting relevant notations include, but are not
324 limited to: \cite{briais2007a,davis1989a,schafer2001a}.\\
325
326 \hfil\begin{ASteps*}
327 \ASend{A}{S}{\APri{A},\APri{B},\ANonce{A}} \\
328 \ASend*{S}{A}{\AEncrypted{A,S}{\ANonce{A},\APri{B},\AKey{A,B},%
329 \AEncrypted{B,S}{\AKey{A,B},\APri{A}}}} \\
330 \ASend*{A}{B}{\AEncrypted{B,S}{\AKey{A,B},A}} \\
331 \ASend*{B}{A}{\AEncrypted{A,B}{\ANonce{B}}} \\
332 \ASend*{A}{B}{\AEncrypted{A,B}{\ANonce{B}-1}}
333 \end{ASteps*}\hfil%\\[-1ex]
334 \captionof{figure}{{\Aspen} example (what protocol is it?)}}%
335 \hfil
336 \parbox[t]{.46\linewidth}{{\small
337 \vspace*{-2\baselineskip}\tableofcontents}}
338
339 \footnotetext{{Originally, I had no intention to name the notation
340 presented here. While working on this text, it became clear that it
341 was inconvenient to not be able to refer to the notation with a
342 short name. The name {\Aspen} \emph{can} be an abbreviation for ``A
343 Security Protocol Engineering Notation'', but for me it is now short
344 for ``Anderson-inspired Standard Protocol Engineering Notation'', in
345 memory of the late \href{https://www.cl.cam.ac.uk/archive/rja14/}%
346 {Professor Ross J.\ Anderson} who has meant so much for the fields
347 of computer security, distributed systems, and, in particular,
348 \href{https://www.cl.cam.ac.uk/archive/rja14/book.html}{security
349 engineering}~\cite{anderson2001a,anderson2008a,anderson2020a}.}}
350
351 \clearpage
352 \section{Introduction}
353 \label{sec:intro}
354
355 \begin{figure}
356 {\renewcommand{\arraystretch}{1.2}
357 \begin{xltabular}{\textwidth}{llX}
358 Values:
359 & \ATrue, \ASval{m}, \AChash{m}
360 & Values, structured values and typed structured values. In this
361 notation a message is seen as a structured value.
362 \\
363 Principals:
364 & \APri{A}, \APri{B}, \APri{S}
365 & Principals in security protocols, including clients,
366 servers, and other participants.
367 \\
368 Keys:
369 & \AKey{A,B}, \AKey'{C,S}, \AKey+{A}, \AKey-{B}
370 & Cryptographic keys, used to encrypt, decrypt, sign and verify
371 values and messages.
372 \\
373 Nonces:
374 & \ANonce{A}, \ANonce{B}, \ANonce{S}
375 & Nonces are generated to be fresh and commonly
376 include a timestamp or a number that is used only once.
377 \\
378 Counter:
379 & \ACounter{A}, \ACounter[C]{B}
380 & Counter or indexes can be used to identify a session or a number
381 in a sequence.
382 \\
383 Random:
384 & \ARandom{x}, \ARandom'{1}
385 & Random values can be a variant of nonces. The $\ASmark$ mark hints
386 about limited useful lifetime (once, or during a session).
387 \\
388 Time:
389 & \ATS*{T_S}, \ATS*{T_A}, \ATTL*{L}
390 & Timestamps and lifetime are often used, together with nonces,
391 to avoid replay and session keys that are too old.
392 \\
393 Strings:
394 & \AStr{Hello world!}
395 & Not necessary for the intended notation usage, but text strings
396 are often found in examples in the literature.
397 \\
398 Variables:
399 & \AVar{x}, \AVar{y}, \AVar{z}, \AVar{a}, \AVar{b}, \AVar{c}
400 & A variable can be assigned a value. Might also be used in the
401 context of ``we are not sure about its value''.
402 \\
403 Functions:
404 & \AChashf{m}, \AFunc{Func}{\AVar{x},\AVar{y}}\ARet\AVar{z}
405 & A function can take arguments and produce a value. Some functions
406 are the constructor of typed structured values.
407 \\
408 Procedures:
409 & \AAbort %, \AAbort[Msg]
410 & A procedure is similar to a function but doesn't produce a
411 value. Instead is has an affect on the running protocol
412 (e.g.~failing).
413 \\
414 Labels:
415 & \ALabel{M_1}, \ALabel{S_1}
416 & Labels are used to label steps when a security protocols is
417 presented as a series of steps.
418 \\
419 {\latex} code:
420 & \ACmd{\Verb|\AFunc{Func}{x,y}|}
421 & {\latex} code is shown when documenting the usage of the notation
422 in text using the {\latex} package \ACmd{aspen}.
423 \end{xltabular}\vspace*{\baselineskip}}
424 \caption{In the text, color is used to distinguish different features.}
425 \label{fig:col}
426 \end{figure}
427
428 %\kkey{A}, \kkey*{A}, \kkey-{A}, \kkey+{A}, \kkey!{A}, \kkey'{A}, \kkey"{A},
429 %\AKey{B}, \AKey*{B}, \AKey-{B}, \AKey+{B}, \AKey!{B}, \AKey'{B}, \AKey"{B},
430 %\AMkfunc{MyTest}[chash]
431 %|\AFuncMyTest{x}[*]|
432 %|\AChashf{m}[*]|
433 %\AMkkfunc{MyK}[encrypted]
434 %|\AKfuncMyK{x}{y}[*]|
435 %|\AEncrypt+{A}{m}[*]| |\APwkeyf{P}(s)[P]| |\APwkeyf{P}(s)[*]|
436 %|\AEncrypted{x}{m}|
437 %|\AMacf{A}{m}[*]| |\ACmacf{A}{m}[*]| |\AHmacf{A}{m}[*]|
438 %|\ASigf-{A}{m}[*]| |\ASign!{A}{m}[*]|
439
440 Why {\Aspen} then? One motivation is to have an expressive notation
441 that can be used in publications where security protocols are
442 presented. Another motivation is to have a notation that can be used
443 when teaching security related topics. This text is an attempt to
444 document a notation that have been used and refined over years. The
445 notation should be familiar, but with some new useful refinements and
446 contributions not found in similar notations. It should also be
447 possible to use the notation together with other notations, like BAN
448 logic. A more detailed discussion on the choices made for the
449 {\Aspen} notation is found in Appendix~\ref{sec:notes-notation},
450 \emph{\nameref{sec:notes-notation}}. A short introduction to {\aspen}
451 is published in
452 \href{https://tug.org/TUGboat/Contents/contents47-1.html}%
453 {TUGboat}~\cite{andersen2026b}. The {\latex} package can be downloaded
454 from \href{https://ctan.org/pkg/aspen}{CTAN} or its home:
455 \begin{quote}
456 \href{https://www.pg12.org/dist/texmf/tex/latex/aspen/}%
457 {\ACmd{https://www.pg12.org/dist/texmf/tex/latex/aspen/}}
458 \end{quote}
459
460 When using {\Aspen}, colors can be used to distinguish different types
461 of features. Figure~\ref{fig:col} illustrates how the different
462 features are colored. Colors are optional when using the
463 notation. They are enabled by the \ACmd{color} option to the {\latex}
464 package \ACmd{aspen}. Colors are only added for readability. The
465 {\latex} package \ACmd{aspen} provides different color profiles for
466 typesetting the notation (see Appendix~\ref{sec:notes-options},
467 \emph{\nameref{sec:notes-options}}).
468
469 If the \ACmd{aspen} package is loaded with the option
470 \ACmd{ban}, the BAN logic notation from ``A Logic of
471 Authentication»~\cite{burrows1990a} is included (see
472 Section~\ref{sec:notation-ban} and~\ref{sec:latex-ban}).
473
474
475 \clearpage
476 \section{The notation}
477 \label{sec:notation}
478
479 In the description of the notation below, notation that might be
480 obvious is included. It is done for completeness and consistency.
481 For some notation constructs, usage examples are provided. These
482 examples might include notation constructs explained later in the
483 text.
484
485
486 \subsection{{\Aspen}}
487 \label{sec:notation-aspen}
488
489 {\renewcommand{\arraystretch}{1.6}
490 \begin{xltabular}{\textwidth}{lX}\Xhline{0.5pt}
491
492 \textbf{Notation}
493 & \textbf{Description} \\\Xhline{0.5pt}
494
495 $=,<,\leq,>,\geq$
496 & $=$ means \emph{``is equal''}, either as a statement or a claim
497 (e.g.,~a claim that can be, or has to be, verified). $<$, $\leq$, $>$
498 and $\geq$ means \emph{``less than''}, \emph{``less than or equal''},
499 \emph{``greather than''}, and \emph{``greather than or equal''},
500 respectively. These notation constructs are typically used to
501 compare counters and timestamps in protocols.
502 \\\hline
503
504 $\!\AXor\!,\AConcat$
505 & The binary operator $\AXor$ is exclusive or, and the binary operator
506 $\AConcat$ is concatenation (used to concatenate two values or strings).
507 The concatenation operator has precedence over the exclusive or operator.
508 In Section \ref{sec:notes-options}, other options for the binary
509 concatenation operator is presented.
510 \\\hline
511
512 $\AIfthen,\AIffthen$
513 & $\AVar{x}\AIfthen\AVar{y}$ means \emph{``\AVar{y}, if~\AVar{x}''}.
514 $\AVar{x}\AIffthen\AVar{y}$ means \emph{``\AVar{y}, if and only
515 if~\AVar{x}''}. This is an example used with the
516 \AFunctionname{\AVerifytext} function (see below for the description of
517 other parts of the notation used in the example):
518 \newline
519 \example{\AVerify+[big]{A}{\ASigned{x}{m}} = \ATrue \enspace
520 \AIffthen \enspace \AKey{x} = \APrivkey{A}}
521 \\\hline
522
523 $\AAssign{v}{0}, \AAssign{v}{v + 1}$
524 & The left arrow is used for assignments. It is sometimes useful to
525 give names to values and be able to change named values.
526 \\\hline
527
528 \ATrue, \AFalse
529 & The boolean values \emph{true} and
530 \emph{false}. The value {\ATrue} will also be used to show that
531 an operation completed with success (if that is important). For
532 example, when we verify a digital signature and it is found valid, the
533 function doing the verification returns the value {\ATrue}.
534 Otherwise, the value {\AFalse} is returned.
535 \\\hline
536
537 $\ACond[\textit{e}]{\ACondstep{c_1}{s_1}\ANextbreak
538 \ldots}$
539 & Conditionals can be used to change the behavior of a protocol based
540 on a condition. A conditional consists of an optional expression
541 followed by question mark (\textbf{?}) followed by conditional steps.
542 Each conditional step consist of a condition followed by a colon
543 (\textbf{:}) followed by the step that should be performed if the
544 condition is true. Conditional steps are separated by a single
545 or a double semicolon (\textbf{;} or \textbf{;;}).
546 Conditional step $s_1$ is performed if condition $c_1$ is fulfilled,
547 and so on. Fulfilled means that the condition match
548 the expression, or if no expression is given, the condition is true.
549 The two semicolons \textbf{;;} mark a break, meaning that if the
550 condition before the two semicolons is {\ATrue} and the conditional
551 step is performed, the rest of the conditional steps are ignored (and
552 not evaluated and performed). If a single semicolon \textbf{;} is
553 used, the behavior is different; even if the conditional step before
554 the semicolon is performed, the following conditional steps are
555 evaluated and will be performed if their conditions are fulfilled.
556 The following two examples are semantically the same; they assign the
557 value $\ANonce{y}+1$ to \AVal{v} if \AVal{V} is equal to $\ANonce{y}+1$
558 and otherwise abort the protocol:
559 \newline
560 \example{%
561 \ACond[\AVal{V}=\ANonce{y}+1]{%
562 \ACondstep{\ATrue}{\AAssign{v}{\AVal{v}+1}}%
563 \ANextbreak
564 \ACondstep{\AFalse}{\AAbort(LightLightGrey)}}\\
565 \ACond{%
566 \ACondstep{\AVal{V}=\ANonce{y}+1}{\AAssign{v}{\AVal{v}+1}}%
567 \ANextbreak
568 \ACondstep{\AVal{V}\neq\ANonce{y}+1}{\AAbort(LightLightGrey)}}}
569 \\\hline
570
571 $\land,\lor,\lnot$
572 & Logical \emph{and}, \emph{or} and \emph{not}, respectively. Can be
573 used in the conditions of conditional steps.
574 \\\hline
575
576 $\AVar{x}\AUnpack\AVar{y}$
577 & We use an unpack (leads-to) arrow {\AUnpack} to show more
578 details or to unpack a value or a message. The following example
579 shows that a digital signature is actually a cryptographic hash
580 value of the message encrypted with a private key (see below for the
581 description of other parts of the notation used in the example):
582 \newline
583 \example{\ASig-{A}{m}\AUnpack\AEncrypted-[big]{A}{\AChash{m}}}
584 \\\hline
585
586 \AKey{X}
587 & A shared or secret key, also known as a symmetric encryption and
588 decryption key.
589 \\\hline
590
591 \AKey{A,B}
592 & A shared key for \APri{A} and \APri{B} (this notation can be
593 extended, for example with \AKey{A,B,C} for a key shared between
594 \APri{A}, \APri{B}, and \APri{C}, or \AKey{\AGroup{M}} for a
595 key shared among $n$ group members \AGroup*{M}).
596 \\\hline
597
598 \AKey'{C,S}
599 & A session key for \APri{C} and \APri{S} (this notation can be
600 extended, for example with \AKey'{A,B,S} for a key session key
601 shared between \APri{A}, \APri{B}, and \APri{S}, or \AKey'{\AGroup{M}}
602 for a session key shared among $n$ group members \AGroup*{M}).
603 \\\hline
604
605 \AKey+{A}
606 & The public key of a public-private key pair of \APri{A}:
607 $(\AKey+{A},\AKey-{A})$.
608 \\\hline
609
610 \AKey-{A}
611 & The private key of a public-private key pair of \APri{A}:
612 $(\AKey+{A},\AKey-{A})$.
613 \\\hline
614
615 \APwkey{P}
616 & A secret key generated from the password \AVal{P}.
617 \\\hline
618
619 \ASval{m}
620 & A structured value or message containing \AVal{m}. A structured value
621 can be nested.
622 \\\hline
623
624 \ATval{T}{m}
625 & A structured value or message with the type \AVal{T}. An example
626 of a structured value marked with the type \AVal{\textit{Sig}}:
627 \newline
628 \example{\ASig!{A}{m}\mbox{ has the type \emph{\AVal{\textit{\ASigtext}}}
629 and the superscript }\AName{A}\mbox{ (signed by \APri{A})}}
630 \\\hline
631
632 \ASend{A}{B}{m}
633 & Message \AMsg{m} sent from \APri{A} to \APri{B}.
634 \\\hline
635
636 \AFunc{Func}{\AVar{x},\AVar{y}}
637 & A function $\AFunctionname{Func}$ with two arguments \AVar{x}
638 and \AVar{y} (\AFunctionname{Encrypt} and \AFunctionname{Decrypt}
639 described below are examples of such functions).
640 \\\hline
641
642 \AFunc{Func}{\AVar{x},\AVar{y}}[\AVar{z}]
643 & We use an arrow {\AProduces} to illustrate what a function produces
644 (in this case \AVar{z}). The following example shows that the function
645 \AFunctionname{Encrypt} produces a ciphertext encrypted with the given
646 shared key (see below for the description of other parts of the notation
647 used in the example):
648 \newline
649 \example{\AEncrypt{A,B}{m}[*]}
650 \\\hline
651
652 \AProc{Proc}[text]
653 & A procedure $\AProcedurename{Proc}$ with an optional comment \AStr{text}
654 Procedures are similar to functions, but they don’t produce a value.
655 Instead they have an affect on the running protocol, and they are
656 typically used if something fails or some conditions are not satisfied.
657 The name of procedures are underlined.
658 \\\hline
659
660 {\AAbort}
661 & The procedure \AProcedurename{Abort} immediately aborts the current
662 protocol. An optional comment can be given:
663 \newline
664 \example{\AAbort(LightLightGrey)[Comment]}
665 \\\hline
666
667 \AEncrypted*{\raisebox{-2pt}{\AKey*{\square}}}{m}
668 & In general, a subscripted structured value means an encrypted
669 value or message (a ciphertext), where the subscript
670 \raisebox{0pt}{\AKey*{\square}} represents the encryption key
671 (or the holder of the encryption key). This is an example where
672 the plain text \AVal{m} is encrypted with the encryption key
673 \AKey*{K}:
674 \newline
675 \example{\AEncrypted*{K}{m}}
676 \\\hline
677
678 \ASigned*{\raisebox{0pt}{\AKey*{\square}}}{m}
679 & In general, a superscripted structured value means a signed
680 value or message, where the superscript \raisebox{0pt}{\AKey*{\square}}
681 represents the key used to sign (or the holder of the key used to sign).
682 This is an example where the plain text \AVal{m} is signed by
683 principal~\APri{A}:
684 \newline
685 \example{\ASigned!{A}{m}}
686 \\\hline
687
688 % \AEncrypted*{K}{m}
689 % & Plain text \AVal{m} is encrypted with key \AKey*{K}.
690 % \\\hline
691
692 % \AEncrypted+{A}{m}
693 % & Plain text \AVal{m} is encrypted with public key \AKey+{A}.
694 % \\\hline
695
696 \AEncrypt{A,B}{m}
697 & Encrypt plain text \AVal{m} with shared key \AKey{A,B}:
698 \newline
699 \example{\AEncrypt{A,B}{m}[*]}
700 \\\hline
701
702 \ADecrypt{A,B}{\AVar{c}}
703 & Decrypt cipher text \AVar{c} with shared key \AKey{A,B}, where
704 $\AVar{c}=\AEncrypted{A,B}{m}$:
705 \newline
706 \example{\ADecrypt{A,B}{\AVar{c}}\AUnpack
707 \ADecrypt[big]{A,B}{\AEncrypted{A,B}{m}}[m]}
708 \\\hline
709
710 \AEncrypt+{A}{m}
711 & Encrypt plain text \AVal{m} with public key \AKey+{A}:
712 \newline
713 \example{\AEncrypt+{A}{m}[*]}
714 \\\hline
715
716 \ADecrypt-{A}{\AVar{c}}
717 & Decrypt cipher text \AVar{c} with private key \AKey-{A}, where
718 $\AVar{c}=\AEncrypted+{A}{m}$:
719 \newline
720 \example{\ADecrypt-{A}{\AVar{c}}\AUnpack
721 \ADecrypt-[big]{A}{\AEncrypted+{A}{m}}[m]}
722 \\\hline
723
724 \AChash{m}
725 & A cryptographic hash value of \AVal{m}.
726 \\\hline
727
728 \AChashf{m}
729 & A cryptographic hash function producing the cryptographic hash
730 value of \AVal{m}:
731 \newline
732 \example{%
733 \AChashf{m}[*]}
734 \\\hline
735
736 \AMac{A}{m}
737 & The message authentication code of \AVal{m} with key \AKey{A}.
738 \\\hline
739
740 \ACmac{A}{m}
741 & The cipher-based message authentication code of \AVal{m} with key
742 \AKey{A}.
743 \\\hline
744
745 \AHmac{A}{m}
746 & The HMAC message authentication code \cite{bellare1996a} of
747 \AVal{m} with key \AKey{A}.
748 \\\hline
749
750 \AMacf{A}{m}
751 & The message authentication code function producing the message
752 authentication code of \AVal{m} with key \AKey{A}:
753 \newline
754 \example{\AMacf{A}{m}[*]}
755 \\\hline
756
757 \ACmacf{A}{m}
758 & The cipher-based message authentication code function producing the
759 cipher-based message authentication code of \AVal{m} with key \AKey{A}:
760 \newline
761 \example{%
762 \ACmacf{A}{m}[*]}
763 \\\hline
764
765 \AHmacf{A}{m}
766 & The HMAC message authentication code function producing the HMAC
767 message authentication code of \AVal{m} with key \AKey{A}:
768 \newline
769 \example{%
770 \AHmacf{A}{m}[*]\AUnpack
771 \AChash[Big]{(\AKey*{\overline{K}_A}\AXor\textit{opad})\AConcat
772 \AChash[big]{(\AKey*{\overline{K}_A}\AXor\textit{ipad})\AConcat m}}\\
773 \AKey*{\overline{K}_A} \ = \ \; \Biggr\{
774 \raisebox{0pt}{%
775 $\def\arraystretch{1}\begin{array}{ll@{}}
776 \AChash{\AKey{A}} & \textrm{if \AKey{A} is larger than block size} \\
777 \AKey{A} & \textrm{otherwise}
778 \end{array}$}}\newline
779 The two block-sized paddings, \AVal{\textit{opad}} (outer padding) and
780 \AVal{\textit{ipad}} (inner padding), each consists of a repeating byte
781 value (\AVal{0\textrm{x}5\textrm{c}} and \AVal{0\textrm{x}36},
782 respectively).
783 \\\hline
784
785 \ASig!{A}{m}
786 & Digital (cryptographic) signature of \AVal{m} signed by \APri{A}.
787 \\\hline
788
789 \ASig-{A}{m}
790 & Digital (cryptographic) signature of \AVal{m} signed with private key
791 \AKey-{A}:
792 \newline
793 \example{\ASig-{A}{m}\AUnpack\AEncrypted-[big]{A}{\AChash{m}}}
794 \\\hline
795
796 \ASig!{A,B}{m}
797 & Digital (cryptographic) signature of \AVal{m} based on a shared secret
798 between \APri{A} and \APri{B}.
799 \\\hline
800
801 \ASig{A,B}{m}
802 & Digital (cryptographic) signature of \AVal{m} signed with the shared
803 key \AKey{A,B} (a shared secret between \APri{A} and \APri{B}):
804 \newline
805 \example{\ASig{A}{m}\AUnpack\AEncrypted[big]{A,B}{\AChash{m}}}
806 \\\hline
807
808 \ASigf-{A}{m}
809 & Function creating a digital (cryptographic) signature of \AVal{m}
810 with private key \AKey-{A}:
811 \newline
812 \example{\ASigf-{A}{m}[*]}
813 \\\hline
814
815 \ASigf!{A,B}{m}
816 & Function creating a digital (cryptographic) signature of \AVal{m}
817 based on a shared secret between \APri{A} and \APri{B}:
818 \newline
819 \example{\ASigf!{A,B}{m}[*]}
820 \\\hline
821
822 \ASigf{A,B}{m}
823 & Function creating a digital (cryptographic) signature of \AVal{m}
824 with the shared key \AKey{A,B} (a shared secret between \APri{A}
825 and \APri{B}):
826 \newline
827 \example{\ASigf{A,B}{m}[*]}
828 \\\hline
829
830 \ASigned!{A}{m}
831 & \AVal{m} is signed by \APri{A} (\AVal{m} signed is a combination
832 of \AVal{m} itself and a digital signature of \AVal{m}, in this case
833 a digital signature signed by \APri{A}):
834 \newline
835 \example{\ASigned!{A}{m}\AUnpack\ASval[big]{m,\ASig!{A}{m}}}
836 \\\hline
837
838 \ASigned-{A}{m}
839 & \AVal{m} is signed with private key \AKey-{A} (\AVal{m}
840 signed is a combination of \AVal{m} itself and a digital signature of
841 \AVal{m}, in this case a digital signature signed with \AKey-{A}
842 implemented by encrypting the cryptographic hash value of \AVal{m} with
843 \AKey-{A}):
844 \newline
845 \example{\ASigned-{A}{m}\AUnpack\ASval[big]{m,\ASig-{A}{m}}
846 \AUnpack\ASval[Big]{m,\AEncrypted-[big]{A}{\AChash{m}}}}
847 \\\hline
848
849 \ASigned!{A,B}{m}
850 & \AVal{m} is signed with a shared secret of \APri{A} and \APri{B}\/
851 (\AVal{m} signed is a combination of \AVal{m} itself and a digital
852 signature of \AVal{m}, in this case a digital signature signed with
853 a shared secret of \APri{A} and \APri{B}):
854 \newline
855 \example{\ASigned!{A,B}{m}\AUnpack\ASval[big]{m,\ASig!{A,B}{m}}}
856 \\\hline
857
858 \ASigned{A,B}{m}
859 & \AVal{m} is signed with a shared secret of \APri{A} and \APri{B};
860 the shared key \AKey{A,B} (\AVal{m} signed is a combination of
861 \AVal{m} itself and a digital signature of \AVal{m}, in this case
862 a digital signature signed with the shared key \AKey{A,B} implemented
863 by encrypting the cryptographic hash value of \AVal{m} with
864 \AKey{A,B}):
865 \newline
866 \example{\ASigned{A,B}{m}\AUnpack\ASval[big]{m,\ASig{A,B}{m}}
867 \AUnpack\ASval[Big]{m,\AEncrypted[big]{A,B}{\AChash{m}}}}
868 \\\hline
869
870 \ASign!{A}{m}
871 & \APri{A} signs \AVal{m} (\AVal{m} signed is a combination of
872 \AVal{m} itself and a digital signature of \AVal{m}, in this
873 case a digital signature signed by \APri{A} implemented by \AName{A}
874 encrypting the cryptographic hash value of \AVal{m}):
875 \newline
876 \example{\ASign!{A}{m}[*]\AUnpack
877 \ASval[big]{m,\ASig!{A}{m}}}
878 \\\hline
879
880 \ASign-{A}{m}
881 & Sign \AVal{m} with private key \AKey-{A} (\AVal{m} signed is
882 a combination of \AVal{m} itself and a digital signature of
883 \AVal{m}, in this case a digital signature signed with \AKey-{A}
884 implemented by encrypting the cryptographic hash value of \AVal{m}
885 with \AKey-{A}):
886 \newline
887 \example{\ASign-{A}{m}[*]\AUnpack
888 \ASval[big]{m,\ASig-{A}{m}}\AUnpack
889 \ASval[Big]{m,\AEncrypted-[big]{A}{\AChash{m}}}}
890 \\\hline
891
892 \ASign!{A,B}{m}
893 & Sign \AVal{m} with a shared secret of \APri{A} and \APri{B}
894 (\AVal{m} signed is a combination of \AVal{m} itself and a
895 digital signature of \AVal{m}, in this case a digital signature
896 signed with a shared secret of \APri{A} and \APri{B} implemented by
897 encrypting the cryptographic hash value of \AVal{m}
898 with a key based on a shared secret of \AName{A} and \AName{B}):
899 \newline
900 \example{\ASign!{A,B}{m}[*]\AUnpack
901 \ASval[big]{m,\ASig!{A,B}{m}}}
902 \\\hline
903
904 \ASign{A,B}{m}
905 & Sign \AVal{m} with a shared secret of \APri{A} and \APri{B}\/;
906 the shared key \AKey{A,B} (\AVal{m} signed is a combination of
907 \AVal{m} itself and a digital signature of \AVal{m}, in this
908 case a digital signature signed with the shared key \AKey{A,B}
909 implemented by encrypting the cryptographic hash value of \AVal{m}
910 with \AKey{A,B}):
911 \newline
912 \example{\ASign{A,B}{m}[*]\AUnpack
913 \ASval[big]{m,\ASig{A,B}{m}}\AUnpack
914 \ASval[Big]{m,\AEncrypted[big]{A,B}{\AChash{m}}}}
915 \\\hline
916
917 \APwkeyf{P}(s)
918 & Create a secret key from the password \AVal{P} with the
919 salt \AVal{s}. The salt is optional in the notation.
920 \emph{PBKDF2} is an examples of a password-based key derivation
921 function. The function creates a new secret key:\newline
922 \example{%
923 \APwkeyf{P_1}[*] \\
924 \APwkeyf_{PBKDF2}{P_2}(s)[*]}
925 \\\hline
926
927 \ADhpubkeyf{A}(p)
928 & Make a public key \AKey+{A} (a key share) from the private key \AKey-{A}
929 and the public parameters \AVal{p}, typically used in a Diffie–Hellman
930 key exchange protocol~\cite{diffie1976a} (a Diffie–Hellman key share).
931 The public parameters argument is optional in the notation:\newline
932 \example{%
933 \ADhpubkeyf{A}[A]\\
934 \ADhpubkeyf{B}(p)[B]}\newline
935 In the original implementation of Diffie-Hellman (Finite Field
936 Diffie–Hellman) the public parameters consists of a agreed upon
937 prime and a primitive root.
938 \\\hline
939
940 \ADhkeyf{A}{B}(p)
941 & Combine private key \AKey-{A} with public key \AKey+{B} and the
942 public parameters \AVal{p} (optional) to generate a new secret (shared)
943 key \AKey{A,B}, typically the result of a Diffie–Hellman key exchange
944 protocol~\cite{diffie1976a}. The public parameters argument
945 is optional:\newline
946 \example{%
947 \ADhkeyf{A}{B}[A,B]\\
948 \ADhkeyf{B}{A}(p)[A,B]}\newline
949 These functions are one-way functions where the private keys
950 \AKey-{A} and \AKey-{B} can not be calculated (in reasonable time)
951 with only the knowledge of the public keys \AKey+{A} and \AKey+{B}
952 and the public parameters \AVal{p}. As a consequence, the
953 new shared secret key \AKey{A,B} is also difficult (impossible in
954 practice) to calculate.
955 \\\hline
956
957 \AVerify+{A}{\AVar{s}}
958 & Verify that the signed structured value (message) \AVar{s} is
959 signed by the matching private key \AKey-{A} of public key \AKey+{A}
960 and, as a consequence, verify that \AVar{s} is signed by~\APri{A}:
961 \newline
962 \example{%
963 \AVerify+{A}{\AVar{s}}\AUnpack \AVerify+[big]{A}{\ASigned!{x}{m}}
964 \AUnpack \AVerify+[Big]{A}{\ASval[big]{m,\ASig!{x}{m}}}\AUnpack \\
965 \AVerify+[Big]{A}{\ASval[big]{m,\ASig-{x}{m}}}\AUnpack
966 \AVerify+[bigg]{A}{\ASval[Big]{m,\AEncrypted-[big]{x}{\AChash{m}}}}:
967 \\[1.5ex]\hline
968 \begin{array}{@{}c}
969 \ADecrypt+[big]{A}{\ASig!{x}{m}}=\AChash{m} \enspace \AUnpack \\
970 \ADecrypt+[big]{A}{\ASig-{x}{m}}=\AChash{m} \enspace \AUnpack \\
971 \ADecrypt+[Big]{A}{\AEncrypted-[big]{x}{\AChash{m}}}=\AChash{m}
972 \end{array} \raisebox{-2pt}{$\Bigggggr\}$} \quad
973 \raisebox{-2pt}{$\AIffthen$} \quad
974 \raisebox{-2pt}{$\AKey-{A} = \AKey-{x}$} \\[1.5ex]\hline
975 \AVerify+{A}{\AVar{s}}[\ATrue] \quad \AIffthen
976 \quad \AKey-{A} = \AKey-{x}}
977 \\\hline
978
979 \AVerify!{C}{\AVar{s}}
980 & Verify that the signed structured value (message) \AVar{s} is
981 signed by principal \APri{C}.
982 \\\hline
983
984 \ACertificate!{C}{\APri{A},\AKey+{A}}
985 & A certificate where certificate authority \APri{C} binds identity
986 \APri{A} to public key \AKey+{A} (in the example, \AVal{\ldots}
987 is other certificate related meta-data):
988 \newline
989 \example{%
990 \ACertificate!{C}{\APri{A},\AKey+{A}}\AUnpack
991 \ASigned!{C}{\APri{A},\AKey+{A},\AVal{\ldots}}}
992 \\\hline
993
994 \ACertificate-{C}{\APri{A},\AKey+{A}}
995 & A certificate where a certificate authority with private key \AKey-{C}
996 binds identity \APri{A} to public key \AKey+{A} (in the example,
997 \AVal{\ldots} is other certificate related meta-data):
998 \newline
999 \example{%
1000 \ACertificate-{C}{A,\AKey+{A}}\AUnpack
1001 \ASigned-{C}{A,\AKey+{A},\AVal{\dots}} \\\hline
1002 \AVerify+{C}{\ACertificate-{C}{A,\AKey+{A}}}\enspace\AUnpack
1003 \enspace\AVerify+{C}{%
1004 \ASigned-{C}{A,\AKey+{A},\AVal{\dots}}}[\ATrue]}
1005 \\\Xhline{0.5pt}
1006
1007 \end{xltabular}}
1008
1009 \subsection{BAN logic}
1010 \label{sec:notation-ban}
1011
1012 The description below of the BAN logic notation is copied directly,
1013 with some minor modifications, from the original paper presenting the
1014 BAN logic, ``A Logic of Authentication''~\cite{burrows1990a}.
1015
1016 {\renewcommand{\arraystretch}{1.6}
1017 \begin{xltabular}{\textwidth}{lX}\Xhline{0.5pt}
1018
1019 \textbf{Notation}
1020 & \textbf{Description}
1021 \\\Xhline{0.5pt}
1022
1023 \APri{A}\BANBelieves\AVal{X}
1024 & \APri{A} \emph{believes} \AVal{X}, or \APri{A} would be entitled to
1025 believe \AVal{X}. In particular the principal \APri{A} may act as though
1026 \AVal{X} is true. This construct is central to the BAN logic. \\\hline
1027
1028 \APri{A}\BANSees\AVal{X}
1029 & \APri{A} \emph{sees} \AVal{X}. Someone has sent a message containing
1030 \AVal{X} to \APri{A}, who can read and repeat \AVal{X} possibly after
1031 doing some decryption.
1032 \\\hline
1033
1034 \APri{A}\BANOncesaid\AVal{X}
1035 & \APri{A} \emph{once said} \AVal{X}. The principal \APri{A} at some time
1036 sent a message including the statement \AVal{X}. It is not known whether
1037 the message was sent long ago or during the current run of the
1038 protocol, but it is known that \APri{A} believed \AVal{X} when \APri{A}
1039 sent the message.
1040 \\\hline
1041
1042 \APri{A}\BANControls\AVal{X}
1043 & \APri{A} has \emph{jurisdiction} over \AVal{X} (\APri{A}
1044 \emph{controls} \AVal{X}). The principal \APri{A} is an authority on
1045 \AVal{X} and should be trusted on this matter. This construct is used
1046 when a principal has delegated authority over some statement. For
1047 example, encryption keys need to be generated with some care, and in
1048 some protocols certain servers are trusted to do this properly. This
1049 may be expressed by the assumption that the principals believe that
1050 the server has jurisdiction over statements about the quality of keys.
1051 \\\hline
1052
1053 \BANFresh{X}
1054 & The formula \AVal{X} is \emph{fresh}, that is, \AVal{X} has not been
1055 sent in a message at any time before the current run of the protocol.
1056 This is usually true for nonces, that is expressions generated for
1057 the purpose of being fresh (nonce---number used once). Nonces
1058 commonly include a timestamp or a number that is used only once,
1059 such as a sequence number.
1060 \\\hline
1061
1062 \APri{A}\BANSharedkey{K}\APri{B}
1063 & \APri{A} and \APri{B} may use the \emph{shared key} \AKey*{K} to
1064 communicate. The key \AKey*{K} is good, in that it will never be
1065 discovered by any principal except \APri{A} or \APri{B}, or a
1066 principal trusted by either \APri{A} or~\APri{B}. (In {\Aspen}, a
1067 shared key \APri{A} and \APri{B} may use to communicate can be
1068 denoted~\AKey{A,B}.)
1069 \\\hline
1070
1071 \BANPubkey{K}\APri{A}
1072 & \APri{A} has \AKey*{K} as a \emph{public key}. The matching secret
1073 key (the inverse of \AKey*{K}, denoted \AKey*{K^{-1}}) will never be
1074 discovered by any principal except \APri{A}, or a principal trusted
1075 by \APri{A}. (In {\Aspen}, a public key of \APri{A} can be denoted
1076 \AKey+{A}, and the inverse of \AKey+{A}, the private key, is
1077 denoted~\AKey-{A}.)
1078 \\\hline
1079
1080 \APri{A}\BANSecret{X}\APri{B}
1081 & The formula \AVal{X} is a \emph{secret} known only to \APri{A} and
1082 \APri{B}, and possibly to principals trusted by them. Only \APri{A}
1083 and \APri{B} may use \AVal{X} to prove their identities to one
1084 another. Often \AVal{X} is fresh as well as secret. An example of a
1085 shared secret is a password.
1086 \\\hline
1087
1088 \BANEncryptedwith{K}{X}
1089 & This represents the formula \AVal{X} \emph{encrypted} under the key
1090 \AKey*{K}. Formally, \BANEncryptedwith{K}{X} is an abbreviation for an
1091 expression of the form \BANEncryptedwith{K}{X} \emph{from} \APri{A}. We
1092 make the realistic assumption that each principal is able to recognize
1093 and ignore his own messages; the originator of each message is mentioned
1094 for this purpose. In the interests of brevity, we typically omit this
1095 in our examples.
1096 \\\hline
1097
1098 \BANCombine{\AVal{X}}{\AVal{Y}}
1099 & This represents \AVal{X} \emph{combined} with the formula \AVal{Y};
1100 it is intended that \AVal{Y} be a secret, and that its presence prove
1101 the identity of whoever utters\BANCombine{\AVal{X}}{\AVal{Y}}. In
1102 implementations, \AVal{X} is simply concatenated with the password
1103 \AVal{Y}; our notation highlights that \AVal{Y} plays a special
1104 r{\^o}le, as proof of origin for \AVal{X}. The notation is intentionally
1105 reminiscent of that for encryption, which also guarantees the
1106 identity of the source of a message through knowledge of a certain kind
1107 of secret.
1108 \\\Xhline{0.5pt}
1109
1110 \end{xltabular}}
1111
1112 In the {\Aspen} notation, when we write \AKey{A,B}, it is implicit that
1113 \APri{A} and \APri{B} may use \AKey{A,B} to communicate. We can use the
1114 BAN logic notation to make it explicit:
1115
1116 \[
1117 \APri{A}\BANSharedkey{\AKey{A,B}}\APri{B}
1118 \]
1119
1120 In a similar manner, \AKey+{A} is in the {\Aspen} notation implicit a
1121 \emph{public key} of \APri{A}. We can use the BAN logic notation to
1122 make it explicit:
1123
1124 \[
1125 \BANPubkey{\AKey+{A}}\APri{A}
1126 \]
1127
1128 Both the BAN logic notation and {\Aspen} use the notation
1129 \AEncrypted*{K}{m} for the formula \AVal{m} \emph{encrypted} under the
1130 key \AKey*{K} (\AVal{m} encrypted with the key \AKey*{K}). In this
1131 case, {\Aspen} has adopted the notation used in BAN logic and in a lot
1132 of other related publications and text books.
1133
1134
1135 \clearpage
1136 \section{Use the notation in text}
1137 \label{sec:write-notation-latex}
1138
1139 This section explains how to use {\Aspen} in {\latex} documents.
1140 The new {\latex} commands and environments used are defined in the
1141 {\latex} package \ACmd{aspen}.
1142
1143 We will in the text include notation examples that might not make
1144 sense in a security protocol perspective. However, they are included
1145 for completeness. We will in the documentation try to include a wide
1146 range of possibilities available from the {\latex} package
1147 \ACmd{aspen}.
1148
1149 For commands with arguments, the argument types are given using a
1150 notation inspired by the \ACmd{xparse} argument specification:
1151
1152 {\renewcommand{\arraystretch}{1.3}%
1153 \begin{xltabular}{\textwidth}{%
1154 @{\hskip 1em\relax}lX@{\hskip -1.2em\relax}|@{\hskip 1.2em\relax}lX}
1155 \ACmd{\Verb|m|} & Mandatory arguments\newline
1156 \emph{Examples:} \Verb|\cmd{arg}|
1157 & \ACmd{\Verb|B|} & Optional bracket sizes (\ACmd{big}, \ACmd{Big},
1158 \ldots)\newline
1159 \emph{Examples:} \Verb|\cmd|, \Verb|\cmd[Big]| \\
1160 \ACmd{\Verb|o|} & Optional arguments\newline
1161 \emph{Examples:} \Verb|\cmd|, \Verb|\cmd[arg]|
1162 & \ACmd{\Verb|s|} & Optional stars (alternative versions)\newline
1163 \emph{Examples:} \Verb|\cmd|, \Verb|\cmd*| \\
1164 \ACmd{\Verb|O{default}|} & Optionals with default value \newline
1165 \emph{Examples:} \Verb|\cmd|, \Verb|\cmd[arg]|
1166 & \ACmd{\Verb|T|} & Optional key types: \Verb|*|, \Verb|-|, \Verb|+|,
1167 \Verb|!|, \Verb|'|, or \Verb|"|\newline
1168 \emph{Examples:} \Verb|\cmd|,
1169 \Verb|\cmd-|, \Verb|\cmd!| \\
1170 \ACmd{\Verb|p|} & Optionals in parenthesis \newline
1171 \emph{Examples:} \Verb|\cmd|, \Verb|\cmd(arg)|
1172 & \ACmd{\Verb|x|} & Optionals with magic return \newline
1173 \emph{Examples:} \Verb|\cmd|, \Verb|\cmd[*]|,
1174 \Verb|\cmd[arg]| \\
1175 \ACmd{\Verb|P{default}|} & Parenthesis optionals with default\newline
1176 \emph{Examples:} \Verb|\cmd|, \Verb|\cmd(arg)|
1177 & \ACmd{\Verb|i|} & Optional embellishment (more details)\newline
1178 \emph{Examples:} \Verb|\cmd|, \Verb|\cmd_{arg}| \\
1179 \ACmd{\Verb|t'|} & Optional single quote marks\newline
1180 \emph{Examples:} \Verb|\cmd|, \Verb|\cmd'|
1181 & \givesarrow & Arguments of returned command\newline
1182 \emph{Examples:} \cmdargs{mkcmd}{omo}[Bimx]
1183 \end{xltabular}}
1184
1185 We can use this notation to specify the type of the arguments to a
1186 command. For example, \ACmd{\Verb|om|} says that the command takes
1187 two arguments where the first one is optional (in square brackets).
1188 We use the symbol {\AProduces} to specify the arguments of a command
1189 created by another command. For example, \ACmd{\Verb|\AMktval|} has
1190 one optional argument (\ACmd{\Verb|o|}) and one mandatory argument
1191 (\ACmd{\Verb|m|}) and returns a new command that has one optional star
1192 argument (\ACmd{\Verb|s|}), one optional bracket size argument
1193 (\ACmd{\Verb|B|}), one optional embellishment (\ACmd{\Verb|i|}), and
1194 one mandatory argument (\ACmd{\Verb|m|}):
1195 \begin{quote}
1196 \cmdargs{AMktval}{om}[sBim]
1197 \end{quote}
1198
1199 The optional magic return type \ACmd{\Verb|x|} is available for some
1200 predefined functions and can be be made available for functions
1201 created with the commands \ACmd{\Verb|\AMkfunc|} and
1202 \ACmd{\Verb|\AMkkfunc|}. The magic return value \ACmd{\Verb|*|} will
1203 create the return value based on what the function does. For example,
1204 if magic return is used with the encrypt function, the return value
1205 created will be the encrypted value:
1206 \begin{quote}
1207 \cmdargs{AEncrypt}{TBimmx} \newline
1208 \ACmd{\Verb|\AEncrypt+{A}{m}[*]|}\gives\AEncrypt+{A}{m}[*]
1209 \end{quote}
1210
1211 % A few commands provided creates new {\latex} commands (these commands
1212 % typically starts with \ACmd{\Verb|\mk|}. In these cases, we can then
1213 % specify the arguments both for the \ACmd{\Verb|\mk|} command and for
1214 % command created: \ACmd{\Verb|om|}~{\AProduces}~\ACmd{\Verb|sBim|}.
1215
1216 \clearpage
1217 \subsection{{\Aspen}}
1218 \label{sec:latex-aspen}
1219
1220 The table below lists the {\Aspen} notation with the matching {\latex}
1221 commands. More examples of the usage of the notation are found in
1222 Section \ref{sec:ex-notation-usage}.
1223
1224 {\renewcommand{\arraystretch}{1.6}%
1225 \begin{xltabular}{\textwidth}{l@{\hspace{.8em}}X}\Xhline{0.5pt}
1226
1227 \textbf{Notation}
1228 & \textbf{{\latex} code and description}
1229 \\\Xhline{0.5pt}
1230
1231 $=,<,\leq,>,\geq$
1232 & \ACmd{=},\ACmd{<},\ACmd{\Verb|\leq|},\ACmd{>},\ACmd{\Verb|\geq|},
1233 used to compare values.
1234 \\\hline
1235
1236 $\!\AXor\!,\AConcat$
1237 & \ACmd{\Verb|\AXor|}, \ACmd{\Verb|\AConcat|}, used as binary operators
1238 for \emph{exclusive or} and \emph{concatenation} (used to concatenate
1239 two values or strings), respectively.
1240 \\\hline
1241
1242 $\AIfthen,\AIffthen$
1243 & \ACmd{\Verb|\AIfthen|},\ACmd{\Verb|\AIffthen|}, used to reason about
1244 protocols and protocol steps (meaning, \emph{``if, then''} and
1245 \emph{``if, and only if, then''}, respectively).
1246 \\\hline
1247
1248 $\AVal{1},\AVal{2}$
1249 & \ACmd{\Verb|\AVal{1}|},\ACmd{\Verb|\AVal{2}|}, used for
1250 values.\\[-1ex]\nopagebreak
1251 \emph{Arguments:} & \cmdargs{AVal}{m}\newline
1252 \cmdargex{AVal}{\cmdmarg{value}}
1253 \\\hline
1254
1255 $\AAssign{v}{0}$
1256 & \ACmd{\Verb|\AAssign{v}{0}|}, used to assign a name to a value.
1257 In this example, the value \AVal{0} is assigned to the name \AVal{v}.
1258 \\[-1ex]\nopagebreak
1259 \emph{Arguments:} & \cmdargs{AAssign}{mm}\newline
1260 \cmdargex{AAssign}{\cmdmarg{name}\cmdmarg{value}}
1261 \\\hline
1262
1263 $\ATrue,\AFalse$
1264 & \ACmd{\Verb|\ATrue|},\ACmd{\Verb|\AFalse|}, used for the boolean values.
1265 \\\hline
1266
1267 $\ACond[e]{\ACondstep{c}{s}\ANextbreak{\ldots}}$
1268 & \ACmd{\Verb|\ACond[e]{\ACondstep{c}{s}\ANextbreak\ldots}|}, used to
1269 change the behavior of a protocol based on a condition. A conditional
1270 consists of an optional expression \textit{e} followed by question mark
1271 \textbf{?} followed by conditional steps. Each conditional step consist
1272 of a condition \textit{c} followed by a colon \textrm{:} followed by the
1273 step \textit{s} that should be performed if the condition is true.
1274 Conditional steps are separated by a single or a double semicolon,
1275 \textbf{;} (\ACmd{\Verb|\ANextcont|}, continue if previous
1276 condition is true) or \textbf{;;} (\ACmd{\Verb|\ANextbreak|},
1277 break if previous condition is true). In the following example,
1278 \ANonce{A} is assigned the value of \ANonce{x} if \ANonce{x} is
1279 equal to \ANonce{y}, otherwise the protocol is aborted:
1280 \newline
1281 \example{%
1282 \multicolumn{1}{l}{\ACmd{\EscVerb{\\ACond[\\ANonce{x}=\\ANonce{y}]\{\%}}}\\[-1ex]
1283 \multicolumn{1}{l}{\ACmd{\EscVerb{\ \ \\ACondstep{\\ATrue}{\\AAssign{\\ANonce{A}}{\\ANonce{x}}}\%}}}\\[-1ex]
1284 \multicolumn{1}{l}{\ACmd{\EscVerb{\ \ \\ANextbreak}}}\\[-1ex]
1285 \multicolumn{1}{l}{\ACmd{\EscVerb{\ \ \\ACondstep{\\AFalse}{\\AAbort}\}}}}\\
1286 %\ACmd{\Verb| \ACondstep{}|}\\ %\ATrue}{\AAssign{\ANonce{A}}{\ANonce{x}}}|}\\
1287 \multicolumn{1}{l}{\givesarrow\quad
1288 \ACond[\ANonce{x}=\ANonce{y}]{%
1289 \ACondstep{\ATrue}{\AAssign{\ANonce{A}}{\ANonce{x}}}\ANextbreak
1290 \ACondstep{\AFalse}{\AAbort(LightLightGrey)}}}}\vspace*{-2.0ex}\\ \nopagebreak
1291 \emph{Arguments:} & \cmdargs{ACond}{om}, \cmdargs{ACondstep}{mm}\newline
1292 \cmdargex{ACond}{\cmdoarg{expression}\cmdmarg{cond-steps}},
1293 \cmdargex{ACondstep}{\cmdmarg{cond}\cmdmarg{step}}
1294 \\\hline
1295
1296 $\land,\lor,\lnot$
1297 & \ACmd{\Verb|\land|}, \ACmd{\Verb|\lor|} and \ACmd{\Verb|\lnot|}, respectively.
1298 Can be used in the conditions of conditional steps.
1299 \\\hline
1300
1301 $\extxt{x}\AUnpack\extxt{y}$
1302 & \ACmd{\Verb|x \AUnpack y|}, used to unpack more details.
1303 \\\hline
1304
1305 $\APri{A},\APri{B},\APri{S}$
1306 & \ACmd{\Verb|\APri{A}|},\ACmd{\Verb|\APri{B}|},\ACmd{\Verb|\APri{S}|},
1307 used for principals.\\[-1ex]\nopagebreak
1308 \emph{Arguments:} & \cmdargs{APri}{m}\newline
1309 \cmdargex{APri}{\cmdmarg{principal}}
1310 \\\hline
1311
1312 $\ANonce*{N_A},\ANonce{S}$
1313 & \ACmd{\Verb|\ANonce*{N_A}|},\ACmd{\Verb|\ANonce{S}|},
1314 used for nonces. The \ACmd{\Verb|\ANonce|}
1315 command has an optional first argument to change the symbol
1316 (the letter): \ACmd{\Verb|\ANonce[n]{0}|}\;\givesarrow\;\ANonce[n]{0}
1317 \\[-1ex]\nopagebreak
1318 \emph{Arguments:} & \cmdargs{ANonce}{sO{N}m}\newline
1319 \cmdargex{ANonce}{\cmdsarg\cmdoarg{symbol}\cmdmarg{id}}
1320 \\\hline
1321
1322 $\ACounter*{C_A},\ACounter{B}$
1323 & \ACmd{\Verb|\ACounter*{C_A}|},\ACmd{\Verb|\ACounter{B}|},
1324 used for indexes or counters. The \ACmd{\Verb|\ACounter|}
1325 command has an optional first argument to change the symbol
1326 (the letter): \ACmd{\Verb|\ACounter[i]{0}|}\;\givesarrow\;\ACounter[i]{0}
1327 \\[-1ex]\nopagebreak
1328 \emph{Arguments:} & \cmdargs{ACounter}{sO{I}m}\newline
1329 \cmdargex{ACounter}{\cmdsarg\cmdoarg{symbol}%
1330 \cmdmarg{id}}
1331 \\\hline
1332
1333 $\ARandom*{R_x},\ARandom{y},\ARandom'{1}$
1334 & \ACmd{\Verb|\ARandom*{R_x}|},\ACmd{\Verb|\ARandom{y}|},%
1335 \ACmd{\Verb|\ARandom'{1}|},
1336 used for random values (the $\ASmark$
1337 hints about limited useful lifetime). The \ACmd{\Verb|\ARandom|}
1338 command has an optional first argument to change the symbol
1339 (the letter): \ACmd{\Verb|\ARandom[r]{z}|}\;\givesarrow\;\ARandom[r]{z}
1340 \\[-1ex]\nopagebreak
1341 \emph{Arguments:} & \cmdargs{ARandom}{st'O{R}m}\newline
1342 \cmdargex{ARandom}{\cmdsarg\cmdtarg{'}%
1343 \cmdoarg{symbol}\cmdmarg{id}}
1344 \\\hline
1345
1346 $\ATS*{T_A},\ATS{S},\ATTL*{L},\ATTL{1}$
1347 & \ACmd{\Verb|\ATS*{T_A}|},\ACmd{\Verb|\ATS{S}|},\ACmd{\Verb|\ATTL*{L}|},%
1348 \ACmd{\Verb|\ATTL{1}|}, used for time related values, like time stamps
1349 and lifetime (time to live). Both the \ACmd{\Verb|\ATS|} and
1350 \ACmd{\Verb|\ATTL|} command have an optional first argument to change
1351 the symbol (the letter): \ACmd{\Verb|\ATS[t]{0}|}\;\givesarrow\;\ATS[t]{0},
1352 \ACmd{\Verb|\ATTL[l]{1}|}\;\givesarrow\;\ATTL[l]{1}\\[-1ex]\nopagebreak
1353 \emph{Arguments:} & \cmdargs{ATS}{sO{T}m}, \cmdargs{ATTL}{sO{L}m}\newline
1354 \cmdargex{ATS}{\cmdsarg\cmdoarg{symbol}%
1355 \cmdmarg{id}},
1356 \cmdargex{ATTL}{\cmdsarg\cmdoarg{symbol}\cmdmarg{id}}
1357 \\\hline
1358
1359 $\AStr{Hello}$
1360 & \ACmd{\Verb|\AStr{Hello}|}, used for text strings.\\[-1ex]\nopagebreak
1361 \emph{Arguments:} & \cmdargs{AStr}{m}\newline
1362 \cmdargex{AStr}{\cmdmarg{str}}
1363 \\\hline
1364
1365 $\AVar{x},\AVar{y}$
1366 & \ACmd{\Verb|\AVar{x}|},\ACmd{\Verb|\AVar{y}|}, used for variables.
1367 \\[-1ex]\nopagebreak
1368 \emph{Arguments:} & \cmdargs{AVar}{m}\newline
1369 \cmdargex{AVar}{\cmdmarg{variable}}
1370 \\\hline
1371
1372 $\APrivkey[]{},\APubkey[]{},\ASessionkey[]{},\;\ldots$
1373 & Some command markers (key type markers) are used throughout the {\Aspen}
1374 {\latex} package to specify the key type involved:
1375 \newline
1376 {\renewcommand{\arraystretch}{1}\begin{tabular}{c@{\::\:~}l}
1377 \ACmd{*}
1378 & Means no specific variant (argument is the key, not the label):
1379 \ACmd{\Verb|\AKey*{K}|} \\
1380 \ACmd{-}
1381 & Mark that it is a private key (from a public-private key pair):
1382 \ACmd{\Verb|\AKey-{A}|} \\
1383 \ACmd{+}
1384 & Mark that it is a public key (from a public-private key pair):
1385 \ACmd{\Verb|\AKey+{A}|} \\
1386 \ACmd{!}
1387 & Mark by principal instead of key (the key of):
1388 \ACmd{\Verb|\AKey!{A}|} \\
1389 \ACmd{'}
1390 & Mark that it is temporary (session key or limited lifetime):
1391 \ACmd{\Verb|\AKey'{A}|} \\
1392 \ACmd{"}
1393 & Mark that it is a key generated from the password:
1394 \ACmd{\Verb|\AKey"{P}|} \\
1395 \end{tabular}}\newline
1396 \example{\begin{tabular}{@{}lcl@{}}
1397 \ACmd{\Verb|\AKey*{K}|} & \givesarrow & $\AKey*{K}$ \\
1398 \ACmd{\Verb|\AEncrypted"{P}{\AKey-{B}}|} & \givesarrow
1399 & $\AEncrypted"{P}{\AKey-{B}}$ \\
1400 \ACmd{\Verb|\ASig-{A}{m}|} & \givesarrow & $\ASig-{A}{m}$ \\
1401 \ACmd{\Verb|\AEncrypt+{B}{m}|} & \givesarrow & $\AEncrypt+{B}{m}$ \\
1402 \ACmd{\Verb|\ASigned!{S}{m}|} & \givesarrow & $\ASigned!{S}{m}$ \\
1403 \ACmd{\Verb|\ADecrypt'{A,B}{c}|} & \givesarrow & $\ADecrypt'{A,B}{c}$
1404 \end{tabular}}\vspace*{-2.0ex}
1405 \\ \nopagebreak
1406 \emph{Arguments:} & \ACmd{\Verb|T|} (the symbol used for these
1407 optional markers in argument specifications)
1408 \\\hline
1409
1410 $\AKey*{K}$
1411 & \ACmd{\Verb|\AKey*{K}|}, used for (non-specific) encryption keys.
1412 The argument is the key itself, and not a label for the key symbol.
1413 \\[-1ex]\nopagebreak
1414 \emph{Arguments:} & \cmdargs{AKey}{Tm}\newline
1415 \cmdargex{AKey}{*\cmdmarg{key}}
1416 \\\hline
1417
1418 $\AKey{A},\ASharedkey{A,B}$
1419 & \ACmd{\Verb|\AKey{A}|},\ACmd{\Verb|\ASharedkey{A,B}|}, used for shared
1420 (secret/symmetric) keys (provided by two different {\latex} commands,
1421 where the first is a more compact version; use whatever you prefer).
1422 The \ACmd{\Verb|\ASharedkey|} command has an optional first argument
1423 to change the symbol (the letter):
1424 \ACmd{\Verb|\ASharedkey[k]{B}|}\;\givesarrow\;\ASharedkey[k]{B}
1425 \\[-1ex]\nopagebreak
1426 \emph{Arguments:} & \cmdargs{AKey}{Tm}, \cmdargs{ASharedkey}{O{K}m}\newline
1427 \cmdargex{AKey}{\cmdmarg{id}},
1428 \cmdargex{ASharedkey}{\cmdoarg{symbol}\cmdmarg{id}}
1429 \\\hline
1430
1431 $\AKey'{C,S},\ASessionkey{A,B,S}$
1432 & \ACmd{\Verb|\AKey'{C,S}|},\ACmd{\Verb|\ASessionkey{A,B,S}|}, used for
1433 session keys (provided by two different {\latex} commands, where the
1434 first is a more compact version; use whatever you prefer).
1435 The \ACmd{\Verb|\ASessionkey|} command has an optional first argument
1436 to change the symbol (the letter):
1437 \ACmd{\Verb|\ASessionkey[k]{A,B}|}\;\givesarrow\;\ASessionkey[k]{A,B}%
1438 \\[-1ex]\nopagebreak
1439 \emph{Arguments:} & \cmdargs{AKey}{Tm}, \cmdargs{ASessionkey}{O{K}m}\newline
1440 \cmdargex{AKey}{'\cmdmarg{id}},
1441 \cmdargex{ASessionkey}{\cmdoarg{symbol}\cmdmarg{id}}
1442 \\\hline
1443
1444 $\AKey+{A},\APubkey{B}$
1445 & \ACmd{\Verb|\AKey+{A}|},\ACmd{\Verb|\APubkey{B}|}, used for public keys
1446 (provided by two different {\latex} commands, where the first is a
1447 more compact version; use whatever you prefer).
1448 The \ACmd{\Verb|\APubkey|} command has an optional first argument
1449 to change the symbol (the letter):
1450 \ACmd{\Verb|\APubkey[k]{S}|}\;\givesarrow\;\APubkey[k]{S}
1451 \\[-1ex]\nopagebreak
1452 \emph{Arguments:} & \cmdargs{AKey}{Tm}, \cmdargs{APubkey}{O{K}m}\newline
1453 \cmdargex{AKey}{+\cmdmarg{id}},
1454 \cmdargex{APubkey}{\cmdoarg{symbol}\cmdmarg{id}}
1455 \\\hline
1456
1457 $\AKey-{A},\APrivkey{B}$
1458 & \ACmd{\Verb|\AKey-{A}|},\ACmd{\Verb|\APrivkey{B}|}, used for private keys
1459 (provided by two different {\latex} commands, where the first is a
1460 more compact version; use whatever you prefer).
1461 The \ACmd{\Verb|\APrivkey|} command has an optional first argument
1462 to change the symbol (the letter):
1463 \ACmd{\Verb|\APrivkey[k]{A}|}\;\givesarrow\;\APrivkey[k]{A}
1464 \\[-1ex]\nopagebreak
1465 \emph{Arguments:} & \cmdargs{AKey}{Tm}, \cmdargs{APrivkey}{O{K}m}\newline
1466 \cmdargex{AKey}{-\cmdmarg{id}},
1467 \cmdargex{APrivkey}{\cmdoarg{symbol}\cmdmarg{id}}
1468 \\\hline
1469
1470 $\AKey"{P_1},\APwkey{P_2}$
1471 & \ACmd{\Verb|\AKey"{P_1}|},\ACmd{\Verb|\APwkey{P_2}|}, used for keys
1472 generated from a password (provided by two different {\latex} commands,
1473 where the first is a more compact version; use whatever you prefer).
1474 The \ACmd{\Verb|\APwkey|} command has an optional first argument
1475 to change the symbol (the letter):
1476 \ACmd{\Verb|\APwkey[k]{P}|}\;\givesarrow\;\APwkey[k]{P}
1477 \\[-1ex]\nopagebreak
1478 \emph{Arguments:} & \cmdargs{AKey}{Tm}, \cmdargs{APwkey}{O{K}m}\newline
1479 \cmdargex{AKey}{"\cmdmarg{password}},
1480 \cmdargex{APwkey}{\cmdoarg{symbol}\cmdmarg{password}}
1481 \\\hline
1482
1483 % $\AKey!{A},\AKey*{\AName{B}}$
1484 % & \ACmd{\Verb|\AKey!{A}|},\ACmd{\Verb|\AKey*{\AName{B}}|}, used for
1485 % unspecific keys of a principal (or a group of principals), typically
1486 % in the context of \emph{``encrypted by''}, or \emph{``signed by''}.
1487 % (two different {\latex} commands, where the first is a more compact
1488 % version).
1489 % \\\hline
1490
1491 $\AName{A}$
1492 & \ACmd{\Verb|\AName{A}|}, typically used to indicate who
1493 signed (or encrypted) a message, but no specific key is given,
1494 known or relevant. If you mark a key with a \ACmd{!},
1495 the produced output is the same: \ACmd{\Verb|\AKey!{A}|}\gives\AKey!{A}
1496 \\[-1ex]\nopagebreak
1497 \emph{Arguments:} & \cmdargs{AName}{m}, \cmdargs{AKey}{Tm}\newline
1498 \cmdargex{AName}{\cmdmarg{id}},
1499 \cmdargex{AKey}{!\cmdmarg{id}}
1500 \\\hline
1501
1502 $\AGroup{M}$
1503 & \ACmd{\Verb|\AGroup{M}|}, specifies a group and is typically used
1504 as a label for a shared key shared within a group with $n$ members:
1505 \newline
1506 \example{%
1507 \mbox{\ACmd{\Verb|\AKey{\AGroup{M}}|}}\gives\AKey{\AGroup{M}}}%
1508 \vspace*{-2.2ex}\\
1509 %$\AGroup[0][s]{M}$
1510 & \ACmd{\Verb|\AGroup[0][s]{M}|}, used when th group member indexes are
1511 non-standard:
1512 \newline
1513 \example{%
1514 \mbox{\ACmd{\Verb|\AKey{\AGroup[0][s]{M}}|}}\gives
1515 \AKey{\AGroup[0][s]{M}}}\vspace*{-2.2ex}\\
1516 & \ACmd{\Verb|\AGroup*{M}|}, typically used in a text when referring
1517 to a group (with $n$ members):
1518 \newline
1519 \example{%
1520 \mbox{\ACmd{\Verb|\AKey{\AGroup*{M}}|}}\gives
1521 \AKey{\AGroup*{M}}}\vspace*{-2.2ex}\\
1522 %$\AGroup*[0][s]{M}$
1523 & \ACmd{\Verb|\AGroup*[0][s]{M}|}, used when group member indexes are
1524 non-standard:\newline
1525 \example{%
1526 \mbox{\ACmd{\Verb|\AKey{\AGroup*[0][s]{M}}|}}\gives
1527 \AKey{\AGroup*[0][s]{M}}}\vspace*{-2.0ex}\\ \nopagebreak
1528 \emph{Arguments:} & \cmdargs{AGroup}{sO{1}O{n}m}\newline
1529 \cmdargex{AGroup}{%
1530 {\cmdsarg}\cmdoarg{first}\cmdoarg{last}\cmdmarg{id}}
1531 \\\hline
1532
1533 $\ASval{m},\AMsg{\APri{A},\APri{B}}$
1534 & \ACmd{\Verb|\ASval{m}|},\ACmd{\Verb|\AMsg{\APri{A},\APri{B}}|},
1535 used for a structured value or message (a message can be seen
1536 as structured value).\\[-1ex] \nopagebreak
1537 \emph{Arguments:} & \cmdargs{ASval}{Bm}, \cmdargs{AMsg}{Bm}\newline
1538 \cmdargex{ASval}{\cmdoarg{size}\cmdmarg{value}},
1539 \cmdargex{AMsg}{\cmdoarg{size}\cmdmarg{message}}
1540 \\\hline
1541
1542 $\ASval[big]{m}$
1543 & \ACmd{\Verb|\ASval[big]{m}|}, or \ACmd{\Verb|\AMsg[big]{m}|},
1544 where first optional size argument can be
1545 \ACmd{big}, \ACmd{Big}, \ACmd{bigg}, or \ACmd{Bigg} for
1546 increased size of parenthesis (typically used with nested
1547 structured values and/or functions):
1548 \newline
1549 \example{%
1550 \mbox{\ACmd{\Verb|\ASval{x}|}}\gives\ASval{x} \\
1551 \mbox{\ACmd{\Verb|\ASval[big]{\ASval{x}}|}}\gives
1552 \ASval[big]{\ASval{x}} \\
1553 \mbox{\ACmd{\Verb|\ASval[Big]{\ASval[big]{\ASval{x}}}|}}\gives
1554 \ASval[Big]{\ASval[big]{\ASval{x}}} \\
1555 \mbox{\ACmd{\Verb|\ASval[bigg]{\ASval[Big]{\ASval[big]{\ASval{x}}}}|}}%
1556 \gives\ASval[bigg]{\ASval[Big]{\ASval[big]{\ASval{x}}}}%
1557 }\vspace*{-2.2ex}
1558 \\ &
1559 We can even use bigger size specifiers: \ACmd{big}, \ACmd{Big},
1560 \ACmd{bigg}, \ACmd{Bigg}, \ACmd{biggg}, \ACmd{Biggg},
1561 \ACmd{bigggg}, \ACmd{Bigggg}, \ACmd{biggggg}, and
1562 \ACmd{Biggggg}:
1563 \newline
1564 \example{%
1565 \ASval[Biggggg]{\ASval[biggggg]{\ASval[Bigggg]{\ASval[bigggg]{%
1566 \ASval[Biggg]{\ASval[biggg]{\ASval[Bigg]{\ASval[bigg]{\ASval[Big]{%
1567 \ASval[big]{\ASval{x}}}}}}}}}}}}\vspace*{-2.2ex}
1568 \\ &
1569 The optional size argument applies for all {\Aspen} {\latex} commands
1570 that produces a pair of parenthesis, both ordinary parenthesis and
1571 curly brackets. A few examples (see below for more details on
1572 these commands):\newline
1573 \example{\begin{tabular}{@{}lcl@{}}%
1574 \mbox{\ACmd{\Verb|\ATval[big]{Type}{m}|}}
1575 & \givesarrow & \ATval[big]{Type}{m} \\
1576 \mbox{\ACmd{\Verb|\ASend[big]{A}{B}{m}|}}
1577 & \givesarrow & \ASend[big]{A}{B}{m} \\
1578 \mbox{\ACmd{\Verb|\AFunc[big]{Func}{x,y}|}}
1579 & \givesarrow & \AFunc[big]{Func}{x,y} \\
1580 \mbox{\ACmd{\Verb|\AEncrypted[big]{A,B}{m}|}}
1581 & \givesarrow & \AEncrypted[big]{A,B}{m}
1582 \end{tabular}}\vspace*{-2.0ex}\\ \nopagebreak
1583 \emph{Arguments:} & \cmdargs{ASval}{Bm}, \cmdargs{AMsg}{Bm}\newline
1584 \cmdargex{ASval}{\cmdoarg{size}\cmdmarg{value}},
1585 \cmdargex{AMsg}{\cmdoarg{size}\cmdmarg{message}}
1586 \\\hline
1587
1588 ${}_{\AVal{\ldots}}$
1589 & \ACmd{\Verb|_{…}|},
1590 where the embellishment is used to provide more details or information
1591 about a structured value or a function. A few examples where the
1592 embellishments are
1593 \AVal{\textit{MD5}}, \AVal{\textit{RSA}}, \AVal{\textit{AES}},
1594 \AVal{\textit{DSA}}, and \AVal{\textit{SHA-2}}:\newline
1595 \example{\begin{tabular}{@{}lcl@{}}
1596 \mbox{\ACmd{\Verb|\AChash_{MD5}{m}|}} & \givesarrow & $\AChash_{MD5}{m}$ \\
1597 \mbox{\ACmd{\Verb|\AEncrypt+_{RSA}{B}{m}|}} & \givesarrow
1598 & $\AEncrypt+_{RSA}{B}{m}$ \\
1599 \mbox{\ACmd{\Verb|\ADecrypt'_{AES}{A,B}{c}|}} & \givesarrow
1600 & $\ADecrypt'_{AES}{A,B}{c}$ \\
1601 \mbox{\ACmd{\Verb|\ASig-_{DSA}{S}{m}|}} & \givesarrow
1602 & $\ASig-_{DSA}{S}{m}$ \\
1603 \mbox{\ACmd{\Verb|\AHmac_{SHA-2}{A}{m}|}} & \givesarrow
1604 & $\AHmac_{SHA-2}{A}{m}$
1605 \end{tabular}}\vspace*{-2.0ex}
1606 \\ \nopagebreak
1607 \emph{Arguments:} & \ACmd{\Verb|i|} (the symbol used for such
1608 optional embellishment in argument specifications)
1609 \\\hline
1610
1611 $\ATval{Type}{m}$
1612 & \ACmd{\Verb|\ATval{Type}{m}|}, used for a typed structured value
1613 where the first argument is the type.
1614 % \\\hline
1615 % $\ATval*{Type}{\ASval{m}}$
1616 % &
1617 The \ACmd{\Verb|\ATval*|} variant is used for a typed structured
1618 value where the first argument is the type, but the value
1619 is not wrapped with curly brackets. This is typically used when
1620 the value is already wrapped as a structured value (e.g., encrypted
1621 or signed data). This is an example with a Kerberos Authenticator
1622 as a typed structured value:\newline
1623 \example{\begin{tabular}{@{}c@{}}%
1624 \mbox{\ACmd{%
1625 \Verb|\ATval*{KA}{\AEncrypted{S,C}{\APri{C},\textit{Addr}_C,\ATS{t}}}|}} \\
1626 \givesarrow\quad
1627 \ATval*{KA}{\AEncrypted{S,C}{\APri{C},\textit{Addr}_C,\ATS{t}}}
1628 \end{tabular}}
1629 \vspace*{-2.2ex}\\ &
1630 The embellishment (\Verb|_{RSA}| in the example below) can be used
1631 to give more details about the typed structured value:\newline
1632 \example{\begin{tabular}{@{}c@{}}%
1633 \mbox{\ACmd{%
1634 \Verb|\ATval*{KA}_{RSA}{\AEncrypted{S,C}{\APri{C},\textit{Addr}_C,\ATS{t}}}|}}\\
1635 \givesarrow\quad
1636 \ATval*{KA}_{RSA}{\AEncrypted{S,C}{\APri{C},\textit{Addr}_C,\ATS{t}}}
1637 \end{tabular}}
1638 \vspace*{-2.0ex}\\ \nopagebreak
1639 \emph{Arguments:} & \cmdargs{ATval}{sBmim}\newline
1640 \cmdargex{ATval}{{\cmdsarg}\cmdoarg{size}%
1641 \cmdmarg{type}{\cmdearg}\cmdmarg{value}}
1642 \\\hline
1643
1644 % \ATval[big]{Type}{m}
1645 % & \ACmd{\Verb|\ATval[big]{Type}{m}|},
1646 % where the optional argument of \ACmd{\Verb|\ATval|} can be
1647 % \ACmd{big}, \ACmd{Big}, \ACmd{bigg}, or \ACmd{Bigg} for
1648 % increased size of parenthesis (see examples with structured
1649 % values above).
1650 % \\\hline
1651
1652 $\ASend{A}{B}{m}$
1653 & \ACmd{\Verb|\ASend{A}{B}{m}|}, used to specify that a message \ASval{m}
1654 is sent from \APri{A} to \APri{B}.
1655 % \\\hline
1656 % \ASend[big]{A}{B}{m}
1657 % & \ACmd{\Verb|\ASend[big]{A}{B}{m}|}, where the optional
1658 % argument of \ACmd{\Verb|\ASend|} can be
1659 % \ACmd{big}, \ACmd{Big}, \ACmd{bigg}, or \ACmd{Bigg} for increased
1660 % size of parenthesis (see examples with structured values above).
1661 % \\\hline
1662 % \ASend*{A}{B}{\AVar{\extxt{x}}}
1663 % &
1664 The \ACmd{\Verb|\ASend*|} variant is used to specify that
1665 the message is not wrapped as a structured value or message.
1666 This is typically used when what-is-sent is already wrapped as a
1667 structured value (e.g.,~encrypted or signed data):
1668 \newline
1669 \example{%
1670 \mbox{\ACmd{\Verb|\ASend*{A}{B}{\AEncrypted+{B}{m}}|}}\gives
1671 \ASend*{A}{B}{\AEncrypted+{B}{m}}\\
1672 \mbox{\ACmd{\Verb|\ASend*{A}{B}{\AEncrypted+[big]{B}{\AChash{m}}}|}}%
1673 \gives\ASend*{A}{B}{\AEncrypted+[big]{B}{\AChash{m}}}}
1674 \vspace*{-2.0ex}\\ \nopagebreak
1675 \emph{Arguments:} & \cmdargs{ASend}{sBmmm}\newline
1676 \cmdargex{ASend}{{\cmdsarg}\cmdoarg{size}%
1677 \cmdmarg{sender}\cmdmarg{receiver}\cmdmarg{message}}
1678 \\\hline
1679
1680 $\AFunc{Func}{x,y}$
1681 & \ACmd{\Verb|\AFunc{Func}{x,y}|}, used for any functions.
1682 %\\\hline
1683 % \AFunc[big]{Func}{x,y}
1684 % & \ACmd{\Verb|\AFunc[big]{Func}{x,y}|}, where first optional argument
1685 % can be \ACmd{big}, \ACmd{Big}, \ACmd{bigg}, or \ACmd{Bigg}
1686 % for increased size of parenthesis (see examples with structured
1687 % values above).
1688 % \\\hline
1689 %$\AFunc{Func}{x,y}[z]$
1690 % &
1691 An optional last argument is used if a return value of
1692 the function is given:\newline
1693 \example{%
1694 \mbox{\ACmd{\Verb|\AFunc{Func}{x,y}[z]|}}\gives
1695 \AFunc{Func}{x,y}[z]}
1696 \vspace*{-2.0ex}\\ \nopagebreak
1697 \emph{Arguments:} & \cmdargs{AFunc}{Bmimo}\newline
1698 \cmdargex{AFunc}{\cmdoarg{size}\cmdmarg{name}%
1699 {\cmdearg}\cmdmarg{arguments}\cmdoarg{returns}}
1700 \\\hline
1701
1702 % \AFunc[big]{Func}{x,y}[z]
1703 % & \ACmd{\Verb|\AFunc[big]{Func}{x,y}[z]|}, used when the
1704 % return value of the function is given, and the first optional
1705 % argument is \ACmd{big}, \ACmd{Big}, \ACmd{bigg}, or
1706 % \ACmd{Bigg} for increased size of parenthesis (see examples with
1707 % structured values above).
1708 % \\\hline
1709
1710 $\AProc{Proc}[text]$
1711 & \ACmd{\Verb|\AProc{Proc}[text]|}, used for any procedures. The optional
1712 last argument is a comment (describing why this procedure is called).
1713 \\[-1ex]\nopagebreak
1714 \emph{Arguments:} & \cmdargs{AProc}{P{white}mio}
1715 %\cmdargs{AProc}{mio}
1716 \newline
1717 \cmdargex{AProc}{\cmdparg{bg-color}%
1718 \cmdmarg{name}{\cmdearg}\cmdoarg{comment}}
1719 \\\hline
1720
1721 $\AAbort[text]$
1722 & \ACmd{\Verb|\AAbort[text]|}, used for the abort procedure. The optional
1723 argument is a comment (describing why the protocol is aborted).
1724 \\[-1ex]\nopagebreak
1725 \emph{Arguments:} & \cmdargs{AProc}{P{white}io}
1726 %\cmdargs{AAbort}{io}
1727 \newline
1728 \cmdargex{AAbort}{\cmdparg{bg-color}%
1729 {\cmdearg}\cmdoarg{comment}}
1730 \\\hline
1731
1732 $\AEncrypted{A,B}{m}$
1733 & \ACmd{\Verb|\AEncrypted{A,B}{m}|}, where the message is encrypted
1734 with an shared secret
1735 encryption key (in this case, the shared key \AKey{A,B} of \APri{A}
1736 and \APri{B}). The other options (with markers) are:
1737 % \ACmd{*}~indicates that the message is encrypted with given key
1738 % (the first non-optional argument is the key, and not the label of the
1739 % key).
1740 % \ACmd{+}~indicates that the message is encrypted with a public
1741 % key. \ACmd{-}~indicates that the message is
1742 % encrypted with a private key (sometimes used in digital
1743 % signatures). \ACmd{!}~indicates that the message is encrypted
1744 % by a principal (not specifying the specific encryption key). All the
1745 % different options of \ACmd{\Verb|\AEncrypted|} demonstrated:
1746 \newline
1747 \example{%
1748 \begin{tabular}{@{}lcl@{}}
1749 \mbox{\ACmd{\Verb|\AEncrypted*{K}{m}|}} & \givesarrow
1750 & \AEncrypted*{K}{m} \\
1751 %\mbox{\ACmd{\Verb|\AEncrypted{A,B}{m}|}} & \givesarrow
1752 %& \AEncrypted{A,B}{m} \\
1753 \mbox{\ACmd{\Verb|\AEncrypted+{A}{m}|}} & \givesarrow
1754 & \AEncrypted+{A}{m} \\
1755 \mbox{\ACmd{\Verb|\AEncrypted-{A}{m}|}} & \givesarrow
1756 & \AEncrypted-{A}{m} \\
1757 \mbox{\ACmd{\Verb|\AEncrypted!{A}{m}|}} & \givesarrow
1758 & \AEncrypted!{A}{m} \\
1759 \mbox{\ACmd{\Verb|\AEncrypted'{A,B}{m}|}} & \givesarrow
1760 & \AEncrypted'{A,B}{m} \\
1761 \mbox{\ACmd{\Verb|\AEncrypted"{P}{m}|}} & \givesarrow
1762 & \AEncrypted"{P}{m}
1763 \end{tabular}}\vspace*{-2.0ex}\\ \nopagebreak
1764 \emph{Arguments:} & \cmdargs{AEncrypted}{TBimm}\newline
1765 \cmdargex{AEncrypted}{{\cmdkarg}\cmdoarg{size}%
1766 {\cmdearg}\cmdmarg{key}\cmdmarg{plain}}
1767 \\\hline
1768
1769 % \AEncrypted[big]{A,B}{m}
1770 % & \ACmd{\Verb|\AEncrypted[big]{A,B}{m}|}, where the optional
1771 % argument can be \ACmd{big}, \ACmd{Big}, \ACmd{bigg}, or
1772 % \ACmd{Bigg} for increased size of parenthesis (see examples with
1773 % structured values above). The optional size argument can be used for all
1774 % different options of \ACmd{\AEncrypted} (see previous).
1775 % Typically used with structured values:
1776 % \newline
1777 % \example{%
1778 % \mbox{\ACmd{\Verb|\AEncrypted+[big]{B}{\ASigned-{A}{m}}|}}\gives
1779 % \AEncrypted+[big]{B}{\ASigned-{A}{m}}}
1780 % \\\hline
1781
1782 $\AEncrypt{A,B}{m}$
1783 & \ACmd{\Verb|\AEncrypt{A,B}{m}|}, where the value
1784 \AVal{m} is encrypted with a secret shared encryption key (in
1785 this case, a shared key of \APri{A} and \APri{B}). Other options
1786 are \ACmd{*}, \ACmd{+}, \ACmd{-}, \ACmd{!}, \ACmd{'}
1787 and \ACmd{"} (see above for explanation). Since \ACmd{\Verb|\AEncrypt|}
1788 is a function, we can include a return value as an optional last
1789 argument (and it supports magic return making straightforward to
1790 include the return value):
1791 \newline
1792 \example{%
1793 \mbox{\ACmd{\Verb|\AEncrypt+{B}{m}[\AEncrypted+{B}{m}]|}}\gives
1794 \AEncrypt+{B}{m}[\AEncrypted+{B}{m}] \\
1795 \mbox{\ACmd{\Verb|\AEncrypt+{B}{m}[*]|}}\gives
1796 \AEncrypt+{B}{m}[*]}\vspace*{-2.0ex}\\ \nopagebreak
1797 \emph{Arguments:} & \cmdargs{AEncrypt}{TBimmx}\newline
1798 \cmdargex{AEncrypt}{{\cmdkarg}\cmdoarg{size}%
1799 {\cmdearg}\cmdmarg{key}\cmdmarg{plain}%
1800 \cmdoarg{returns}}
1801 \\\hline
1802
1803 % \AEncrypt[big]{A,B}{m}
1804 % & \ACmd{\Verb|\AEncrypt[big]{A,B}{m}|}, where the first optional argument
1805 % can be \ACmd{big}, \ACmd{Big}, \ACmd{bigg}, or \ACmd{Bigg}
1806 % for increased size of parenthesis (see examples with structured values
1807 % above). Typically used with nested structured values:
1808 % \newline
1809 % \example{%
1810 % \mbox{\ACmd{\Verb|\AEncrypt+[big]{B}{\ASigned-{A}{m}}|}}\gives
1811 % \AEncrypt+[big]{B}{\ASigned-{A}{m}}}
1812 % \\\hline
1813
1814 $\ADecrypt{A,B}{\AVar{c}}$
1815 & \ACmd{\Verb|\ADecrypt{A,B}{\AVar{c}}|}, where the cipher text
1816 \AVar{c} is decrypted with an secret shared encryption key
1817 (in this case, a shared key between \APri{A} and \APri{B}). Other
1818 options are \ACmd{*}, \ACmd{+}, \ACmd{-}, \ACmd{!}
1819 \ACmd{'}, and \ACmd{"} (see above for explanation). Since
1820 \ACmd{\Verb|\ADecrypt|} is a function, we can include a return value
1821 as an optional last argument:
1822 \newline
1823 \example{%
1824 \mbox{\ACmd{\Verb|\ADecrypt-{B}{\AEncrypted+{B}{m}}[m]|}}\gives
1825 \ADecrypt-{B}{\AEncrypted+{B}{m}}[m]}\vspace*{-2.0ex}\\ \nopagebreak
1826 \emph{Arguments:} & \cmdargs{ADecrypt}{TBimmo}\newline
1827 \cmdargex{ADecrypt}{{\cmdkarg}\cmdoarg{size}%
1828 {\cmdearg}\cmdmarg{key}\cmdmarg{cipher}%
1829 \cmdoarg{returns}}
1830 \\\hline
1831
1832 % \ADecrypt[big]{A,B}{\AVar{c}}
1833 % & \ACmd{\Verb|\ADecrypt[big]{A,B}{\AVar{c}}|}, where the first optional
1834 % argument can be \ACmd{big}, \ACmd{Big}, \ACmd{bigg}, or \ACmd{Bigg}
1835 % for increased size of parenthesis (see examples with structured values
1836 % above). Typically used with nested structured values:
1837 % \newline
1838 % \example{%
1839 % \mbox{\ACmd{\Verb|\ADecrypt-[big]{B}{\AEncrypted+{B}{m}}[m]|}}%
1840 % \gives \ADecrypt-[big]{B}{\AEncrypted+{B}{m}}[m]}
1841 % \\\hline
1842
1843 $\AChash{m}$
1844 & \ACmd{\Verb|\AChash{m}|}, used for a cryptographic hash value of
1845 \AVal{m}.\\[-1ex]\nopagebreak
1846 \emph{Arguments:} & \cmdargs{AChash}{Bim}\newline
1847 \cmdargex{AChash}{\cmdoarg{size}{\cmdearg}%
1848 \cmdmarg{value}}
1849 \\\hline
1850
1851 % \AChash[big]{m}
1852 % & \ACmd{\Verb|\AChash[big]{m}|}, where the first optional argument
1853 % can be \ACmd{big}, \ACmd{Big}, \ACmd{bigg}, or \ACmd{Bigg}
1854 % for increased size of parenthesis (see examples with structured values
1855 % above).
1856 % \\\hline
1857
1858 $\AMac{A}{m}$
1859 & \ACmd{\Verb|\AMac{A}{m}|}, used for message authentication code
1860 of \AVal{m} with \AKey{A}.\\[-1ex]\nopagebreak
1861 \emph{Arguments:} & \cmdargs{AMac}{TBimm}\newline
1862 \cmdargex{AMac}{{\cmdkarg}\cmdoarg{size}{\cmdearg}%
1863 \cmdmarg{key}\cmdmarg{value}}
1864 \\\hline
1865
1866 $\ACmac{A}{m}$
1867 & \ACmd{\Verb|\ACmac{A}{m}|}, used for cipher-based message
1868 authentication code of \AVal{m} with \AKey{A}.\\[-1ex]\nopagebreak
1869 \emph{Arguments:} & \cmdargs{ACmac}{TBimm}\newline
1870 \cmdargex{ACmac}{{\cmdkarg}\cmdoarg{size}{\cmdearg}%
1871 \cmdmarg{key}\cmdmarg{value}}
1872 \\\hline
1873
1874 $\AHmac{A}{m}$
1875 & \ACmd{\Verb|\AHmac{A}{m}|}, used for HMAC message
1876 authentication code of \AVal{m} with \AKey{A}.\\[-1ex]\nopagebreak
1877 \emph{Arguments:} & \cmdargs{AHmac}{TBimm}\newline
1878 \cmdargex{AHmac}{{\cmdkarg}\cmdoarg{size}{\cmdearg}%
1879 \cmdmarg{key}\cmdmarg{value}}
1880 \\\hline
1881
1882 $\AChashf{m}$
1883 & \ACmd{\Verb|\AChashf{m}|}, used for a cryptographic hash value
1884 function producing the cryptographic hash value of \AVal{m}.
1885 Since \ACmd{\Verb|\AChashf|} is a function, we
1886 can include a return value as an optional last argument:
1887 \newline
1888 \example{\mbox{\ACmd{\Verb|\AChashf{m}[*]|}}\gives
1889 \AChashf{m}[*]}\vspace*{-2.0ex}\\ \nopagebreak
1890 \emph{Arguments:} & \cmdargs{AChashf}{Bimo}\newline
1891 \cmdargex{AChasf}{\cmdoarg{size}{\cmdearg}%
1892 \cmdmarg{value}\cmdoarg{returns}}
1893 \\\hline
1894
1895 % \AChashf[big]{m}
1896 % & \ACmd{\Verb|\AChashf[big]{m}|}, where the first optional argument
1897 % can be \ACmd{big}, \ACmd{Big}, \ACmd{bigg}, or \ACmd{Bigg}
1898 % for increased size of parenthesis (see examples with structured values
1899 % above).
1900 % \\\hline
1901
1902 $\AMacf{A}{m}$
1903 & \ACmd{\Verb|\AMacf{A}{m}|}, used for a message authentication code
1904 function with the arguments \AKey{A} and \AVal{m}.
1905 Since \ACmd{\Verb|\AMacf|} is a function, we
1906 can include a return value as an optional last argument:
1907 \newline
1908 \example{\mbox{\ACmd{\Verb|\AMacf{A}{m}[*]|}}\gives
1909 \AMacf{A}{m}[*]}\vspace*{-2.0ex}\\ \nopagebreak
1910 \emph{Arguments:} & \cmdargs{AMacf}{TBimmo}\newline
1911 \cmdargex{AMacf}{{\cmdkarg}\cmdoarg{size}{\cmdearg}%
1912 \cmdmarg{key}\cmdmarg{value}\cmdoarg{returns}}
1913 \\\hline
1914
1915 $\ACmacf{A}{m}$
1916 & \ACmd{\Verb|\ACmacf{A}{m}|}, used for a cipher-based message
1917 authentication code with the arguments \AKey{A} and \AVal{m}.
1918 Since \ACmd{\Verb|\ACmacf|} is a function, we
1919 can include a return value as an optional last argument:
1920 \newline
1921 \example{\mbox{\ACmd{\Verb|\ACmacf{A}{m}[*]|}}\gives
1922 \ACmacf{A}{m}[*]}\vspace*{-2.0ex}\\ \nopagebreak
1923 \emph{Arguments:} & \cmdargs{ACmacf}{TBimmo}\newline
1924 \cmdargex{ACmacf}{{\cmdkarg}\cmdoarg{size}{\cmdearg}%
1925 \cmdmarg{key}\cmdmarg{value}\cmdoarg{returns}}
1926 \\\hline
1927
1928 $\AHmacf{A}{m}$
1929 & \ACmd{\Verb|\AHmacf{A}{m}|}, used for a HMAC message
1930 authentication code with the arguments \AKey{A} and \AVal{m}.
1931 Since \ACmd{\Verb|\AHmacf|} is a function, we
1932 can include a return value as an optional last argument:
1933 \newline
1934 \example{\mbox{\ACmd{\Verb|\AHmacf{A}{m}[*]|}}\gives
1935 \AHmacf{A}{m}[*]}\vspace*{-2.0ex}\\ \nopagebreak
1936 \emph{Arguments:} & \cmdargs{AHmacf}{TBimmo}\newline
1937 \cmdargex{AHmacf}{{\cmdkarg}\cmdoarg{size}{\cmdearg}%
1938 \cmdmarg{key}\cmdmarg{value}\cmdoarg{returns}}
1939 \\\hline
1940
1941 $\ASig-{A}{m}$
1942 & \ACmd{\Verb|\ASig-{A}{m}|}, used for the signature of \APri{A}
1943 on \AVal{m}, where the \ACmd{-} says that the signature is signed
1944 with a private key (in this case, the private key of \APri{A}).
1945 The other key type markers can also be used with this command.
1946 % Other options are no markers,
1947 % \ACmd{*}, \ACmd{+} (rarely used) and~\ACmd{!}:
1948 % \newline
1949 % \example{%
1950 % \begin{array}{lcl@{\quad}l}
1951 % \mbox{\ACmd{\Verb|\ASig{A,B}{m}|}} & \givesarrow
1952 % & \ASig{A,B}{m}
1953 % & \mbox{Signature from shared key \AKey{A,B}} \\
1954 % \mbox{\ACmd{\Verb|\ASig*{K}{m}|}} & \givesarrow
1955 % & \ASig*{K}{m}
1956 % & \mbox{Signature from specific key \AKey*{K}} \\
1957 % \mbox{\ACmd{\Verb|\ASig+{B}{m}|}} & \givesarrow
1958 % & \ASig+{A}{m}
1959 % & \mbox{Signature from public key \AKey+{A}} \\
1960 % \mbox{\ACmd{\Verb|\ASig!{A}{m}|}} & \givesarrow
1961 % & \ASig!{A}{m}
1962 % & \mbox{Signature signed by \APri{A}} \\
1963 % \mbox{\ACmd{\Verb|\ASig!{A,B}{m}|}} & \givesarrow
1964 % & \ASig!{A,B}{m}
1965 % & \mbox{Signature based on a shared secret}
1966 % \end{array}}
1967 \\[-1ex]\nopagebreak
1968 \emph{Arguments:} & \cmdargs{ASig}{TBimm}\newline
1969 \cmdargex{ASig}{{\cmdkarg}\cmdoarg{size}{\cmdearg}%
1970 \cmdmarg{key}\cmdmarg{value}}
1971 \\\hline
1972
1973 $\ASigf-{A}{m}$
1974 & \ACmd{\Verb|\ASigf-{A}{m}|}, used to create a signature of \APri{A}
1975 on \AVal{m}, where the \Verb|-| says that the signature is signed with
1976 a private key (in this case, the private key of \APri{A}).
1977 The other key type markers can also be used with this command.
1978 Since \ACmd{\Verb|\ASigf|}
1979 is a function, we can include a return value as an optional last
1980 argument (and it supports magic return making straightforward to
1981 include the return value).
1982 \\[-1ex]\nopagebreak
1983 \emph{Arguments:} & \cmdargs{ASigf}{TBimmx}\newline
1984 \cmdargex{ASigf}{{\cmdkarg}\cmdoarg{size}{\cmdearg}%
1985 \cmdmarg{key}\cmdmarg{value}\cmdoarg{returns}}
1986 \\\hline
1987
1988 $\ASigned-{A}{m}$
1989 & \ACmd{\Verb|\ASigned-{A}{m}|}, used for \AVal{m} signed,
1990 where the \ACmd{-}
1991 says that the signature is signed with a private key (in this
1992 case, the private key of \APri{A}).
1993 The other key type markers can also be used with this command.
1994 % Other, often used, options are
1995 % no marker, \ACmd{*}, \ACmd{+} (rarely used) and
1996 % \ACmd{!}:
1997 % \newline
1998 % \example{%
1999 % \begin{array}{lcl@{\quad}l}
2000 % \mbox{\ACmd{\Verb|\ASigned{A,B}{m}|}} & \givesarrow
2001 % & \ASigned{A,B}{m}
2002 % & \mbox{\AVal{m} signed with shared key \AKey{A,B}} \\
2003 % \mbox{\ACmd{\Verb|\ASigned*{K}{m}|}} & \givesarrow
2004 % & \ASigned*{K}{m}
2005 % & \mbox{\AVal{m} signed with specific key \AKey*{K}} \\
2006 % \mbox{\ACmd{\Verb|\ASigned+{A}{m}|}} & \givesarrow
2007 % & \ASigned+{A}{m}
2008 % & \mbox{\AVal{m} signed with public key \AKey+{A}} \\
2009 % \mbox{\ACmd{\Verb|\ASigned!{A}{m}|}} & \givesarrow
2010 % & \ASigned!{A}{m}
2011 % & \mbox{\AVal{m} signed by \APri{A}} \\
2012 % \mbox{\ACmd{\Verb|\ASigned!{A,B}{m}|}} & \givesarrow
2013 % & \ASigned!{A,B}{m}
2014 % & \mbox{\AVal{m} signed with a shared secret}
2015 % \end{array}}
2016 \\[-1ex]\nopagebreak
2017 \emph{Arguments:} & \cmdargs{ASigned}{TBimm}\newline
2018 \cmdargex{ASigned}{{\cmdkarg}\cmdoarg{size}{\cmdearg}%
2019 \cmdmarg{key}\cmdmarg{value}}
2020 \\\hline
2021
2022 $\ASign-{A}{m}$
2023 & \ACmd{\Verb|\ASign-{A}{m}|}, used to sign \AVal{m},
2024 where the \ACmd{-}
2025 says that the signature is signed with a private key (in this
2026 case, the private key of \APri{A}).
2027 The other key type markers can also be used with this command.
2028 Since \ACmd{\Verb|\ASign|}
2029 is a function, we can include a return value as an optional last
2030 argument (and it supports magic return making straightforward to
2031 include the return value).
2032 \\[-1ex]\nopagebreak
2033 \emph{Arguments:} & \cmdargs{ASign}{TBimmx}\newline
2034 \cmdargex{ASign}{{\cmdkarg}\cmdoarg{size}{\cmdearg}%
2035 \cmdmarg{key}\cmdmarg{value}\cmdoarg{returns}}
2036 \\\hline
2037
2038 $\APwkeyf{P}(s)$
2039 & \ACmd{\Verb|\APwkeyf{P}(s)|}, used to create a secret key from a
2040 password \AVal{P}. Optionally, a salt value \AVal{s} can be provided
2041 Since \ACmd{\Verb|\APwkeyf|} is a function, we can include a return
2042 value as an optional last argument (and it supports magic return making
2043 straightforward to include the return value): \newline
2044 \example{%
2045 \mbox{\ACmd{\Verb|\APwkeyf{P_1}(s)[*]|}}\gives\APwkeyf{P_1}(s)[*]\\
2046 \mbox{\ACmd{\Verb|\APwkeyf{P_2}[x]|}}\gives
2047 \APwkeyf{P_2}[x]}\vspace*{-2.0ex}\\
2048 \nopagebreak
2049 \emph{Arguments:} & \cmdargs{APwkeyf}{sBimpx}\newline
2050 \cmdargex{APwkeyf}{{\cmdsarg}\cmdoarg{size}{\cmdearg}%
2051 \cmdmarg{password}\cmdparg{salt}\cmdoarg{returns}}
2052 \\\hline
2053
2054 $\ADhpubkeyf{A}(p)$
2055 & \ACmd{\Verb|\ADhpubkeyf{A}(p)|}, used to create a public key \AKey+{A}
2056 (a key share) from a private key \AKey-{A} and the optional public
2057 parameters \AVal{p}, typically used in a Diffie–Hellman key exchange
2058 protocol~\cite{diffie1976a}.
2059 \newline
2060 \example{%
2061 \mbox{\ACmd{\Verb|\ADhpubkeyf{A}(p)[A]|}}\gives\ADhpubkeyf{A}(p)[A] \\
2062 \mbox{\ACmd{\Verb|\ADhpubkeyf*{x}[y]|}}\gives\ADhpubkeyf*{x}[y]}%
2063 \vspace*{-2.0ex}\\
2064 \nopagebreak
2065 \emph{Arguments:} & \cmdargs{ADhpubkeyf}{sBimpo}\newline
2066 \cmdargex{ADhpubkeyf}{{\cmdsarg}\cmdoarg{size}%
2067 {\cmdearg}\cmdmarg{key}\cmdparg{parms}\cmdoarg{returns}}
2068 \\\hline
2069
2070 $\ADhkeyf{A}{B}(p)$
2071 & \ACmd{\Verb|\ADhkeyf{A}{B}(p)|}, used to combine a private key \AKey-{A}
2072 with public key \AKey+{B} and the optional public parameters
2073 \AVal{p} to generate a new secret (shared) key \AKey{A,B}, typically
2074 used in a Diffie–Hellman key exchange protocol~\cite{diffie1976a}.
2075 \newline
2076 \example{%
2077 \mbox{\ACmd{\Verb|\ADhkeyf{A}{B}(p)[A,B]|}}\gives\ADhkeyf{A}{B}(p)[A,B] \\
2078 \mbox{\ACmd{\Verb|\ADhkeyf*{x}{y}[z]|}}\gives\ADhkeyf*{x}{y}[z]}%
2079 \vspace*{-2.0ex}\\
2080 \nopagebreak
2081 \emph{Arguments:} & \cmdargs{ADhkeyf}{sBimmpo}\newline
2082 \cmdargex{ADhkeyf}{{\cmdsarg}\cmdoarg{size}{\cmdearg}%
2083 \cmdmarg{key}\cmdmarg{key}\cmdparg{parms}%
2084 \cmdoarg{returns}}
2085 \\\hline
2086
2087 $\AVerify+{A}{\AVar{s}}$
2088 & \ACmd{\Verb|\AVerify+{A}{\AVar{s}}|}, used to verify the signed data
2089 \AVar{s}, where the \ACmd{+} says that the signed data is
2090 verified towards the public key of \APri{A}.
2091 The other key type markers can also be used with this command.
2092 \\[-1ex]\nopagebreak
2093 \emph{Arguments:} & \cmdargs{AVerify}{TBimmo}\newline
2094 \cmdargex{AVerify}{{\cmdkarg}\cmdoarg{size}{\cmdearg}%
2095 \cmdmarg{key}\cmdmarg{value}\cmdoarg{returns}}
2096 \\\hline
2097
2098 $\ACertificate!{C}{\APri{B},\AKey+{B}}$
2099 & \ACmd{\Verb|\ACertificate!{C}{\APri{B},\AKey+{B}}|}, used for
2100 a certificate binding the public key \AKey+{B} (public key of \APri{B})
2101 to the principal \APri{B}, where \ACmd{!}
2102 says that the signature is signed by the certificate authority \APri{C}.
2103 The other key type markers can also be used with this command.
2104 \\[-1ex]\nopagebreak
2105 \emph{Arguments:} & \cmdargs{ACertificate}{TBimm}\newline
2106 \cmdargex{ACertificate}{{\cmdkarg}\cmdoarg{size}%
2107 {\cmdearg}\cmdmarg{key}\cmdmarg{content}}
2108 \\\hline
2109
2110 $\ACert-{C}{A}$
2111 & \ACmd{\Verb|\ACert-{C}{A}|}, used for a certificate binding the
2112 public key \AKey+{A} (public key of \APri{A}) to the principal \APri{A},
2113 where the \ACmd{-}
2114 says that the signature is signed with a private key (in this
2115 case, the private key of the certificate authority \APri{C}).
2116 The other key type markers can also be used with this command.
2117 \\[-1ex]\nopagebreak
2118 \emph{Arguments:} & \cmdargs{ACert}{TBimm}\newline
2119 \cmdargex{ACert}{{\cmdkarg}\cmdoarg{size}%
2120 {\cmdearg}\cmdmarg{key}\cmdmarg{principal}}
2121 \\\hline
2122
2123 $\AMktval{X}\ATvalX{m}$
2124 & \ACmd{\Verb|\AMktval{X}|}, used to create a new typed structured
2125 value type where the argument is the type. In this example, the
2126 result is a new {\latex} command \ACmd{\Verb|\ATvalX|} (created
2127 combining the prefix \ACmd{\Verb|ATval|} and the given name). We
2128 can for example use this to create a new typed structured type for a
2129 specific message type:\newline
2130 \example{%
2131 % \mbox{\ACmd{%
2132 % \Verb|\ATval{KT}{\APri{S},\APri{C},\mbox{Addr},\ATS{t},\ATTL{l}}|}}
2133 % & \givesarrow
2134 % & \ATval{KT}{\APri{S},\APri{C},\mbox{Addr},\ATS{t},\ATTL{l}} \\
2135 \begin{tabular}{@{}l@{}}
2136 \mbox{\ACmd{\Verb|\AMktval{ReqMsg}|}} \\[-1ex]
2137 \mbox{\ACmd{\Verb|\ATvalReqMsg{\APri{A},m}|}}
2138 \end{tabular}\gives
2139 \AMktval{ReqMsg}\ATvalReqMsg{\APri{A},m}%
2140 }\vspace*{-2.2ex}
2141 \\ &
2142 The new command will have a \ACmd{\Verb|*|} version similar to the
2143 \ACmd{\Verb|\ATval*|} command (the value is not wrapped with curly
2144 brackets). The \ACmd{\Verb|\AMktval|} has an
2145 optional first argument to specify the name of the command
2146 created:\newline
2147 \example{
2148 \begin{tabular}{@{}l@{}}
2149 \mbox{\ACmd{\Verb|\AMktval[reqmsg]{RMsg}|}} \\[-1ex]
2150 \mbox{\ACmd{\Verb|\reqmsg{m}|}}
2151 \end{tabular}\gives
2152 \AMktval[reqmsg]{RMsg}\reqmsg{m}}\vspace*{-2.0ex}\\ \nopagebreak
2153 \emph{Arguments:} & \cmdargs{AMktval}{om}[sBim]\newline
2154 \cmdargex{AMktval}{\cmdoarg{cmd}\cmdmarg{type}}%
2155 [\cmdargexx{cmd}{{\cmdsarg}\cmdoarg{size}%
2156 {\cmdearg}\cmdmarg{value}}]
2157 \\\hline
2158
2159 $\AMketval{X}\AEtvalX{A}{m}$
2160 & \ACmd{\Verb|\AMketval{X}|}, used to create a new \emph{encrypted}
2161 typed structured value type where the argument is the type. In this
2162 example, the result is a new {\latex} command \ACmd{\Verb|\AEtvalX|}
2163 (created combining the prefix \ACmd{\Verb|AEtval|} and the given name).
2164 We can for example use this to create a new typed structured type
2165 for an encrypted message type:\newline
2166 \example{%
2167 \begin{tabular}{@{}l@{}}
2168 \mbox{\ACmd{\Verb|\AMketval{EMsg}|}} \\[-1ex]
2169 \mbox{\ACmd{\Verb|\AEtvalEMsg'{C,S}{m}|}}
2170 \end{tabular}\gives
2171 \AMketval{EMsg}\AEtvalEMsg'{C,S}{m}}\vspace*{-2.2ex}\\
2172 &
2173 The \ACmd{\Verb|\AMketval|} has an
2174 optional first argument to specify the name of the command
2175 created (here we define the command \ACmd{\Verb|\aka|} for
2176 Kerberos Authenticators):\newline
2177 \example{%
2178 \begin{tabular}{@{}l@{}}
2179 \mbox{\ACmd{\Verb|\AMketval[aka]{KA}|}} \\[-1ex]
2180 \mbox{\ACmd{%
2181 \Verb|\aka'{S,C}{\APri{C},\textit{Addr}_C,\ATS{s}}|}}
2182 \end{tabular}\gives
2183 \AMketval[aka]{KA}\aka'{S,C}{\APri{C},\textit{Addr}_C,\ATS{s}}}%
2184 \vspace*{-2.2ex}\\
2185 &
2186 In this case, it might be a good idea to create a new {\latex}
2187 command \ACmd{\Verb|\ka|} implemented with \ACmd{\Verb|\aka|}
2188 and the proper arguments (implementation details not shown):\newline
2189 \example{%
2190 \begin{tabular}{@{}l@{}}
2191 \mbox{\ACmd{\Verb|\newcommand{\ka}[3]{\aka'{...}}|}}\\[-1ex]
2192 \mbox{\ACmd{\Verb|\ka{S,C}{C}{s}|}}
2193 \end{tabular}\gives
2194 \AMketval[aka]{KA}%
2195 \NewDocumentCommand\ka{mmm}{\aka'{#1}{%
2196 \APri{#2},\textit{Addr}_{\APri{#2}},\ATS{#3}}}%
2197 \ka{S,C}{C}{s}%
2198 }\vspace*{-2.0ex}\\ \nopagebreak
2199 \emph{Arguments:} & \cmdargs{AMketval}{om}[TBimm]\newline
2200 \cmdargex{AMketval}{\cmdoarg{cmd}\cmdmarg{type}}%
2201 [\cmdargexx{cmd}{{\cmdkarg}\cmdoarg{size}%
2202 {\cmdearg}\cmdmarg{key}\cmdmarg{value}}]
2203 \\\hline
2204
2205 $\AMkstval{X}\AStvalX{A}{m}$
2206 & \ACmd{\Verb|\AMkstval{X}|}, used to create a new \emph{signed}
2207 typed structured
2208 value type where the argument is the type. In this example, the
2209 result is a new {\latex} command \ACmd{\Verb|\AStvalX|} (created
2210 combining the prefix \ACmd{\Verb|AStval|} and the given name). We can for
2211 example use this to create a new typed structured type for an
2212 signed message type:\newline
2213 \example{%
2214 % \mbox{\ACmd{%
2215 % \Verb|\ATval{KT}{\APri{S},\APri{C},\mbox{Addr},\ATS{t},\ATTL{l}}|}}
2216 % & \givesarrow
2217 % & \ATval{KT}{\APri{S},\APri{C},\mbox{Addr},\ATS{t},\ATTL{l}} \\
2218 \begin{tabular}{@{}l@{}}
2219 \mbox{\ACmd{\Verb|\AMkstval{SMsg}|}} \\[-1ex]
2220 \mbox{\ACmd{\Verb|\AStvalSMsg-{A}{m}|}}
2221 \end{tabular}\gives
2222 \AMkstval{SMsg}\AStvalSMsg-{A}{m}}\vspace*{-2.2ex}
2223 \\ &
2224 The \ACmd{\Verb|\AMkstval|} has an
2225 optional first argument to specify the name of the command
2226 created:\newline
2227 \example{%
2228 \begin{tabular}{@{}l@{}}
2229 \mbox{\ACmd{\Verb|\AMkstval[smsg]{SMsg}|}} \\[-1ex]
2230 \mbox{\ACmd{\Verb|\smsg-{S}{m}|}}
2231 \end{tabular}\gives
2232 \AMkstval[smsg]{SMsg}\smsg-{S}{m}}\vspace*{-2.0ex}\\ \nopagebreak
2233 \emph{Arguments:} & \cmdargs{AMkstval}{om}[TBimm]\newline
2234 \cmdargex{AMkstval}{\cmdoarg{cmd}\cmdmarg{type}}%
2235 [\cmdargexx{cmd}{{\cmdkarg}\cmdoarg{size}%
2236 {\cmdearg}\cmdmarg{key}\cmdmarg{value}}]
2237 \\\hline
2238
2239 $\AMkfunc{X}\AFuncX{x,y}$
2240 & \ACmd{\Verb|\AMkfunc{X}|}, used when creating a new function type
2241 where the argument is the name of the function type. In this example
2242 the result is a new {\latex} command \ACmd{\Verb|\AFuncX|} (created
2243 combining the prefix \ACmd{\Verb|AFunc|} and the given name).
2244 We can for example use this to create a new function type
2245 for a creating a Kerberos Authenticator:\newline
2246 \example{%
2247 % \mbox{\ACmd{%
2248 % \Verb|\ATval{KT}{\APri{S},\APri{C},\mbox{Addr},\ATS{t},\ATTL{l}}|}}
2249 % & \givesarrow
2250 % & \ATval{KT}{\APri{S},\APri{C},\mbox{Addr},\ATS{t},\ATTL{l}} \\
2251 \begin{tabular}{@{}l@{}}
2252 \mbox{\ACmd{\Verb|\AMkfunc{KA}|}} \\[-1ex]
2253 \mbox{\ACmd{\Verb|\AFuncKA{\APri{C},\textit{Addr}_C,\ATS{s}}|}}
2254 \end{tabular}\gives
2255 \AMkfunc{KA}\AFuncKA{\APri{C},\textit{Addr}_C,\ATS{s}}}\vspace*{-2.2ex}
2256 \\
2257 & The \ACmd{\Verb|\AMkfunc|} has an optional first argument to specify
2258 the name of the command created:\newline
2259 \example{%
2260 \begin{tabular}{@{}l@{}}
2261 \mbox{\ACmd{\Verb|\AMkfunc[kaf]{KA}|}} \\[-1ex]
2262 \mbox{\ACmd{\Verb|\kaf{\APri{C},\textit{Addr}_C,\ATS{s}}|}}
2263 \end{tabular}\gives
2264 \AMkfunc[kaf]{KA}\kaf{\APri{C},\textit{Addr}_C,\ATS{s}}}\vspace*{-2.2ex}
2265 \\
2266 & The \ACmd{\Verb|\AMkfunc|} has an optional third and last argument to
2267 specify the name of the command used for magic return:\newline
2268 \example{%
2269 \begin{tabular}{@{}l@{}}
2270 \mbox{\ACmd{\Verb|\AMktval[aset]{Set}]|}} \\[-1ex]
2271 \mbox{\ACmd{\Verb|\AMkfunc[asetf]{Set}[aset]|}} \\[-1ex]
2272 \mbox{\ACmd{\Verb|\asetf{\AVal{x},\AVal{y}}[*]|}}
2273 \end{tabular}\gives
2274 \AMktval[aset]{Set} \AMkfunc[asetf]{Set}[aset]%
2275 \asetf{\AVal{x},\AVal{y}}[*]}\vspace*{-2.0ex}
2276 \\ \nopagebreak
2277 \emph{Arguments:} & \cmdargs{AMkfunc}{omo}[Bimx]\newline
2278 \cmdargex{AMkfunc}{%
2279 \cmdoarg{cmd}\cmdmarg{name}\cmdoarg{magic-return}}%
2280 [\cmdargexx{cmd}{\cmdoarg{size}{\cmdearg}%
2281 \cmdmarg{arguments}\cmdoarg{returns}}]
2282 \\\hline
2283
2284 $\AMkkfunc{X}\AKfuncX{A}{x,y}$
2285 & \ACmd{\Verb|\mkkfunk{X}|}, used when creating a new function type for
2286 functions where the first argument is an encryption key. The
2287 argument is the name of the function type. In this example
2288 the result is a new {\latex} command \ACmd{\Verb|\AKfuncX|} (created
2289 combining the prefix \ACmd{\Verb|AKfunc|} and the given name) with two
2290 arguments; the first argument is an encryption key and the second
2291 argument is a comma separated list of the rest of the function arguments.
2292 We can for example use this to create this new function type with an
2293 encryption key as the first argument (a session key in this
2294 example):\newline
2295 \example{%
2296 % \mbox{\ACmd{%
2297 % \Verb|\ATval{KT}{\APri{S},\APri{C},\mbox{Addr},\ATS{t},\ATTL{l}}|}}
2298 % & \givesarrow
2299 % & \ATval{KT}{\APri{S},\APri{C},\mbox{Addr},\ATS{t},\ATTL{l}} \\
2300 \begin{tabular}{@{}l@{}}
2301 \mbox{\ACmd{\Verb|\AMkkfunc{KeyF}|}} \\[-1ex]
2302 \mbox{\ACmd{\Verb|\AKfuncKeyF'{A}{\textit{Addr},\ATS{s}}|}}
2303 \end{tabular}\gives
2304 \AMkkfunc{KeyF}\AKfuncKeyF'{A}{\textit{Addr},\ATS{s}}}\vspace*{-2.2ex}
2305 \\ &
2306 The \ACmd{\Verb|\AMkkfunc|} has an optional first argument to specify
2307 the name of the command created:\newline
2308 \example{%
2309 \begin{tabular}{@{}l@{}}
2310 \mbox{\ACmd{\Verb|\AMkkfunc[kf]{KeyF}|}} \\[-1ex]
2311 \mbox{\ACmd{\Verb|\kf'{A}{\textit{Addr},\ATS{s}}|}}
2312 \end{tabular}\gives
2313 \AMkkfunc[kf]{KeyF}\kf'{A}{\textit{Addr},\ATS{s}}}\vspace*{-2.2ex}
2314 \\
2315 & The \ACmd{\Verb|\AMkkfunc|} has an optional third and last argument to
2316 specify the name of the command used for magic return:\newline
2317 \example{%
2318 \begin{tabular}{@{}l@{}}
2319 \mbox{\ACmd{\Verb|\AMkstval[sset]{SSet}]|}} \\[-1ex]
2320 \mbox{\ACmd{\Verb|\AMkkfunc[ssetf]{SignSet}[sset]|}} \\[-1ex]
2321 \mbox{\ACmd{\Verb|\ssetf-{A}{\AVal{x},\AVal{y}}[*]|}}
2322 \end{tabular}\gives
2323 \AMkstval[sset]{SSet} \AMkkfunc[ssetf]{SignSet}[sset]%
2324 \ssetf-{A}{\AVal{x},\AVal{y}}[*]}\vspace*{-2.0ex}
2325 \\ \nopagebreak
2326 \emph{Arguments:} & \cmdargs{AMkkfunc}{omo}[TBimmx]\newline
2327 \cmdargex{AMkkfunc}{%
2328 \cmdoarg{cmd}\cmdmarg{name}\cmdoarg{magic-return}}%
2329 [\cmdargexx{cmd}{{\cmdkarg}\cmdoarg{size}{\cmdearg}%
2330 \cmdmarg{key}\cmdmarg{arguments}\cmdoarg{returns}}]
2331 \\\hline
2332
2333 $\AMkproc{X}\AProcX$
2334 & \ACmd{\Verb|\AMkproc{X}|}, used when creating a new procedure type
2335 where the argument is the name of the procedure type. In this example
2336 the result is a new {\latex} command \ACmd{\Verb|\AProcX|} (created
2337 combining the prefix \ACmd{\Verb|AProc|} and the given name).
2338 We can for example use this to create a new procedure type
2339 for protocol failures:\newline
2340 \example{%
2341 \begin{tabular}{@{}l@{}}
2342 \mbox{\ACmd{\Verb|\AMkproc{Fail}|}} \\[-1ex]
2343 \mbox{\ACmd{\Verb|\AProcFail[message]|}}
2344 \end{tabular}\gives
2345 \AMkproc{Fail}\AProcFail(LightLightGrey)[message]}\vspace*{-2.2ex}
2346 \\
2347 & The \ACmd{\Verb|\AMkproc|} has an optional argument to specify
2348 the name of the command created:\newline
2349 \example{%
2350 \begin{tabular}{@{}l@{}}
2351 \mbox{\ACmd{\Verb|\AMkproc[fail]{Fail}|}} \\[-1ex]
2352 \mbox{\ACmd{\Verb|\fail[message]|}}
2353 \end{tabular}\gives
2354 \AMkproc[fail]{Fail}\fail(LightLightGrey)[message]}\vspace*{-2.2ex}
2355 \\
2356 & All procedures has an optional first argument in parentheses (before
2357 the optional message) that specifies the background color. Its default
2358 value is white, but you should set this to the correct color if the
2359 background where the name of the procedure is printed is not white.
2360 The reason is that the name is printed with a contour color to make the
2361 underline look nicer, especially when characters break the line:\newline
2362 \example{%
2363 \begin{tabular}{@{}l@{}}
2364 \mbox{\ACmd{\Verb|\AMkproc[syncfailure]{SyncFailure}|}} \\[-1ex]
2365 \mbox{\ACmd{\Verb|\syncfailure[without correct background color set]\newline|}} \\[-1ex]
2366 \mbox{\ACmd{\Verb|\syncfailure(LightLightGrey)[with correct background color set]|}}
2367 \end{tabular}\\
2368 \multicolumn{1}{@{}l@{}}{\gives
2369 \begin{tabular}{@{}l@{}}
2370 \AMkproc[syncfailure]{SyncFailure}%
2371 \syncfailure[without correct background color set]\\[-1ex]
2372 \AMkproc[syncfailure]{SyncFailure}%
2373 \syncfailure(LightLightGrey)[with correct background color set]
2374 \end{tabular}}}\vspace*{-2.0ex}
2375 \\ \nopagebreak
2376 \emph{Arguments:} & \cmdargs{AMkproc}{om}[P{white}io]\newline
2377 \cmdargex{AMkproc}{%
2378 \cmdoarg{cmd}\cmdmarg{name}}%
2379 [\cmdargexx{cmd}{\cmdparg{bg-color}{\cmdearg}%
2380 \cmdoarg{message}}]
2381 \\\Xhline{0.5pt}
2382
2383 \end{xltabular}}
2384
2385
2386 \clearpage
2387 \subsection{BAN logic}
2388 \label{sec:latex-ban}
2389
2390 The table below lists the BAN logic notation with the matching
2391 {\latex} commands. This notation is available when the {\latex}
2392 package \ACmd{aspen} is loaded with the option \ACmd{ban}.
2393
2394 {\renewcommand{\arraystretch}{1.6}
2395 \begin{xltabular}{\textwidth}{l@{\hspace{.8em}}X}\Xhline{0.5pt}
2396
2397 \textbf{Notation}
2398 & \textbf{{\latex} code and description}
2399 \\\Xhline{0.5pt}
2400
2401 \BANBelieves
2402 & \ACmd{\Verb|\BANBelieves|}, used to state that someone \emph{believes}
2403 something (and acts as it is true):
2404 \newline
2405 \example{\mbox{\ACmd{\Verb|\APri{A}\BANBelieves\AVal{X}|}}\gives
2406 \APri{A}\BANBelieves\AVal{X}}
2407 \\\hline
2408
2409 \BANSees
2410 & \ACmd{\Verb|\BANSees|}, used to state that someone sees something
2411 (Someone has sent a message to someone and they have bee able to
2412 read it):
2413 \newline
2414 \example{\mbox{\ACmd{\Verb|\APri{A}\BANSees\AVal{X}|}}\gives
2415 \APri{A}\BANSees\AVal{X}}
2416 \\\hline
2417
2418 \BANOncesaid
2419 & \ACmd{\Verb|\BANOncesaid|}, used to state to someone at some time said
2420 something (someone some time sent a message including the statement):
2421 \newline
2422 \example{\mbox{\ACmd{\Verb|\APri{A}\BANOncesaid\AVal{X}|}}\gives
2423 \APri{A}\BANOncesaid\AVal{X}}
2424 \\\hline
2425
2426 \BANControls
2427 & \ACmd{\Verb|\BANControls|}, used to state that someone has
2428 \emph{jurisdiction} (controls) over something:
2429 \newline
2430 \example{\mbox{\ACmd{\Verb|\APri{A}\BANControls\AVal{X}|}}\gives
2431 \APri{A}\BANControls\AVal{X}}
2432 \\\hline
2433
2434 \BANFresh{X}
2435 & \ACmd{\Verb|\BANFresh{X}|}, used to state that something is fresh
2436 (\AVal{X} has not been sent in a message at any time before in the
2437 current run of the protocol).
2438 \\\hline
2439
2440 \BANSharedkey{K}
2441 & \ACmd{\Verb|\BANSharedkey{K}|}, used to state that a key is shared:
2442 \newline
2443 \example{\mbox{\ACmd{\Verb|\APri{A}\BANSharedkey{\AKey{A,B}}\APri{B}|}}\gives
2444 \APri{A}\BANSharedkey{\AKey{A,B}}\APri{B}}
2445 \\\hline
2446
2447 \BANPubkey{K}
2448 & \ACmd{\Verb|\BANPubkey{K}|}, used to state that a key is a
2449 public key of someone:
2450 \newline
2451 \example{\mbox{\ACmd{\Verb|\BANPubkey{\AKey+{A}}\APri{A}|}}\gives
2452 \BANPubkey{\AKey+{A}}\APri{A}}
2453 \\\hline
2454
2455 \BANSecret{X}
2456 & \ACmd{\Verb|\BANSecret{X}|}, used to state that a secret
2457 (\AVal{X}, in this case) is only known to them:
2458 \newline
2459 \example{\mbox{\ACmd{\Verb|\APri{A}\BANSecret{X}\APri{B}|}}\gives
2460 \APri{A}\BANSecret{X}\APri{B}}
2461 \\\hline
2462
2463 \BANEncryptedwith{K}{X}
2464 & \ACmd{\Verb|\BANEncryptedwith{K}{X}|}, used to state that something is
2465 encrypted with the key (\AVal{X} is encrypted with the key \AKey*{K}).
2466 \\\hline
2467
2468 \BANCombine{x}{y}
2469 & \ACmd{\Verb|\BANCombine{x}{y}|}, used to state that $x$ is combined
2470 with $y$:
2471 \newline
2472 \example{\mbox{\ACmd{\Verb|\BANCombine{\AVal{X}}{\AVal{Y}}|}}\gives
2473 \BANCombine{\AVal{X}}{\AVal{Y}}}
2474 \\\Xhline{0.5pt}
2475
2476 \end{xltabular}}
2477
2478
2479 \clearpage
2480 \subsection{Series of steps}
2481 \label{sec:latex-steps}
2482
2483 The {\latex} package \ACmd{aspen} provides support for presenting a
2484 security protocol as a series of messages and steps with the
2485 \ACmd{ASteps} environment. A message between to principals is in the
2486 \ACmd{ASteps} environment typeset with the familiar \ACmd{\Verb|\ASend|}
2487 command. With \ACmd{\Verb|\ASend|} commands, the \ACmd{ASteps}
2488 environment can be used like this:
2489
2490 \begin{ltxexample}{238pt}
2491 \begin{ASteps}
2492 \ASend*{A}{B}{\AEncrypted+{B}{m_1}}[m1] \\
2493 \ASend*{B}{A}{\AEncrypted+{A}{m_2}}[m2]
2494 \end{ASteps}
2495 \end{ltxexample}
2496
2497 Notice that each step is separated by the \ACmd{\Verb|\\|}
2498 command. Each step is labeled and can be referred to by its name
2499 (\ACmd{\Verb|\ARef{m1}|} {\givesarrow} \ARef{m1}, and
2500 \ACmd{\Verb|\ARef{m2}|} {\givesarrow} \ARef{m2}). The \ACmd{ASteps*}
2501 version of the environment is without the labels:
2502
2503 \begin{ltxexample}{217pt}
2504 \begin{ASteps*}
2505 \ASend*{A}{B}{\AEncrypted+{B}{m_1}} \\
2506 \ASend*{B}{A}{\AEncrypted+{A}{m_2}}
2507 \end{ASteps*}
2508 \end{ltxexample}
2509
2510 By default, the \ACmd{ASteps} environment has two types of labels;
2511 \ACmd{M} for messages and \ACmd{S} for other steps. In the example
2512 above only messages (\ACmd{\Verb|\ASend|} commands) are used. Other
2513 steps are given with the \ACmd{\Verb|\AStep|} or the
2514 \ACmd{\Verb|\AStepat|} commands. In the following example the
2515 \ACmd{\Verb|\AStep|} command is used and the space between the label
2516 and the step is adjusted with the optional key-value argument
2517 \ACmd{lspace} (the default value is \ACmd{1.5em}):
2518
2519 \begin{ltxexample}{185pt}
2520 \begin{ASteps}[lspace=1em]
2521 \AStep{\AEncrypt+{B}{m_1}[*]} \\
2522 \AStep{\ASign-[big]{A}{%
2523 \AEncrypted+{B}{m_1}}[*]}
2524 \end{ASteps}
2525 \end{ltxexample}
2526
2527 The optional key-value argument \ACmd{rmarg} sets the right margin
2528 width of the ASteps environment and \ACmd{lmarg} sets the left margin
2529 width of the ASteps environment. The default margin widths are
2530 \ACmd{\Verb|\tabcolsep|}. In the following example the margins are
2531 removed:
2532
2533 \begin{ltxexample}{194pt}
2534 \begin{ASteps*}[lmarg=0pt,rmarg=0pt]
2535 \AStep{No margins}
2536 \end{ASteps*}
2537 \end{ltxexample}
2538
2539 We can also change the margins, and the space between the label and
2540 the step, by adjusting the lengths \ACmd{\Verb|\AStepsleftmargin|},
2541 \ACmd{\Verb|\AStepsrightmargin|} and \ACmd{\Verb|\AStepslabelspace|}.
2542 To change these values for the whole document we can place these
2543 commands at the beginning of the {\latex} file (after the {\latex}
2544 package \ACmd{aspen} is loaded):
2545
2546 \begin{ltxexample*}{182pt}
2547 \setlength{\AStepsleftmargin}{0pt}
2548 \setlength{\AStepsrightmargin}{0pt}
2549 \setlength{\AStepslabelspace}{1em}
2550 \end{ltxexample*}
2551
2552 The \ACmd{\Verb|\AStepat|} command can be used to specified
2553 \emph{where} a step is performed. The command has an extra first
2554 argument where this is specified (in this example, at principal
2555 \APri{A}):
2556
2557 \begin{ltxexample}{195pt}
2558 \begin{ASteps}*
2559 \AStepat{A}{\ASign-{A}{m_1}[*]} \\
2560 \AStepat{A}{\AEncrypt+[big]{B}{%
2561 \ASigned-{A}{m_1}}[*]}
2562 \end{ASteps}
2563 \end{ltxexample}
2564
2565 The \ACmd{*} marker of the \ACmd{ASteps} environment (not to be
2566 confused with the \ACmd{ASteps*} version of the environment) means that
2567 the counters of the labels are \emph{not} reset (the counting
2568 continues from the previous \ACmd{ASteps} environment). It is also
2569 possible to set the value of each counter using the standard {\latex}
2570 command \ACmd{\Verb|\setcounter|}. For example, if you want the
2571 counter of the \ACmd{S} labels to start with zero, you add this as the
2572 first command inside a \ACmd{ASteps} environment:
2573 \ACmd{\Verb|\setcounter{counterS}{-1}|} (see \refltxcode{smc-mean} for
2574 an example).
2575
2576 It is also possible to add new types of labels with the optional
2577 key-value argument \ACmd{labels}. In this example, new label types
2578 \ACmd{A} and \ACmd{B} are introduced and the \ACmd{\Verb|\AStepat|}
2579 commands are labeled with the new label types by using the optional
2580 first argument to the command:
2581
2582 \begin{ltxexample}{227pt}
2583 \begin{ASteps}[labels={A,B}]
2584 \AStepat(A){A}{\AEncrypt+{B}{m_1}[*]} \\
2585 \ASend*{A}{B}{\AEncrypted+{B}{m_1}} \\
2586 \AStepat(B){B}{\ADecrypt-[big]{B}{%
2587 \AEncrypted+{B}{m_1}}[m_1]}
2588 \end{ASteps}
2589 \end{ltxexample}
2590
2591 The \ACmd{\Verb|\AStepat*|} version of the \ACmd{\Verb|\AStepat|} command changes the
2592 horizontal position of the text of such steps so the colons are
2593 aligned:
2594
2595 \begin{ltxexample}{252pt}
2596 \begin{ASteps*}
2597 \ASend*{A}{B}{\ASigned-{A}{m_1}} \\
2598 \AStepat*{B}{\AVerify+{A}{\ASigned-{A}{m_1}}}
2599 \end{ASteps*}
2600 \end{ltxexample}
2601
2602 The \ACmd{\Verb|\AStep*|} version of the \ACmd{\Verb|\AStep|} command
2603 changes the horizontal position of the text of the step in a similar
2604 way:
2605
2606 \begin{ltxexample}{225pt}
2607 \begin{ASteps*}
2608 \ASend*{A}{B}{\ASigned-{A}{m_1}} \\
2609 \AStep*{\AVerify+{A}{\ASigned-{A}{m_1}}}
2610 \end{ASteps*}
2611 \end{ltxexample}
2612
2613 The \ACmd{\Verb|\ARawstep|} command is a low-level command that
2614 usually is not necessary. In a \ACmd{ASteps*} environment it has four
2615 optional arguments followed by one non-optional argument. In a
2616 \ACmd{ASteps} environment another optional first argument and an
2617 optional last argument is added related to the labels of the step. To
2618 better understand the command we show it here used together with a
2619 \ACmd{\Verb|\ASend|} command in a \ACmd{ASteps} environment:
2620
2621 \begin{ltxexample}{184pt}
2622 \begin{ASteps}
2623 \ASend{A}{B}{m}[s1] \\
2624 \ARawstep(M)[a][--][b][;]{m}[s2]
2625 \end{ASteps}
2626 \end{ltxexample}
2627
2628 % The last optional argument of the commands \ACmd{\Verb|\ASend|} and
2629 % \ACmd{\Verb|\ARawstep|} is a label name that we can use to refer to these
2630 % steps, \ARef{s1} and \ARef{s2} in this case. The first optional argument
2631 % of \ACmd{\Verb|\ARawstep|} is the label type for this step. The \ACmd{ASteps}
2632 % environment has two default label types, \ACmd{S} for the steps
2633 % commands and \ACmd{M} for the send commands (messages). In the example,
2634 % the \ACmd{\Verb|\ARawstep|} command uses the \ACmd{M} label type instead of the
2635 % default S label type. The next five arguments (four optional arguments
2636 % and one non-optional argu- ment) illustrate how the \ACmd{\Verb|\ARawstep|}
2637 % command can be used to place elements at the different horizontal
2638 % positions of a line representing one step in \ACmd{ASteps} or
2639 % \ACmd{ASteps*} environments.
2640
2641 % \begin{center}
2642 % \begin{minipage}[c]{0.49\linewidth}
2643 % \begin{minted}{latex}
2644 % \begin{ASteps}
2645 % \AStepat{A}{\AEncrypt+{B}{m_1}[]} \\
2646 % \ASend*{A}{B}{\AEncrypted+{B}{m_1}} \\
2647 % \AStepat{B}{\ADecrypt-[big]{B}{%
2648 % \AEncrypted+{B}{m_1}}[m_1]} \\
2649 % \AStepat{B}{\AEncrypt+{A}{m_2}[*]} \\
2650 % \ASend*{B}{A}{\AEncrypted+{A}{m_2}} \\
2651 % \AStepat{A}{\ADecrypt-[big]{A}{%
2652 % \AEncrypted+{A}{m_2}}[m_2]}
2653 % \end{ASteps}
2654 % \end{minted}
2655 % \end{minipage}\gives
2656 % \begin{ASteps}
2657 % \AStepat{A}{\AEncrypt+{B}{m_1}[*]} \\
2658 % \ASend*{A}{B}{\AEncrypted+{B}{m_1}} \\
2659 % \AStepat{B}{\ADecrypt-[big]{B}{%
2660 % \AEncrypted+{B}{m_1}}[m_1]} \\
2661 % \AStepat{B}{\AEncrypt+{A}{m_2}[*]} \\
2662 % \ASend*{B}{A}{\AEncrypted+{A}{m_2}} \\
2663 % \AStepat{A}{\ADecrypt-[big]{A}{%
2664 % \AEncrypted+{A}{m_2}}[m_2]}
2665 % \end{ASteps}
2666 % \end{center}
2667
2668 % The arguments specification for the commands for the \ACmd{ASteps*} and
2669 % \ACmd{step} environments:
2670
2671 {\renewcommand{\arraystretch}{1.6}%
2672 \begin{xltabular}{\textwidth}{@{}l@{\hspace{.8em}}X@{}}
2673 \multicolumn{2}{@{}l@{}}{%
2674 \textbf{The arguments of the commands in the \ACmd{ASteps*} environment}}
2675 \\
2676 & \cmdargs{ASend}{sBmmm}\newline
2677 \cmdargex{ASend}{\cmdsarg\cmdoarg{size}\cmdmarg{sender}%
2678 \cmdmarg{receiver}\cmdmarg{message}}
2679 \\
2680 & \cmdargs{AStep}{sm}\newline
2681 \cmdargex{AStep}{\cmdsarg\cmdmarg{step}}
2682 \\
2683 & \cmdargs{AStepat}{smm}\newline
2684 \cmdargex{AStepat}{\cmdsarg\cmdmarg{where}\cmdmarg{step}}
2685 \\
2686 & \cmdargs{ARawstep}{oooom}\newline
2687 \cmdargex{ARawstep}{\cmdoarg{sender}\cmdoarg{arrow}\cmdoarg{receiver}%
2688 \cmdoarg{colon}\cmdmarg{step}}
2689 \end{xltabular}}\vspace*{-1.5\baselineskip}
2690
2691 {\renewcommand{\arraystretch}{1.6}%
2692 \begin{xltabular}{\textwidth}{@{}l@{\hspace{.8em}}X@{}}
2693 \multicolumn{2}{@{}l@{}}{%
2694 \textbf{The arguments of the commands in the \ACmd{ASteps} environment}}
2695 \\
2696 & \cmdargs{ASend}{sP{M}Bmmmo}\newline
2697 \cmdargex{ASend}{\cmdsarg\cmdparg{type}\cmdoarg{size}\cmdmarg{sender}%
2698 \cmdmarg{receiver}\cmdmarg{message}\cmdoarg{label}}
2699 \\
2700 & \cmdargs{AStep}{sP{S}mo}\newline
2701 \cmdargex{AStep}{\cmdsarg\cmdparg{type}%
2702 \cmdmarg{step}\cmdoarg{label}}
2703 \\
2704 & \cmdargs{AStepat}{sP{S}mmo}\newline
2705 \cmdargex{AStepat}{\cmdsarg\cmdparg{type}\cmdmarg{where}%
2706 \cmdmarg{step}\cmdoarg{label}}
2707 \\
2708 & \cmdargs{Rawstep}{P{S}oooomo}\newline
2709 \cmdargex{ARawstep}{\cmdparg{type}\cmdoarg{sender}\cmdoarg{arrow}%
2710 \cmdoarg{receiver}\cmdoarg{colon}\cmdmarg{step}\cmdoarg{label}}
2711 \end{xltabular}}
2712
2713
2714
2715 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2716 \clearpage
2717 \section{Notation usage examples}
2718 \label{sec:ex-notation-usage}
2719
2720 To illustrate the usability of the notation, we provide a few examples
2721 where the notation is used to describe well-known, and not so
2722 well-known, security protocols. In the original papers referred to
2723 below, you will find the original notations used. The inconsistencies
2724 in the notations used in these papers are a major motivation behind
2725 {\Aspen}. The following examples are presented here:
2726
2727 {\tableoflisting}
2728
2729 The three last examples listed are from my own publications. I have
2730 included them since they represent the start of my process developing
2731 this notation. You will find that my use of notations then was a
2732 mixed bag without consistency across publications.
2733
2734
2735 \tol{org-ns}{Original Needham–Schroeder protocol}
2736 The \emph{Needham–Schroeder protocol}~\cite{needham1978a} aims to
2737 establish a session key between two parties on a network, typically to
2738 protect further communication. The protocol is based on a symmetric
2739 encryption and it forms the basis for the Kerberos protocol (the
2740 \emph{Needham–Schroeder public key protocol} is presented on
2741 page~\pageref{ns-pk-ex}).
2742
2743 \begin{ltxex}{org-ns}{Original Needham–Schroeder protocol}
2744 \begin{ASteps}
2745 \ASend{A}{S}{\APri{A}, \APri{B}, \ANonce{A}}[ons:1] \\
2746 \ASend*{S}{A}{\AEncrypted[big]{A,S}{\ANonce{A}, \APri{B},
2747 \AKey{A,B}, \AEncrypted{B,S}{\AKey{A,B}, \APri{A}}}}[ons:2] \\
2748 \ASend*{A}{B}{\AEncrypted{B,S}{\AKey{A,B}, \APri{A}}}[ons:3] \\
2749 \ASend*{B}{A}{\AEncrypted{A,B}{\ANonce{B}}}[ons:4] \\
2750 \ASend*{A}{B}{\AEncrypted{A,B}{\ANonce{B} - 1}}[ons:5]
2751 \end{ASteps}
2752 \end{ltxex}
2753
2754 \ANonce{A} and \ANonce{B} are nonces and the shared key \AKey{A,B} should
2755 be fresh, \BANFresh{\AKey{A,B}}. The protocol is vulnerable to a replay
2756 attack~\cite{denning1981a}. See \refltxcode{org-ns} for the {\latex}
2757 code.
2758
2759
2760 \tol{rev-ns}{Revised Needham–Schroeder protocol}
2761 The \emph{Revised Needham–Schroeder protocol}~\cite{needham1987a}
2762 addresses a weakness in the protocol related to its vulnerable to a
2763 replay attack. A fun fact regarding this suggested revision is its
2764 link to my home department,
2765 \href{https://en.uit.no/enhet/ifi}{Department of Computer Science} at
2766 UiT\footnote{UiT The Arctic University of Norway, formerly University
2767 of Tromsø}. From~\cite{needham1987a}:
2768
2769 \begin{quote}
2770 \emph{In 1986 one of us (RMN) gave a lecture at the University of
2771 Tromsø which included the 1978 protocol, the criticism of it, and
2772 also a general principle about the use of nonce identifiers. This
2773 was that the identifier should always be generated by the party
2774 that sought reassurance about the time integrity of a transaction.
2775 In discussion Dr Sape J. Mullender of CWI Amsterdam pointed out
2776 that this should apply to the reassurance of B against the attack
2777 outlined.}
2778 \end{quote}
2779
2780 The revised version adds two initial messages, \ARef{rns:1} and
2781 \ARef{rns:2}, between the two principals \APri{A} and \APri{B} and the
2782 extra nonce \ANonce{I} as an identifier of the session:
2783
2784 \begin{ltxex}{rev-ns}{Revised Needham–Schroeder protocol}
2785 \begin{ASteps}
2786 \ASend{A}{B}{\APri{A}}[rns:1] \\
2787 \ASend*{B}{A}{\AEncrypted{B,S}{\APri{A},\ANonce{I}}}[rns:2] \\
2788 \ASend[big]{A}{S}{\APri{A}, \APri{B}, \ANonce{A},
2789 \AEncrypted{B,S}{\APri{A},\ANonce{I}}}[rns:3] \\
2790 \ASend*{S}{A}{\AEncrypted[big]{A,S}{\ANonce{A}, \APri{B},
2791 \AKey{A,B}, \AEncrypted{B,S}{\AKey{A,B}, \APri{A}, \ANonce{I}}}}[rns:4] \\
2792 \ASend*{A}{B}{\AEncrypted{B,S}{\AKey{A,B}, \APri{A}, \ANonce{I}}}[rns:5] \\
2793 \ASend*{B}{A}{\AEncrypted{A,B}{\ANonce{B}}}[rns:6] \\
2794 \ASend*{A}{B}{\AEncrypted{A,B}{\ANonce{B} - 1}}[rns:7]
2795 \end{ASteps}
2796 \end{ltxex}
2797
2798 The inclusion of the new nonce \ANonce{I} prevents any replaying of
2799 compromised versions of message
2800 \AEncrypted{B,S}{\AKey{A,B},\APri{A}} since the revised version of the
2801 message contains \ANonce{I}:
2802 \AEncrypted{B,S}{\AKey{A,B},\APri{A},\ANonce{I}}. This can not be forged
2803 since an attacker does not have ⁠\AKey{B,S}. ⁠See \refltxcode{rev-ns}
2804 for the {\latex} code of the protocol.
2805
2806
2807 \tol{otway-rees}{Otway-Rees protocol}
2808 The \emph{Otway-Rees protocol}~\cite{otway1987a} is
2809 essential the same as the Revised Needham-Schroeder protocol:
2810
2811 \begin{ltxex}{otway-rees}{Otway-Rees protocol}
2812 \begin{ASteps}
2813 \ASend[big]{A}{B}{\ACounter{A}, \APri{A}, \APri{B},
2814 \AEncrypted{A,S}{\ANonce{A}, \ACounter{A}, \APri{A}, \APri{B}}}[or:1] \\
2815 \ASend[big]{B}{S}{\ACounter{A}, \APri{A}, \APri{B},
2816 \AEncrypted{A,S}{\ANonce{A}, \ACounter{A}, \APri{A}, \APri{B}},
2817 \AEncrypted{B,S}{\ANonce{B}, \ACounter{A}, \APri{A}, \APri{B}}}[or:2] \\
2818 \ASend[big]{S}{B}{\ACounter{A},
2819 \AEncrypted{A,S}{\ANonce{A}, \AKey'{A,B}},
2820 \AEncrypted{B,S}{\ANonce{B}, \AKey'{A,B}}}[or:3] \\
2821 \ASend[big]{B}{A}{\ACounter{A},
2822 \AEncrypted{A,S}{\ANonce{A}, \AKey'{A,B}}}[or:4]
2823 \end{ASteps}
2824 \end{ltxex}
2825
2826 The identifier \ACounter{A} prevents the replay attack since an
2827 attacker is not able to alter \AEncrypted{A,S}{\ANonce{A}, \ACounter{A},
2828 \APri{A}, \APri{B}} and \AEncrypted{B,S}{\ANonce{B}, \ACounter{A},
2829 \APri{A}, \APri{B}}. See \refltxcode{otway-rees} for the {\latex}
2830 code.
2831
2832
2833 \tol{kerberos}{Kerberos protocol}
2834 The \emph{Kerberos protocol}~\cite{steiner1988a} is based on the
2835 Needham-Schroeder protocol, but makes use of timestamps as nonces to
2836 remove the problems of the original Needham-Schroeder protocol and to
2837 reduce the number of messages needed:
2838
2839 \begin{ltxex}{kerberos}{Kerberos protocol}
2840 \begin{ASteps}
2841 \ASend{A}{S}{\APri{A}, \APri{B}} \\
2842 \ASend*{S}{A}{\AEncrypted[big]{A,S}{\ATS{s}, \ATTL{}, \AKey{A,B},
2843 \APri{B}, \AEncrypted{B,S}{\ATS{s}, \ATTL{}, \AKey{A,B}, \APri{A}}}} \\
2844 \ASend[big]{A}{B}{\AEncrypted{B,S}{\ATS{s}, \ATTL{}, \AKey{A,B},
2845 \APri{A}}, \AEncrypted{A,B}{\APri{A}, \ATS{a}}} \\
2846 \ASend*{B}{A}{\AEncrypted{A,B}{\ATS{a} + 1}}
2847 \end{ASteps}
2848 \end{ltxex}
2849
2850 \ATS{s} and \ATS{a} are timestamps and \ATTL{} is a lifetime. See
2851 \refltxcode{kerberos} for the {\latex} code.
2852
2853
2854 \tol{dh-ke}{Diffie–Hellman key exchange}
2855 The \emph{Diffie–Hellman key exchange}
2856 protocol~\cite{diffie1976a} is used to establish a shared symmetric
2857 key between two participants over a public channel based a secret (a
2858 private key) at each participant and some shared public parameters:
2859
2860 \begin{ltxex}{dh-ke}{Diffie–Hellman key exchange}
2861 \begin{ASteps}
2862 \ASend{A}{B}{\AVal{p}}[dh-ex:1] \\
2863 \AStepat*{A}{\AAssign{\AKey+{A}}{\ADhpubkeyf{A}(p)}}[dh-ex:2] \\
2864 \AStepat*{B}{\AAssign{\AKey+{B}}{\ADhpubkeyf{B}(p)}}[dh-ex:3] \\
2865 \ASend{A}{B}{\AKey+{A}}[dh-ex:4] \\
2866 \ASend{B}{A}{\AKey+{B}}[dh-ex:5] \\
2867 \AStepat*{A}{\AAssign{\AKey{A,B}}{\ADhkeyf{A}{B}(p)}}[dh-ex:6] \\
2868 \AStepat*{B}{\AAssign{\AKey{A,B}}{\ADhkeyf{B}{A}(p)}}[dh-ex:7]
2869 \end{ASteps}
2870 \end{ltxex}
2871
2872 The public keys created in step \ref{dh-ex:2} and \ref{dh-ex:3} are also called
2873 Diffie-Hellman key shares. At the end of this protocol the two participants
2874 \APri{A} and \APri{B} has a shared secret key \AKey{A,B}. In BAN logic, we can
2875 state the following about the outcome \AKey{A,B}:
2876 \[
2877 \APri{A}\BANSharedkey{\AKey{A,B}}\APri{B}
2878 \]
2879 In step \ref{dh-ex:1} above, participant \APri{A} send the public
2880 parameters \AVal{p} to participant \APri{B}. Other means of agreeing
2881 on these parameters are possible and not important for the protocol
2882 itself. See \refltxcode{dh-ke} for the {\latex} code of the
2883 \emph{Diffie–Hellman key exchange} protocol.
2884
2885
2886 \tol{ns-pk}{Needham–Schroeder public key protocol}
2887 The \emph{Needham–Schroeder public key protocol}~\cite{needham1978a}
2888 intends to provide mutual authentication between two parties:
2889
2890 \begin{ltxex}{ns-pk}{Needham–Schroeder public key protocol}
2891 \begin{ASteps}
2892 \ASend{A}{S}{\APri{A}, \APri{B}}[ns-pk:1] \\
2893 \ASend*{S}{A}{\ASigned-{S}{\AKey+{B},\APri{B}}}[ns-pk:2] \\
2894 \ASend*{A}{B}{\AEncrypted+{B}{\ANonce{A},\APri{A}}}[ns-pk:3] \\
2895 \ASend{B}{S}{\APri{B}, \APri{A}}[ns-pk:4] \\
2896 \ASend*{S}{B}{\ASigned-{S}{\AKey+{A},\APri{A}}}[ns-pk:5] \\
2897 \ASend*{B}{A}{\AEncrypted+{A}{\ANonce{A},\ANonce{B}}}[ns-pk:6] \\
2898 \ASend*{A}{B}{\AEncrypted+{B}{\ANonce{B}}}[ns-pk:7]
2899 \end{ASteps}
2900 \end{ltxex}
2901 \label{ns-pk-ex}
2902
2903 This protocol is vulnerable to a man-in-the-middle
2904 attack~\cite{lowe1995a}. The fix is however easy.
2905
2906
2907 \tol{nsl-pk}{Needham–Schroeder-Lowe public key protocol}
2908 To avoid a man-in-the-middle attack, the \emph{Needham–Schroeder-Lowe
2909 public key protocol}~\cite{lowe1995a} includes the identity of the
2910 responder in message \ref{ns-pk:6} of the protocol:
2911
2912 \begin{ltxex}{nsl-pk}{Needham–Schroeder-Lowe public key protocol}
2913 \begin{ASteps}
2914 \ASend{A}{S}{\APri{A}, \APri{B}}[nsl-pk:1] \\
2915 \ASend*{S}{A}{\ASigned-{S}{\AKey+{B},\APri{B}}}[nsl-pk:2] \\
2916 \ASend*{A}{B}{\AEncrypted+{B}{\ANonce{A},\APri{A}}}[nsl-pk:3] \\
2917 \ASend{B}{S}{\APri{B}, \APri{A}}[nsl-pk:4] \\
2918 \ASend*{S}{B}{\ASigned-{S}{\AKey+{A},\APri{A}}}[nsl-pk:5] \\
2919 \ASend*{B}{A}{\AEncrypted+{A}{\ANonce{A},\ANonce{B},\APri{B}}}[nsl-pk:6] \\
2920 \ASend*{A}{B}{\AEncrypted+{B}{\ANonce{B}}}[nsl-pk:7]
2921 \end{ASteps}
2922 \end{ltxex}
2923
2924 See \refltxcode{ns-pk} and \refltxcode{nsl-pk} for the {\latex} code
2925 of the two versions of the \emph{Needham–Schroeder public key protocol}.
2926
2927
2928 \tol{asw}{ASW protocol}
2929 The \emph{ASW protocol} is an optimistic fair-exchange protocol for
2930 contract signing~\cite{asokan1998a}. This is a good example for
2931 {\Aspen} since we in publications find very different (and, if I may
2932 say so, hard to read) notations used when presenting the
2933 protocol~\cite{asokan1998a,briais2007a}. This is a simplified version
2934 of the \emph{exchange} subprotocol (the main part of the protocol) of
2935 ASW is shown in {\Aspen}:
2936
2937 \begin{ltxex}{asw}{ASW exchange protocol}
2938 \begin{ASteps}
2939 \ASend*{O}{R}{\ASigned-[big]{O}{%
2940 \AKey+{A},\AKey+{B},m,\AChash{\ANonce{O}}}}[asW:1] \\
2941 \ASend*{R}{O}{\ASigned-[Big]{R}{%
2942 \ASigned-[big]{O}{\AKey+{A},\AKey+{B},m,\AChash{\ANonce{O}}},
2943 \AChash{\ANonce{R}}}}[asw:2] \\
2944 \ASend{O}{R}{\ANonce{O}}[asw:3] \\
2945 \ASend{R}{O}{\ANonce{R}}[asw:4]
2946 \end{ASteps}
2947 \end{ltxex}
2948
2949 Two participants \APri{O} (originator) and \APri{R} (recipient) is
2950 involved in this subprotocol. In the complete protocol two other
2951 subprotocols (\emph{abort} and \emph{resolve}) and a third participant
2952 \APri{T} (third player) is included. See \refltxcode{asw} for the
2953 {\latex} code.
2954
2955
2956 \tol{wmf}{Wide-mouthed-frog protocol}
2957 The \emph{Wide-mouthed-frog protocol}~\cite{burrows1990a} (Section~7,
2958 page~25) is a simple protocol that uses shared key cryptography and an
2959 authentication server. It transfers a key from \APri{A} to \APri{B}
2960 via the authentication server \APri{S} in only two messages by using
2961 synchronized clocks and by allowing \APri{A} to choose the session
2962 key:
2963
2964 \begin{ltxex}{wmf}{Wide-mouthed-frog protocol}
2965 \begin{ASteps}
2966 \ASend[big]{A}{S}{A, \AEncrypted{A,S}{\ATS{A}, \APri{B}, \AKey'{A,B}}}[wmf:1] \\
2967 \ASend*[big]{S}{B}{\AEncrypted{B,S}{\ATS{S}, \APri{A}, \AKey'{A,B}}}[wmf:2]
2968 \end{ASteps}
2969 \end{ltxex}
2970
2971 \APri{A} sends a time stamp \ATS{A} and session key \AKey'{A,B} to
2972 \APri{S}. \APri{S} checks that message \ARef{wmf:1} is timely. If it
2973 is, it forwards the key \AKey'{A,B} to \APri{B} together with its own
2974 timestamp \ATS{S} in message \ARef{wmf:2}. \APri{B} then checks that
2975 the timestamp \ATS{S} from \APri{S} is later than any another it has
2976 received from \APri{S}.
2977
2978
2979 \tol{iwmf}{Idealized wide-mouthed-frog protocol}
2980 The \emph{Idealized wide-mouthed-frog protocol} with BAN logic is
2981 shown below:
2982
2983 \begin{ltxex}{iwmf}{Idealized wide-mouthed-frog protocol}
2984 \begin{ASteps}
2985 \ASend*{A}{S}{\AEncrypted[big]{A,S}{\ATS{A},
2986 \{\APri{A}\BANSharedkey{\AKey{A,B}}\APri{B}\}}}[iwmf:1] \\
2987 \ASend*[big]{S}{B}{\AEncrypted{B,S}{\ATS{S},
2988 \APri{A}\BANBelieves\APri{A}\BANSharedkey{\AKey{A,B}}\APri{B}}}[iwmf:2]
2989 \end{ASteps}
2990 \end{ltxex}
2991
2992
2993 \tol{dwmf}{Wide-mouthed-frog protocol with declarations}
2994 In \cite{briais2007a}, formal declarations as part of protocol
2995 narrations is introduced. We can do something similar with BAN logic
2996 and {\Aspen}, where we use BAN logic for the declaration part
2997 (\ARef{dwmf:1}--\ARef{dwmf:3}). The following example is similar to
2998 their version of the \emph{Wide-mouthed-frog protocol with
2999 declarations} (see \cite{briais2007a}, Table~3, page~487):
3000
3001 \begin{ltxex}{dwmf}{Wide-mouthed-frog protocol with declarations}
3002 \begin{ASteps}[labels=D]
3003 \AStep(D){\APri{A}\BANSharedkey{\AKey{A,S}}\APri{S};
3004 \APri{B}\BANSharedkey{\AKey{B,S}}\APri{S}}[dwmf:1] \\
3005 \AStep(D){\APri{A}\BANSees\AKey'{A,B}; \BANFresh{\AKey'{A,B}};
3006 \APri{A}\BANSees\AVal{m}}[dwmf:3] \\
3007 \ASend[big]{A}{S}{A,\AEncrypted{A,S}{\ATS{A},\APri{B},\AKey'{A,B}}}[dwmf:4] \\
3008 \ASend*[big]{S}{B}{\AEncrypted{B,S}{\ATS{S},\APri{A},\AKey'{A,B}}}[dwmf:5]
3009 \end{ASteps}
3010 \end{ltxex}
3011
3012 See \refltxcode{wmf}, \refltxcode{iwmf} and \refltxcode{dwmf} for the
3013 {\latex} code of the \emph{Wide-mouthed-frog protocol}, the
3014 \emph{Idealized wide-mouthed-frog protocol} and the
3015 \emph{Wide-mouthed-frog protocol with declarations}.
3016
3017
3018 \tol{tls-hs}{TLS 1.3 Handshake}
3019 The \emph{TLS 1.3 Handshake}~\cite{rescorla2018a} has three stages.
3020 Stage one is the key exchange, stage two is the server parameters, and
3021 stage three is authentication (we only include server authentication
3022 in the example). In the steps below stage one and three are included,
3023 the key exchange algorithm used is DHE (Ephemeral Diffie-Hellman) and
3024 we ignore PSK (Pre-Shared Key):
3025
3026 \begin{ltxex}{tls-hs}{TLS 1.3 Handshake}
3027 \begin{ASteps}
3028 \AStepat*{C}{\AAssign{\AKey+{C_e}}{\ADhpubkeyf{C_e}},
3029 \BANFresh{\AKey-{C_e}}}[tls-hs:1] \\
3030 \ASend{C}{S}{\ldots, \ANonce{C}, \AKey+{C_e}, \ldots}[tls-hs:2] \\
3031 \AStepat*{S}{\AAssign{\AKey+{S_e}}{\ADhpubkeyf{S_e}},
3032 \BANFresh{\AKey-{S_e}}}[tls-hs:3] \\
3033 \ASend[big]{S}{C}{\ldots, \ANonce{S}, \AKey+{S_e}, \ACert-{CA}{S},
3034 \ASigned-{S}{\ANonce{C'}, \ANonce{S'}, \ldots}, \ldots}[tls-hs:4] \\
3035 \AStepat*{C}{\ACond[\AVerify+[big]{CA}{\ACert-{CA}{S}}]{%
3036 \ACondstep{\AFalse}{\AAbort}}}[tls-hs:5a] \\
3037 \AStepat*{C}{\ACond[\AVerify+{S}{\ASigned-{S}{\ANonce{C}, \ANonce{S},
3038 \ldots}}]{\ACondstep{\AFalse}{\AAbort}}}[tls-hs:5b] \\
3039 \AStepat*{C}{\ACond[\ANonce{C}=\ANonce{C'}\land\ANonce{S}=\ANonce{S'}]{%
3040 \ACondstep{\AFalse}{\AAbort}}}[tls-hs:5c] \\
3041 \AStepat*{C}{\AAssign{\AKey{C,S}}{\ADhkeyf{C_e}{S_e}}}[tls-hs:6a] \\
3042 \ASend*{C}{S}{\AEncrypted{C,S}{\ldots}}[tls-hs:7] \\
3043 \AStepat*{S}{\AAssign{\AKey{C,S}}{\ADhkeyf{S_e}{C_e}}}[tls-hs:6b]
3044 \end{ASteps}
3045 \end{ltxex}
3046 % \ASend*{C}{S}{\AEncrypted{C,S}{\ldots}}[tls-hs:7] \\
3047 % \ASend*{S}{C}{\AEncrypted{C,S}{\ldots}}[tls-hs:8]
3048
3049 The example above is somewhat simplified to make it easier to follow
3050 (some details are hidden and some optional pathways are ignored).
3051 Message \ref{tls-hs:2} is the \emph{client hello} message and message
3052 \ref{tls-hs:4} is both the \emph{server hello} and the \emph{server
3053 finished} message. After steps \ref{tls-hs:6a} and \ref{tls-hs:6b}
3054 the client \APri{C} and the server \APri{S} share a new fresh
3055 encryption key \AKey{C,S} and the rest of the TLS handshake is
3056 encrypted. The \emph{client finished} message \ref{tls-hs:7}
3057 concludes the handshake and the client and the server can securely
3058 communicate with the shared key \AKey{C,S}.
3059
3060
3061 \tol{smc-mean}{SMC: Calculate the mean value}
3062 In~\cite{andersen2014a}, \emph{SMC} (secure multi-party computation)
3063 algorithms for analyzing health data were discussed. The first
3064 algorithm from this paper is used to calculate the mean value of three
3065 values \AVal{V_1}, \AVal{V_2} and \AVal{V_3} from three participants
3066 \APri{P_1}, \APri{P_2} and \APri{P_3} without sharing any knowledge
3067 about the individual values. A coordinator \APri{C} coordinates the
3068 calculation. The messages between from \APri{P_{i-1}} to \APri{P_i}
3069 have the following structure (we can say that participant \APri{P_0}
3070 and \APri{P_4} is the same individual with an alias \APri{C}):
3071
3072 \qquad
3073 \begin{ASteps*}[lmarg=0pt]
3074 \ASigned-[Big]{C}{\AEncrypted+[big]{P_i}{\ASigned-{P_{i-1}}{\AVal{V'_{i}}}},
3075 \AEncrypted+[big]{P_i}{\ASigned-{C}{\APri{P_{i-1}},\APri{P_{i+1}}}},
3076 \AEncrypted+[big]{P_{i+1}}{\ASigned-{C}{\APri{P_{i}},\APri{P_{i+2}}}},\ldots}
3077 \end{ASteps*}
3078
3079 The first part of the message is the intermediate value received at
3080 participant \APri{P_i} signed by the previous participant in the
3081 calculation \APri{P_{i-1}}. The second part is each path in the
3082 calculation (where the input came from and where to send the
3083 intermediate result). The current participant \APri{P_i} can decrypt
3084 the first element that says the it should expect the input value from
3085 participant \APri{P_{i-1}} and it should forwards the intermediate
3086 result of its calculation to participant \APri{P_{i+1}}. Each such
3087 element is signed by the coordinator and encrypted with the public key
3088 of the participant that should be able to read this information. We
3089 can now write the protocol used for the calculation of the mean value
3090 \AVal{M} using the {\Aspen} notation (we ignore the signature
3091 verification steps at each participant):
3092
3093 \begin{ltxex}{smc-mean}{SMC: Calculate the mean value}
3094 \begin{ASteps}\setcounter{counterS}{-1}%
3095 \AStepat*{C}{\AAssign{\AVal{V'_0}}{\ARandom'{0}}}\\
3096 \ASend*{C}{P_1}{\ASigned-[Big]{C}{%
3097 \AEncrypted+[big]{P_1}{\ASigned-{C}{\AVal{V_0}}},
3098 \AEncrypted+[big]{P_1}{\ASigned-{C}{\APri{C},\APri{P_2}}},
3099 \AEncrypted+[big]{P_2}{\ASigned-{C}{\APri{P_1},\APri{P_3}}},
3100 \AEncrypted+[big]{P_3}{\ASigned-{C}{\APri{P_2},\APri{C}}},
3101 \AEncrypted+[big]{C}{\ASigned-{C}{\APri{C},\_\,}}}} \\
3102 \AStepat*{P_1}{\ACond[\AVerify+[big]{C}{\ASigned-{C}{\APri{C},\APri{P_2}}}%
3103 \land \AVerify+[big]{C}{\ASigned-{C}{\ldots}}]{%
3104 \ACondstep{\AFalse}{\AAbort}}} \\
3105 \AStepat*{P_1}{\ACond[\AVerify+[big]{C}{\ASigned-{C}{\AVal{V'_0}}}]{%
3106 \ACondstep{\AFalse}{\AAbort}\ANextbreak
3107 \ACondstep{\ATrue}{\AAssign{\AVal{V'_1}}{\AVal{V'_0}+\AVal{V_1}}}}} \\
3108 \ASend*{P_1}{P_2}{\ASigned-[Big]{P_1}{%
3109 \AEncrypted+[big]{P_2}{\ASigned-{P_1}{\AVal{V'_1}}},
3110 \AEncrypted+[big]{P_2}{\ASigned-{C}{\APri{P_1},\APri{P_3}}},
3111 \AEncrypted+[big]{P_3}{\ASigned-{C}{\APri{P_2},\APri{C}}},
3112 \AEncrypted+[big]{C}{\ASigned-{C}{\APri{C},\_\,}}}} \\
3113 \AStepat*{P_2}{\ACond[\AVerify+[big]{C}{\ASigned-{C}{\APri{P_1},\APri{P_3}}}%
3114 \land \AVerify+[big]{P_1}{\ASigned-{P_1}{\ldots}}]{%
3115 \ACondstep{\AFalse}{\AAbort}}} \\
3116 \AStepat*{P_2}{\ACond[\AVerify+[big]{P_1}{\ASigned-{P_1}{\AVal{V'_1}}}]{%
3117 \ACondstep{\AFalse}{\AAbort}\ANextbreak
3118 \ACondstep{\ATrue}{\AAssign{\AVal{V'_2}}{\AVal{V'_1}+\AVal{V_2}}}}} \\
3119 \ASend*{P_2}{P_3}{\ASigned-[Big]{P_2}{%
3120 \AEncrypted+[big]{P_3}{\ASigned-{P_2}{\AVal{V'_2}}},
3121 \AEncrypted+[big]{P_3}{\ASigned-{C}{\APri{P_2},\APri{C}}},
3122 \AEncrypted+[big]{C}{\ASigned-{C}{\APri{C},\_\,}}}} \\
3123 \AStepat*{P_3}{\ACond[\AVerify+[big]{C}{\ASigned-{C}{\APri{P_2},\APri{C}}}%
3124 \land \AVerify+[big]{P_2}{\ASigned-{P_2}{\ldots}}]{%
3125 \ACondstep{\AFalse}{\AAbort}}} \\
3126 \AStepat*{P_3}{\ACond[\AVerify+[big]{P_2}{\ASigned-{P_2}{\AVal{V'_2}}}]{%
3127 \ACondstep{\AFalse}{\AAbort}\ANextbreak
3128 \ACondstep{\ATrue}{\AAssign{\AVal{V'_3}}{\AVal{V'_2}+\AVal{V_3}}}}} \\
3129 \ASend*{P_3}{C}{\ASigned-[Big]{P_3}{%
3130 \AEncrypted+[big]{C}{\ASigned-{P_3}{\AVal{V'_3}}},
3131 \AEncrypted+[big]{C}{\ASigned-{C}{\APri{C},\_\,}}}} \\
3132 \AStepat*{C}{\ACond[\AVerify+[big]{C}{\ASigned-{C}{\APri{C},\_\,}}%
3133 \land \AVerify+[big]{P_3}{\ASigned-{P_3}{\ldots}}]{%
3134 \ACondstep{\AFalse}{\AAbort}}} \\
3135 \AStepat*{C}{\ACond[\AVerify+[big]{P_3}{\ASigned-{P_3}{\AVal{V'_3}}}]{%
3136 \ACondstep{\AFalse}{\AAbort}\ANextbreak
3137 \ACondstep{\ATrue}{\AAssign{\AVal{M}}{(\AVal{V'_3}-\AVal{V'_0})/\AVal{3}}}}}
3138 \end{ASteps}
3139 \end{ltxex}
3140
3141 \begin{figure}
3142
3143 \hspace*{\fill}
3144 \begin{mplibcode}
3145
3146 p1:=(width,0);
3147 p2:=(0,height);
3148 p3:=(-width,0);
3149 p4:=(width,-height);
3150 p5:=(width,height);
3151 p6:=(-width,height);
3152 p7:=(-width,-height);
3153
3154 c:=(0,-height);
3155
3156 draw object(p1, orad);
3157 label(btex \APri{P_1} etex, p1);
3158 label.rt(btex \ALabel{S_1}, \ALabel{S_2} etex, p1+(1.2orad,0));
3159
3160 draw object(p2, orad);
3161 label(btex \APri{P_2} etex, p2);
3162 label.top(btex \ALabel{S_3}, \ALabel{S_4} etex, p2+(0,1.2orad));
3163
3164 draw object(p3, orad);
3165 label(btex \APri{P_3} etex, p3);
3166 label.lft(btex \ALabel{S_5}, \ALabel{S_6} etex, p3+(-1.2orad,0));
3167
3168 draw object(c, orad);
3169 draw object(c, orad-2pt);
3170 label(btex \APri{C} etex, c);
3171 label.bot(btex \ALabel{S_0}, \ALabel{S_7}, \ALabel{S_8} etex, c+(0,-1.2orad));
3172
3173 draw ddirarrow(c, 0, 90, p1, orad);
3174 label.lrt(btex \ALabel{M_1} etex, c+(0.5width,0));
3175
3176 draw ddirarrow(p1, 90, 180, p2, orad);
3177 label.urt(btex \ALabel{M_2} etex, p2+(0.5width,0));
3178
3179 draw ddirarrow(p2, 180, 270, p3, orad);
3180 label.ulft(btex \ALabel{M_3} etex, p2+(-0.5width,0));
3181
3182 draw ddirarrow(p3, 270, 0, c, orad);
3183 label.llft(btex \ALabel{M_4} etex, c+(-0.5width,0));
3184
3185 \end{mplibcode}
3186 \hspace*{\fill}
3187
3188 \caption{SMC: Calculate the mean value}\label{fig:smc-mean}
3189
3190 \end{figure}
3191
3192 Figure \ref{fig:smc-mean} illustrates the participants and each step
3193 and message of the calculation. See \refltxcode{smc-mean} for the
3194 {\latex} code.
3195
3196
3197 \tol{csi-fs}{File sharing with symmetric and public key encryption}
3198 Cloud Security Infrastructure (CSI)~\cite{andersen2014c} is a scalable
3199 cloud storage architecture with focus on privacy. In
3200 \cite{andersen2014c}, a figure (Figure~3) illustrates how a user can
3201 share a file with another user using a combination of symmetric
3202 (secret) key and public key encryption. In Figure~\ref{fig:csi-fs}
3203 and in the protocol shown below, the intent of original figure in
3204 ~\cite{andersen2014c}is recreated using {\Aspen}. In the steps below,
3205 \APri{A} uploads two files \AVal{F_1} and \AVal{F_2} to a server,
3206 where file \AVal{F_1} is shared with \APri{B}:
3207
3208 \begin{figure}
3209 \hspace*{\fill}
3210 \begin{mplibcode}
3211
3212 d:=(0,0);
3213 p1:=(-1.3width,0);
3214 p2:=(1.3width,0);
3215
3216 draw object(d, orad);
3217 draw object(d, orad-2pt);
3218 label(btex \APri{S} etex, d);
3219
3220 label.bot(btex \boxed{%\small
3221 \begin{array}{@{\:}c@{\:}}
3222 \ACert!_{X509}{CA}{A} \\
3223 \ACert!_{X509}{CA}{B} \\
3224 \ASval[big]{\AEncrypted+{A}{\AKey{F_1}},
3225 \AEncrypted+{B}{\AKey{F_1}}, \AEncrypted{F_1}{F_1}} \\
3226 \ASval[big]{\AEncrypted+{A}{\AKey{F_2}},
3227 \AEncrypted{F_2}{F_2}}
3228 \end{array}} etex, d+(0,-2.3orad));
3229
3230 draw object(p1, orad);
3231 label(btex $A$ etex, p1);
3232
3233 label.lft(btex \boxed{%\small
3234 \begin{array}{@{\:}c@{\:}}
3235 \AEncrypted"_{PCKS\#12}{P_A}{\AKey-{A}} \\
3236 \ACert!_{X.509}{CA}{A} \\
3237 \ACert!_{X.509}{CA}{B} \\
3238 \AVal{F_1} \\
3239 \AVal{F_2}
3240 \end{array}} etex, p1+(-1.2orad,0));
3241
3242 draw ddirarrow(p1, 0+v, 0-v, d, orad);
3243 label.top(btex
3244 \ALabel{M_1}
3245 etex,
3246 (d+p1)/2+(0,1.1orad));
3247
3248 draw ddirarrow(p1, 0-v, 0+v, d, orad);
3249 label.bot(btex
3250 \ALabel{M_2}
3251 etex, (d+p1)/2+(0,-1.2orad));
3252
3253 draw object(p2, orad);
3254 label(btex \APri{B} etex, p2);
3255
3256 label.rt(btex \boxed{%\small
3257 \begin{array}{@{\:}c@{\:}}
3258 \AEncrypted"_{PCKS\#12}{P_B}{\AKey-{B}} \\
3259 \ACert!_{X.509}{CA}{B} \\
3260 \ACert!_{X.509}{CA}{A} \\
3261 \AVal{F_1}
3262 \end{array}} etex, p2+(1.2orad,0));
3263
3264 draw ddirarrow(d, 0, 0, p2, orad);
3265 label.top(btex
3266 \ALabel{M_3}
3267 etex,
3268 (d+p2)/2+(0,0.1orad));
3269
3270 \end{mplibcode}
3271 \hspace*{\fill}
3272 \caption{File sharing with symmetric and public key encryption}
3273 \label{fig:csi-fs}
3274 \end{figure}
3275
3276 \begin{ltxex}{csi-fs}{File sharing with symmetric and public key encryption}
3277 \begin{ASteps}
3278 \AStepat*{A}{\BANFresh{\AKey{F_1}}, \BANFresh{\AKey{F_2}}}[fs-pub:1] \\
3279 \AStepat*{A}{%
3280 \AEncrypt{F_1}{F_1}[*],
3281 \AEncrypt{F_2}{F_2}[*]}[fs-pub:2] \\
3282 \AStepat*{A}{%
3283 \AEncrypt+{A}{\AKey{F_1}}[*],
3284 \AEncrypt+{B}{\AKey{F_1}}[*]}[fs-pub:3] \\
3285 \AStepat*{A}{\AEncrypt+{A}{\AKey{F_2}}[*]}[fs-pub:4] \\
3286 \ASend[big]{A}{S}{\AEncrypted+{A}{\AKey{F_1}},
3287 \AEncrypted+{B}{\AKey{F_1}}, \AEncrypted{F_1}{F_1}}[fs-pub:5] \\
3288 \ASend[big]{A}{S}{\AEncrypted+{A}{\AKey{F_2}},
3289 \AEncrypted{F_2}{F_2}}[fs-pub:6] \\
3290 \ASend[big]{S}{B}{\AEncrypted+{A}{\AKey{F_1}},
3291 \AEncrypted+{B}{\AKey{F_1}}, \AEncrypted{F_1}{F_1}}[fs-pub:7] \\
3292 \AStepat*{B}{%
3293 \ADecrypt"{P_B}{\AEncrypted"{P_B}{\AKey-{B}}}[\AKey-{B}],
3294 \ADecrypt-{B}{\AEncrypted+{B}{\AKey{F_1}}}[\AKey{F_1}]}[fs-pub:8] \\
3295 \AStepat*{B}{\ADecrypt{F_1}{\AEncrypted{F_1}{F_1}}[\AVal{F_1}]}[fs-pub:9]
3296 \end{ASteps}
3297 \end{ltxex}
3298
3299 In Figure~\ref{fig:csi-fs}, the boxes illustrate what is stored at
3300 each principal (data at-rest) and the arrows illustrate the messages
3301 sent between the principals (data in-transit). Each messages in the
3302 figure is labeled with the same labels used in the steps shown above.
3303 In the {\aspen} notation of the protocol above we have included all
3304 the encrypt steps \ref{fs-pub:2}--\ref{fs-pub:4} and decrypt steps
3305 \ref{fs-pub:8}--\ref{fs-pub:9}. We usually leave them out since they
3306 are explicit given by the content of the messages and the expected
3307 usage of the data involved. In this case, we made a point by
3308 explicitly including these steps.
3309
3310
3311 \tol{csi-ssfs}{Scalable secure file sharing}
3312 The Cloud Security Infrastructure (CSI)~\cite{andersen2014c} has come
3313 up with the concept of a \emph{store} and a \emph{share} to achieve
3314 scalable secure file sharing. Every principal has a store that is
3315 represented by a public and private key pair (\AKey+{S_A} and
3316 \AKey-{S_A} for \APri{A} in the example below). When a file is shared,
3317 a new store called a share is created. In the example below a share
3318 represented by the public and private key pair \AKey+{S_{A,B}} and
3319 \AKey-{S_{A,B}} is used to share file \AVal{F_1} between \APri{A} and
3320 \APri{B}. Each store (and share) also has a symmetric random
3321 encryption key associated with them (\AKey{S_A} and \AKey{S_{A,B}} in
3322 the example) used to encrypt the private keys of the stores:
3323
3324 \begin{figure}
3325 \hspace*{\fill}
3326 \begin{mplibcode}
3327
3328 d:=(0,0);
3329 p1:=(-1.3width,0);
3330 p2:=(1.3width,0);
3331
3332 draw object(d, orad);
3333 draw object(d, orad-2pt);
3334 label(btex \APri{S} etex, d);
3335
3336 label.bot(btex \boxed{%\small
3337 \begin{array}{@{\:}c@{\:}}
3338 \ACert!_{X509}{CA}{A} \\
3339 \ACert!_{X509}{CA}{B} \\
3340 \AKey+{S_A}, \AEncrypted{S_A}{\AKey-{S_A}} \\
3341 \AEncrypted+{A}{\AKey{S_A}} \\
3342 \AKey+{S_{A,B}}, \AEncrypted{S_{A,B}}{\AKey-{S_{A,B}}} \\
3343 \AEncrypted+{A}{\AKey{S_{A,B}}}, \AEncrypted+{B}{\AKey{S_{A,B}}} \\
3344 \ASval[big]{\AEncrypted+{S_{A,B}}{\AKey{F_1}},
3345 \AEncrypted+{B}{\AKey{F_1}}, \AEncrypted{F_1}{F_1}} \\
3346 \ASval[big]{\AEncrypted+{S_A}{\AKey{F_2}},
3347 \AEncrypted{F_2}{F_2}}
3348 \end{array}} etex, d+(0,-2.3orad));
3349
3350 draw object(p1, orad);
3351 label(btex $A$ etex, p1);
3352
3353 label.lft(btex \boxed{%\small
3354 \begin{array}{@{\:}c@{\:}}
3355 \AEncrypted"_{PCKS\#12}{P_A}{\AKey-{A}} \\
3356 \ACert!_{X.509}{CA}{A} \\
3357 \ACert!_{X.509}{CA}{B} \\
3358 \AKey+{S_A}, \AEncrypted{S_A}{\AKey-{S_A}} \\
3359 \AEncrypted+{A}{\AKey{S_A}} \\
3360 \AKey+{S_{A,B}}, \AEncrypted{S_{A,B}}{\AKey-{S_{A,B}}} \\
3361 \AEncrypted+{A}{\AKey{S_{A,B}}} \\
3362 \AVal{F_1} \\
3363 \AVal{F_2}
3364 \end{array}} etex, p1+(-1.2orad,0));
3365
3366 draw ddirarrow(p1, 0+v, 0-v, d, orad);
3367 label.top(btex
3368 $\ALabel{M_1},\ALabel{M_2}$
3369 etex,
3370 (d+p1)/2+(0,1.1orad));
3371
3372 draw ddirarrow(p1, 0-v, 0+v, d, orad);
3373 label.bot(btex
3374 $\ALabel{M_3},\ALabel{M_4}$
3375 etex, (d+p1)/2+(0,-1.2orad));
3376
3377 draw object(p2, orad);
3378 label(btex \APri{B} etex, p2);
3379
3380 label.rt(btex \boxed{%\small
3381 \begin{array}{@{\:}c@{\:}}
3382 \AEncrypted"_{PCKS\#12}{P_B}{\AKey-{B}} \\
3383 \ACert!_{X.509}{CA}{B} \\
3384 \ACert!_{X.509}{CA}{A} \\
3385 \AKey+{S_{A,B}}, \AEncrypted{S_{A,B}}{\AKey-{S_{A,B}}} \\
3386 \AEncrypted+{B}{\AKey{S_{A,B}}} \\
3387 \AVal{F_1}
3388 \end{array}} etex, p2+(1.2orad,0));
3389
3390 draw ddirarrow(d, 0+v, 0-v, p2, orad);
3391 label.top(btex
3392 \ALabel{M_5}
3393 etex,
3394 (d+p2)/2+(0,1.1orad));
3395
3396 draw ddirarrow(d, 0-v, 0+v, p2, orad);
3397 label.bot(btex
3398 \ALabel{M_6}
3399 etex,
3400 (d+p2)/2+(0,-1.2orad));
3401
3402 \end{mplibcode}
3403 \hspace*{\fill}
3404 \caption{Scalable secure file sharing}
3405 \label{fig:csi-ssfs}
3406 \end{figure}
3407
3408 \begin{ltxex}{csi-ssfs}{Scalable secure file sharing}
3409 \begin{ASteps}
3410 \AStepat*{A}{%
3411 \BANFresh{\AKey{F_1}}; \BANFresh{\AKey{F_2}};
3412 \BANFresh{\AKey{S_A}}; \BANFresh{\AKey{S_{A,B}}};
3413 \BANFresh{\AKey-{S_A}}; \BANFresh{\AKey+{S_A}};
3414 \BANFresh{\AKey-{S_{A,B}}}; \BANFresh{\AKey+{S_{A,B}}}} \\
3415 \AStepat*{A}{%
3416 \AEncrypt{F_1}{F_1}[*]; \AEncrypt{F_2}{F_2}[*]} \\
3417 \AStepat*{A}{%
3418 \AEncrypt+{S_{A,B}}{\AKey{F_1}}[*]; \AEncrypt+{S_A}{\AKey{F_2}}[*]} \\
3419 \AStepat*{A}{%
3420 \AEncrypt{S_A}{\AKey-{S_A}}[*]; \AEncrypt{S_{A,B}}{\AKey-{S_{A,B}}}[*]} \\
3421 \AStepat*{A}{%
3422 \AEncrypt+{A}{\AKey{S_A}}[*]} \\
3423 \AStepat*{A}{%
3424 \AEncrypt+{A}{\AKey{S_{A,B}}}[*]; \AEncrypt+{B}{\AKey{S_{A,B}}}[*]} \\
3425 \ASend[big]{A}{S}{%
3426 \AEncrypted+{A}{\AKey{S_A}}, \AEncrypted+{A}{\AKey{S_{A,B}}},
3427 \AEncrypted+{B}{\AKey{S_{A,B}}}} \\
3428 \ASend[big]{A}{S}{%
3429 \AEncrypted{S_A}{\AKey-{S_A}}, \AEncrypted{S_{A,B}}{\AKey-{S_{A,B}}}} \\
3430 \ASend[big]{A}{S}{%
3431 \AEncrypted+{S_{A,B}}{\AKey{F_1}}, \AEncrypted{F_1}{F_1}} \\
3432 \ASend[big]{A}{S}{\AEncrypted+{S_A}{\AKey{F_2}}, \AEncrypted{F_2}{F_2}} \\
3433 \ASend[big]{S}{B}{\AEncrypted+{B}{\AKey{S_{A,B}}},
3434 \AEncrypted{S_{A,B}}{\AKey-{S_{A,B}}}} \\
3435 \ASend[big]{S}{B}{%
3436 \AEncrypted+{S_{A,B}}{\AKey{F_1}}, \AEncrypted{F_1}{F_1}} \\
3437 \AStepat*{B}{%
3438 \ADecrypt"{P_B}{\AEncrypted"{P_B}{\AKey-{B}}}[\AKey-{B}];
3439 \ADecrypt-{B}{\AEncrypted+{B}{\AKey{S_{A,B}}}}[\AKey{S_{A,B}}]} \\
3440 \AStepat*{B}{%
3441 \ADecrypt{S_{A,B}}{\AEncrypted{S_{A,B}}{\AKey-{S_{A,B}}}}[\AKey-{S_{A,B}}];
3442 \ADecrypt-{S_{A,B}}{\AEncrypted+{S_{A,B}}{\AKey{F_1}}}[\AKey{F_1}]} \\
3443 \AStepat*{B}{\ADecrypt{F_1}{\AEncrypted{F_1}{F_1}}[\AVal{F_1}]}
3444 \end{ASteps}
3445 \end{ltxex}
3446
3447 In Figure~\ref{fig:csi-ssfs} presenting the example, the boxes
3448 illustrate what is stored at each principal (data at-rest) and the
3449 arrows illustrate the messages sent between the principals (data
3450 in-transit). Each messages in the figure is labeled with the same
3451 labels used in the steps shown above. Figure~\ref{fig:csi-ssfs} is a
3452 recreation of a figure in \cite{andersen2014c} (Figure~4) illustrating
3453 the same example as the one above.
3454
3455
3456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3457 \appendix
3458 \clearpage
3459
3460
3461 \bibliographystyle{splncs04x}
3462 \bibliography{aspen-doc}
3463
3464
3465 \clearpage
3466 \section{Notes}
3467
3468
3469 \subsection{Notes on the notation}
3470 \label{sec:notes-notation}
3471
3472 The notations used for security protocols in different articles and
3473 textbooks is not consistent. {\Aspen} is an attempt to create one
3474 consistent notation. Mostly, for my own usage, but if the notation is
3475 found useful for others, it is a nice bonus. The notation is also
3476 influenced by my background as a programmer and not a mathematician or
3477 a theoretical computer scientist. In the following, the choices of
3478 {\Aspen} will be discussed and compared with similar notations used in
3479 articles and textbooks. This is not an attempt to provide a complete
3480 overview over existing notations and how they compare to {\Aspen}. It
3481 is more a discussion of notations that inspired {\Aspen} and the
3482 choices made in the notation.
3483 \href{mailto:[email protected]?subject=Feedback Aspen}{Feedback}
3484 on the notation are welcome.
3485
3486 Below, {\Aspen} is compared with the notation used in litterateur.
3487 The following sources of different notations are used:
3488 \vspace*{-1.7ex}
3489 \begin{enumerate}
3490 \item {\Aspen} \label{not:aspen}
3491 \item Kerberos: An Authentication Service for Open Network Systems~\cite{steiner1988a} \label{not:kerberos}
3492 \item A formal semantics for protocol narrations~\cite{briais2007a} \label{not:prot-narrations}
3493 \item Security Engineering: A Guide to Building Dependable Distributed Systems~\cite{anderson2020a} \label{not:anderson}
3494 \item Current Approaches to Authentication in Wireless and Mobile Communications Networks~\cite{schafer2001a} \label{not:mob}
3495 \end{enumerate}
3496
3497 \newcolumntype{C}{>{\small}c}
3498 \newcolumntype{Y}{>{\small\centering}X}
3499 {\renewcommand{\arraystretch}{1.3}
3500 \begin{xltabular}{\textwidth}{lYYYYYc}\Xhline{0.5pt}
3501 \textbf{Description}
3502 & \textbf{\ref{not:aspen}}
3503 & \textbf{\ref{not:kerberos}}
3504 & \textbf{\ref{not:prot-narrations}}
3505 & \textbf{\ref{not:anderson}}
3506 & \textbf{\ref{not:mob}}
3507 & $\mathbf{\ast}$ \\\Xhline{0.5pt}
3508 Secret key
3509 & \AKey{A}
3510 & \AKey*{K_A}
3511 & \AKey*{k_A}
3512 & \AKey*{K}
3513 & \AKey*{K_A}
3514 & C \\
3515 Shared key
3516 & \AKey{A,B}
3517 & $-$
3518 & \AKey*{k_{A\;B}}
3519 & $-$
3520 & $-$
3521 & C \\
3522 Session key
3523 & \AKey'{A,B}
3524 & \AKey*{K_{A,\averythinspace B}}
3525 & $-$
3526 & $-$
3527 & $-$
3528 & B \\
3529 Public key
3530 & \AKey+{A}
3531 & $-$
3532 & \AKey*{\textrm{pub}(k_A)}
3533 & \AKey*{KR}
3534 & \AKey*{+K_A}
3535 & A \\
3536 Private key
3537 & \AKey-{A}
3538 & $-$
3539 & \AKey*{\textrm{priv}(k_A)}
3540 & \AKey*{KR^{-1}}
3541 & \AKey*{-K_A}
3542 & A \\
3543 Encrypted
3544 & \AEncrypted*{\AKey*{K}}{m}
3545 & $\AMsg{m}\AKey*{K}$
3546 & $\AMsg{m}_{\AKey*{K}}$
3547 & $\AMsg{m}_{\AKey*{K}}$
3548 & $\AMsg{m}_{\AKey*{K}}$
3549 & C \\
3550 Signed with
3551 & \ASigned*{\AKey*{K}}{m}
3552 & $-$
3553 & $-$
3554 & \AVal{\textrm{sig}_{\AKey*{K}}\{m\}}
3555 & $-$
3556 & A \\
3557 Signed by
3558 & \ASigned!{A}{m}
3559 & $-$
3560 & $-$
3561 & $-$
3562 & \AVal{\APri{A}\,[m]}
3563 & A \\
3564 Send
3565 & \ACsend{A}{B}{m}
3566 & \raisebox{-1.5pt}{%
3567 \begin{mplibcode}
3568 draw fullcircle scaled 10pt shifted (-10pt,0);
3569 label(btex $\scriptstyle \APri{A}$ etex, (-10pt,0));
3570 drawarrow (-5pt,0)--(5pt,0);
3571 label(btex $\scriptstyle \AVal{m}$ etex, (0,3.5pt));
3572 draw fullcircle scaled 10pt shifted (10pt,0);
3573 label(btex $\scriptstyle \APri{B}$ etex, (10pt,0));
3574 \end{mplibcode}}
3575 & $\APri{A}\!\AUnpack\!\APri{B}\!:\!\AVal{m}$
3576 & $\APri{A}\!\ACsends\!\APri{B}\!:\!\AVal{m}$
3577 & $\APri{A}\!\ACsends\!\APri{B}\!:\!\AVal{m}$
3578 & B \\
3579 Hash value
3580 & \AChash{m}
3581 & $-$
3582 & \AVal{\textrm{H}(m)}
3583 & \AVal{\textit{h}(m)}
3584 & \AVal{\textit{H}(m)}
3585 & B \\
3586 MAC
3587 & \AMac*{\AKey*{K}}{m}
3588 & $-$
3589 & $-$
3590 & \AVal{\textrm{MAC}_{\AKey*{K}}(m)}
3591 & $-$
3592 & B \\
3593 HMAC
3594 & \AHmac*{\AKey*{K}}{m}
3595 & $-$
3596 & $-$
3597 & \AVal{\textrm{HMAC}_{\AKey*{K}}(m)}
3598 & $-$
3599 & B \\
3600 Signature
3601 & \ASig*{\AKey*{K}}{m}
3602 & $-$
3603 & $-$
3604 & $-$
3605 & $-$
3606 & A \\
3607 Certificate
3608 & \ACertificate-{CA}{\APri{A},\AKey+{A}}
3609 & $-$
3610 & $-$
3611 & \AVal{\textit{Cert}_{\AKey*{KC^{-1}}}\!(A,\AKey*{KR})}
3612 & \AVal{\textit{Cert}_{\AKey*{-K_{CA}}}\!(\AKey*{+K_A})}
3613 & B \\
3614 Certificate by
3615 & \ACertificate!{CA}{\APri{A},\AKey+{A}}
3616 & $-$
3617 & $-$
3618 & $-$
3619 & \AVal{\APri{CA}\,\langle\langle\,\APri{A}\,\rangle\rangle}
3620 & A \\\Xhline{0.5pt}
3621 \end{xltabular}}\vspace*{-.5\baselineskip}
3622
3623 In the table, the rightmost column classifies the notation in these groups:
3624 \vspace*{-1.7ex}
3625 \begin{itemize}
3626 \item[C:] The notation is commonly used in textbooks and other publications
3627 \item[B:] The notation (or similar) is found in textbooks and other publications
3628 \item[A:] The notation is believed to be unique for {\Aspen} (invented here)
3629 \end{itemize}
3630
3631 % The notation used in the original Kerberos documentation includes
3632 % secret keys (called private keys, but they are not the private key of
3633 % a public-private key pair), session keys and encrypted messages.
3634
3635
3636 \subsection{Notes on the typesetting options}
3637 \label{sec:notes-options}
3638
3639
3640 \subsubsection*{Colors}
3641
3642 The {\latex} package \ACmd{aspen} provides the option \ACmd{color}:
3643
3644 \begin{quote}
3645 \ACmd{\Verb|\usepackage[color]{aspen}|}
3646 \end{quote}
3647
3648 The package provides different color profiles. The default color
3649 profile is called \ACmd{aspen}. Other color profiles are loaded by
3650 assigning a color profile to the \ACmd{color} option. The following
3651 statement will load the same default color profile as the example
3652 above:
3653
3654 \begin{quote}
3655 \ACmd{\Verb|\usepackage[color=aspen]{aspen}|}
3656 \end{quote}
3657
3658 In addition, a few color profiles from
3659 \href{https://pygments.org/}{Pygments} are available:
3660 \ACmd{autumn}, \ACmd{colorful},
3661 \ACmd{default} (the default profile of Pygments),
3662 \ACmd{emacs}, \ACmd{friendly},
3663 %\ACmd{fruity},
3664 \ACmd{gruvboxlight} (called \ACmd{gruvbox-light} in Pygments),
3665 \ACmd{manni}, and \ACmd{staroffice}. Figure \ref{fig:color-profiles}
3666 shows the colors of all the color profiles of the {\Aspen} package.
3667
3668 \makeatletter
3669 \def\mkcolorprofiletbl#1{%
3670 \begin{tabular}[c]{l@{\,\,}cl}
3671 \multicolumn{3}{l}{\textbf{\ACmd{#1}}} \\\hline
3672 Value & \texttt{\small no} & {\csname #1@PY@tok@no\endcsname
3673 \PY@tc{\@Val{1}}, \PY@tc{\@True}} \\
3674 Principle & \texttt{\small na} & {\csname #1@PY@tok@na\endcsname
3675 \PY@tc{\@Pri{A}}} \\
3676 Key & \texttt{\small kt} & {\csname #1@PY@tok@kt\endcsname
3677 \PY@tc{\@Sharedkey{K}{A}}} \\
3678 Nonce & \texttt{\small nn} & {\csname #1@PY@tok@nn\endcsname
3679 \PY@tc{\@Nonce{N_1}}} \\
3680 Timestamp & \texttt{\small nt} & {\csname #1@PY@tok@nt\endcsname
3681 \PY@tc{\@TS{T_s}}} \\
3682 String & \texttt{\small sc} & {\csname #1@PY@tok@sc\endcsname
3683 \PY@tc{\@Str{Hello}}} \\
3684 Variable & \texttt{\small nv} & {\csname #1@PY@tok@nv\endcsname
3685 \PY@tc{\@Var{x}}, \PY@tc{\@Var{y}}, \PY@tc{\@Var{z}}} \\
3686 Function & \texttt{\small nf} & {\csname #1@PY@tok@nf\endcsname
3687 \PY@tc{\@Function{H(\@Val{m})}}} \\
3688 Procedure & \texttt{\small err} & {\csname #1@PY@tok@err\endcsname
3689 \PY@tc{\@Procedure{\underline{Abort}()}}} \\
3690 Code & \texttt{\small go} & {\csname #1@PY@tok@gp\endcsname
3691 \PY@tc{\@Cmd{\textbackslash AKey\{A\}}}} \\
3692 Label & \texttt{\small nl} & {\csname #1@PY@tok@nl\endcsname
3693 \PY@tc{\@Label{M_1}}}
3694 \end{tabular}}%
3695 \makeatother
3696
3697 \begin{figure}
3698 \begin{center}
3699 \mkcolorprofiletbl{aspen}\qquad
3700 \mkcolorprofiletbl{autumn}\qquad
3701 \mkcolorprofiletbl{colorful}\\[.5em]
3702 \mkcolorprofiletbl{default}\qquad
3703 \mkcolorprofiletbl{emacs}\qquad
3704 \mkcolorprofiletbl{friendly}\\[.5em]
3705 % \mkcolorprofiletbl{fruity}\qquad
3706 \mkcolorprofiletbl{gruvboxlight}\qquad
3707 \mkcolorprofiletbl{manni}\qquad
3708 \mkcolorprofiletbl{staroffice}
3709 \end{center}
3710 \caption{The color profiles of the
3711 \texttt{\textcolor{NavyBlue}{aspen}} package}
3712 \label{fig:color-profiles}
3713 \end{figure}
3714
3715
3716 \subsubsection*{Other typesetting options}
3717
3718 \makeatletter
3719 \def\tradpubkey#1{\@tradpubkey{K}{#1}}%
3720 \def\tradprivkey#1{\@tradprivkey{K}{#1}}%
3721 \makeatother
3722
3723 The default way of typesetting the public and the private key of the
3724 public-private key pair of \APri{A} in {\Aspen} is with a $+$
3725 superscript and a $-$ superscript, like \AKey+{A} and \AKey-{A}
3726 respectively. This behavior can be changed with the to package options
3727 \ACmd{tradpubkey} and \ACmd{tradprivkey}:
3728
3729 \begin{quote}
3730 \ACmd{\Verb|\usepackage[tradpubkey,tradprivkey]{aspen}|}
3731 \end{quote}
3732
3733 The result is that the public key of \APri{A} will be typeset
3734 \AKey*{\tradpubkey{A}} and the private key of \APri{A} will be typeset
3735 \AKey*{\tradprivkey{A}}.
3736
3737 The default way of typesetting concatenation in {\Aspen} is with the
3738 binary operator ``$\AConcat$'' (used to typeset concatenation of two
3739 values or strings). The {\Aspen} package provides three options for
3740 typesetting concatenation: ``$\ADotconcat$'', ``$\ADblbarconcat$'', or
3741 ``$\APlusconcat$''. This can be changed by passing a value to the
3742 \ACmd{concat} option of the package. The valid values are
3743 \ACmd{dot}, \ACmd{dblbar}, and \ACmd{plus}. The
3744 default is ``$\AConcat$''. In this example ``$\ADblbarconcat$'' is
3745 chosen to be the concatenation operator:
3746
3747 \begin{quote}
3748 \ACmd{\Verb|\usepackage[concat=dblbar]{aspen}|}
3749 \end{quote}
3750
3751 \clearpage
3752 \subsection{Notation example listing}
3753 \label{sec:ex-code}
3754
3755 In this Section, all notation examples with their {\latex} code is
3756 listed without comments and any explanation.
3757
3758 \immediate\closeout\locfile
3759 \IfFileExists{\jobname.loc}{\input{\jobname.loc}}{}
3760
3761 \end{document}