我寻找一种优雅的方法/想法(不一定是代码)来在 beamer 中将下图绘制为动画;它足够灵活,可以用于将来的进一步更改和类似的 MSC。
答案1
我今天会进行微调
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit,angles,calc,intersections,quotes,positioning, shapes.misc, arrows}
\begin{document}\hspace{-4cm}
\begin{tikzpicture}[
every label/.style={text=red},
point/.style={circle,
inner sep=0pt,
minimum size=2pt,
fill=red},
node distance=5mm,
terminal/.style={
% The shape:
rectangle,
minimum height=8mm,
minimum width=30mm,
inner sep=4pt,
rounded corners=2mm,
% The rest
very thick,
draw=black!50,
top color=white,
bottom color=black!20,
text width=25mm,
align=center,
font=\ttfamily,
font=\scriptsize}
]
\matrix[
row sep=7mm,
column sep=10mm]{
%first row
\node (digit1) [terminal] {Intel Quoting Enclave};&
\node (digit2) [terminal] {SGX Application Enclave};&
\node (digit3) [terminal] {SGX Application};&
\node (digit4) [terminal] {Remote Challenger};&
\node (digit5) [terminal] {Intel Attestation Service(IAS)};\\
%second row
&&&&\\
%third row
\node[point] (p11) {};&\node[point] (p21) {};&\node[point] (p31) {};&\node[point]
(p41) {};&\node[point] (p51) {};\\
%fourth row
\node[point] (p12) {};&\node[point] (p22) {};&\node[point] (p32) {};&\node[point]
(p42) {};&\node[point] (p52) {};\\
};
\node [draw=red,
dash pattern={on 7pt off 2pt on 1pt off 3pt},
name=temp1,
fit={(digit1) (digit2) (digit3)},
rounded corners=1mm,
label=90:{\scriptsize User Platform/ Local Attestation},
] {};
\coordinate (temp2) at ($(digit1)+(0,-16pt)$);
\coordinate (temp3) at ($(digit1)+(0,-16cm)$);
\draw [draw=blue,
dash pattern={on 7pt off 2pt on 1pt off 3pt},
]
(temp2)--(temp3);
\coordinate (temp4) at ($(digit2)+(0,-16pt)$);
\coordinate (temp5) at ($(digit2)+(0,-16cm)$);
\draw [draw=blue,
dash pattern={on 7pt off 2pt on 1pt off 3pt},
]
(temp4)--(temp5);
\coordinate (temp6) at ($(digit3)+(0,-16pt)$);
\coordinate (temp7) at ($(digit3)+(0,-16cm)$);
\draw [draw=blue,
dash pattern={on 7pt off 2pt on 1pt off 3pt},
]
(temp6)--(temp7);
\coordinate (temp8) at ($(digit4)+(0,-12pt)$);
\coordinate (temp9) at ($(digit4)+(0,-16cm)$);
\draw [draw=blue,
dash pattern={on 7pt off 2pt on 1pt off 3pt},
]
(temp8)--(temp9);
\coordinate (temp10) at ($(digit5)+(0,-12pt)$);
\coordinate (temp11) at ($(digit5)+(0,-16cm)$);
\draw [draw=blue,
dash pattern={on 7pt off 2pt on 1pt off 3pt},
]
(temp10)--(temp11);
\draw[->,
blue,
thick,
>=stealth
]
(p41)--node[above,
yshift=-4pt,
label=left:\textcolor{red}{\scriptsize 1},
]
()
{\scriptsize 1 challenge (inc. nonce)}
(p31);
\draw[->,
blue,
thick,
>=stealth]
(p32)--node[above,
yshift=-4pt,
pos=0.5
]
(){\scriptsize 2 MRENCLAVE(QE)}
node[below,
yshift=2pt,
pos=0.5
]
() {\scriptsize challenge (inc. nonce)}
(p22);
\end{tikzpicture}
\end{document}
编辑1
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit,angles,calc,intersections,quotes,positioning,
shapes.misc, arrows}
\begin{document}\hspace{-5cm}
\begin{tikzpicture}[
every label/.style={text=blue},
point/.style={circle,
inner sep=0pt,
minimum size=2pt,
fill=red},
dot/.style={circle,
inner sep=3pt,
minimum size=5pt,
fill=blue},
node distance=5mm,
terminal/.style={
% The shape:
rectangle,
minimum height=8mm,
minimum width=30mm,
inner sep=4pt,
rounded corners=2mm,
% The rest
very thick,
draw=black!50,
top color=white,
bottom color=black!20,
text width=25mm,
align=center,
font=\ttfamily,
font=\scriptsize}
]
\matrix[
row sep=7mm,
column sep=10mm]{
%first row
\node (digit1) [terminal] {Intel Quoting Enclave};&
\node (digit2) [terminal] {SGX Application Enclave};&
\node (digit3) [terminal] {SGX Application};&
\node (digit4) [terminal] {Remote Challenger};&
\node (digit5) [terminal] {Intel Attestation Service(IAS)};\\
%second row
&&&&\\
%third row
\node[point] (p11) {};&\node[point] (p21) {};&\node[point] (p31) {};&\node[point] (p41) {};&\node[point] (p51) {};\\
%fourth row
\node[point] (p12) {};&\node[point] (p22) {};&\node[point] (p32) {};&\node[point] (p42) {};&\node[point] (p52) {};\\
%fifth row
&&&&\\
%sixth row
&&&&\\
%seventh row
&\node[dot, label={[align=left]right:\scriptsize Create Report \\\scriptsize containing MAC}] (dot1) {};&&&\\
%eigth row
\node[point] (p13) {};&\node[point] (p23) {};&\node[point] (p33) {};&\node[point] (p43) {};&\node[point] (p53) {};\\
%ninth row
\node[point] (p14) {};&\node[point] (p24) {};&\node[point] (p34) {};&\node[point] (p44) {};&\node[point] (p54) {};\\
%tenth row
\node[dot, label={[align=left]right:\scriptsize Verify Report}] (dot2) {};&&&&\\
%eleventh row
\node[dot, label={[align=left]right:\scriptsize Sign with EPID \\ \scriptsize Private Key}] (dot3) {};&&&&\\
%twelthth row
\node[point] (p15) {};&\node[point] (p25) {};&\node[point] (p35) {};&\node[point] (p45) {};&\node[point] (p55) {};\\
%thirteenth row
\node[point] (p16) {};&\node[point] (p26) {};&\node[point] (p36) {};&\node[point] (p46) {};&\node[point] (p56) {};\\
%fourteenth row
&&&&\\
%fifteenth row
\node[point] (p17) {};&\node[point] (p27) {};&\node[point] (p37) {};&\node[point] (p47) {};&\node[point] (p57) {};\\
};
\node [draw=red,
dash pattern={on 7pt off 2pt on 1pt off 3pt},
name=temp1,
fit={(digit1) (digit2) (digit3)},
rounded corners=1mm,
label=90:{\scriptsize User Platform/ Local Attestation},
] {};
\coordinate (temp2) at ($(digit1)+(0,-16pt)$);
\coordinate (temp3) at ($(digit1)+(0,-16cm)$);
\draw [draw=blue,
dash pattern={on 7pt off 2pt on 1pt off 3pt},
]
(temp2)--(temp3);
\coordinate (temp4) at ($(digit2)+(0,-16pt)$);
\coordinate (temp5) at ($(digit2)+(0,-16cm)$);
\draw [draw=blue,
dash pattern={on 7pt off 2pt on 1pt off 3pt},
]
(temp4)--(temp5);
\coordinate (temp6) at ($(digit3)+(0,-16pt)$);
\coordinate (temp7) at ($(digit3)+(0,-16cm)$);
\draw [draw=blue,
dash pattern={on 7pt off 2pt on 1pt off 3pt},
]
(temp6)--(temp7);
\coordinate (temp8) at ($(digit4)+(0,-12pt)$);
\coordinate (temp9) at ($(digit4)+(0,-16cm)$);
\draw [draw=blue,
dash pattern={on 7pt off 2pt on 1pt off 3pt},
]
(temp8)--(temp9);
\coordinate (temp10) at ($(digit5)+(0,-12pt)$);
\coordinate (temp11) at ($(digit5)+(0,-16cm)$);
\draw [draw=blue,
dash pattern={on 7pt off 2pt on 1pt off 3pt},
]
(temp10)--(temp11);
\draw[->,
blue,
thick,
>=stealth
]
(p41)--node[above,
yshift=-4pt,
% label=left:\textcolor{red}{\scriptsize 1},
]
()
{\scriptsize 1 challenge (inc. nonce)}
(p31);
\draw[->,
blue,
thick,
>=stealth]
(p32)--node[above,
yshift=-4pt,
pos=0.5
]
(){\scriptsize 2 MRENCLAVE(QE)}
node[below,
yshift=2pt,
pos=0.5
]
() {\scriptsize challenge (inc. nonce)}
(p22);
\draw[->,
blue,
thick,
>=stealth]
(p23)--node[above,
yshift=-4pt,
pos=0.5
]
(){\scriptsize 3 Report}
% node[below,
% yshift=2pt,
% pos=0.5
% ]
% () {\scriptsize challenge (inc. nonce)}
(p33);
\draw[->,
blue,
thick,
>=stealth]
(p34)--node[above,fill=white,
yshift=0pt,
pos=0.5
]
(){\scriptsize 4 Report}
(p14);
\draw[->,
blue,
thick,
>=stealth]
(p15)--node[above,fill=white,
yshift=0pt,
pos=0.5
]
(){\scriptsize 5 Quote, CMAC}
(p35);
\draw[->,
blue,
thick,
>=stealth]
(p36)--node[above,fill=white,
yshift=0pt,
pos=0.5
]
(){\scriptsize 6 Quote, CMAC}
(p46);
\draw[<->,
blue,
thick,
>=stealth]
(p47)--node[above,fill=white,align=left,
yshift=0pt,
pos=0.5
]
(){\scriptsize 7 Verify sign over Quote\\ \scriptsize Verify enclave status}
(p57);
\end{tikzpicture}
\end{document}
最终编辑
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit,angles,calc,intersections,quotes,positioning, shapes.misc, arrows}
\newcommand*\crc[1]{
\scriptsize \raisebox{2pt}{\textcircled{\raisebox{-.9pt} {#1}}}}
\begin{document}\hspace{-5cm}
\begin{tikzpicture}[
every label/.style={text=black},
every node/.style={font=\scriptsize},
arw/.style={->,black,thick,>=stealth},
abov/.style={above,yshift=-4pt,pos=0.5},
point/.style={circle,inner sep=0pt,minimum size=2pt,fill=black},
dot/.style={circle,inner sep=3pt,minimum size=1pt,fill=black},
node distance=5mm,
terminal/.style={rectangle,minimum height=8mm,minimum width=30mm,
inner sep=4pt,rounded corners=2mm,very thick,
draw=black!90,top color=white,bottom color=black!20,
text width=25mm,align=center,
font=\ttfamily, font=\scriptsize},
]
\matrix[
row sep=7mm,
column sep=10mm]{
%first row
\node (digit1) [terminal] {Intel Quoting Enclave};&
\node (digit2) [terminal] {SGX Application Enclave};&
\node (digit3) [terminal] {SGX Application};&
\node (digit4) [terminal] {Remote Challenger};&
\node (digit5) [terminal] {Intel Attestation Service(IAS)};\\
%second row
&&&&\\
%third row
\node[point] (p11) {};&\node[point] (p21) {};&\node[point] (p31) {};&\node[point] (p41) {};&\node[point] (p51) {};\\
%fourth row
\node[point] (p12) {};&\node[point] (p22) {};&\node[point] (p32) {};&\node[point] (p42) {};&\node[point] (p52) {};\\
%fifth row
&&&&\\
%sixth row
&&&&\\
%seventh row
&\node[dot, label={[align=left]right:Create Report \\containing MAC}] (dot1) {};&&&\\
%eigth row
\node[point] (p13) {};&\node[point] (p23) {};&\node[point] (p33) {};&\node[point] (p43) {};&\node[point] (p53) {};\\
%ninth row
\node[point] (p14) {};&\node[point] (p24) {};&\node[point] (p34) {};&\node[point] (p44) {};&\node[point] (p54) {};\\
%tenth row
\node[dot, label={[align=left]right: Verify Report}] (dot2) {};&&&&\\
%eleventh row
\node[dot, label={[align=left]right: Sign with EPID \\ Private Key}] (dot3) {};&&&&\\
%twelthth row
\node[point] (p15) {};&\node[point] (p25) {};&\node[point] (p35) {};&\node[point] (p45) {};&\node[point] (p55) {};\\
%thirteenth row
\node[point] (p16) {};&\node[point] (p26) {};&\node[point] (p36) {};&\node[point] (p46) {};&\node[point] (p56) {};\\
%fourteenth row
&&&&\\
%fifteenth row
\node[point] (p17) {};&\node[point] (p27) {};&\node[point] (p37) {};&\node[point] (p47) {};&\node[point] (p57) {};\\
};
\node [draw=black,dash pattern={on 7pt off 2pt on 1pt off 3pt},thick,
name=temp1,fit={(digit1) (digit2) (digit3)},
rounded corners=1mm,label=90:{ User Platform/ Local Attestation},
] {};
\foreach \x[count=\xi] in {2,4,6}{
\foreach \y in {3,5,7}{
\coordinate (temp\x) at ($(digit\xi)+(0,-16pt)$);
\coordinate (temp\y) at ($(digit\xi)+(0,-16cm)$);
\draw [draw=black,thick,
dash pattern={on 7pt off 2pt on 1pt off 3pt},
]
(temp\x)--(temp\y);
}}
\foreach \x[count=\xi from 4] in {8,10}{
\foreach \y in {9,11}{
\coordinate (temp\x) at ($(digit\xi)+(0,-12pt)$);
\coordinate (temp\y) at ($(digit\xi)+(0,-16cm)$);
\draw [draw=black,thick,
dash pattern={on 7pt off 2pt on 1pt off 3pt},
]
(temp\x)--(temp\y);
}}
\draw[arw] (p41)--node[abov,yshift=-1pt,]()
{\crc{1}\ challenge (inc. nonce)}(p31);
\draw[arw] (p32)--node[abov,]
(){\crc{2}\ MRENCLAVE(QE)}
node[below,yshift=2pt,pos=0.5]
() { challenge (inc. nonce)} (p22);
\draw[arw] (p23)--node[abov,]
(){\crc{3}\ Report} (p33);
\draw[arw](p34)--node[abov,fill=white,yshift=4pt,]
(){\crc{4}\ Report}(p14);
\draw[arw] (p15)--node[abov,fill=white,yshift=4pt,]
(){\crc{5}\ Quote, CMAC}(p35);
\draw[arw] (p36)--node[abov,fill=white,yshift=4pt,]
(){\crc{6}\ Quote, CMAC}(p46);
\draw[arw,<->] (p47)--node[abov,fill=white,align=left,yshift=4pt,]
(){\crc{7}\ Verify sign over Quote\\ Verify enclave status}(p57);
\end{tikzpicture}
\end{document}