From f77bfcccafa6a81bfec912643186f147865d7a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Tue, 2 Feb 2021 11:49:26 +0100 Subject: intro to elliptic curve crypto --- buch/chapters/90-crypto/images/Makefile | 13 ++++ buch/chapters/90-crypto/images/dh.pdf | Bin 0 -> 27689 bytes buch/chapters/90-crypto/images/dh.tex | 53 +++++++++++++++ buch/chapters/90-crypto/images/elliptic.pdf | Bin 0 -> 21278 bytes buch/chapters/90-crypto/images/elliptic.tex | 97 ++++++++++++++++++++++++++++ 5 files changed, 163 insertions(+) create mode 100644 buch/chapters/90-crypto/images/Makefile create mode 100644 buch/chapters/90-crypto/images/dh.pdf create mode 100644 buch/chapters/90-crypto/images/dh.tex create mode 100644 buch/chapters/90-crypto/images/elliptic.pdf create mode 100644 buch/chapters/90-crypto/images/elliptic.tex (limited to 'buch/chapters/90-crypto/images') diff --git a/buch/chapters/90-crypto/images/Makefile b/buch/chapters/90-crypto/images/Makefile new file mode 100644 index 0000000..9480163 --- /dev/null +++ b/buch/chapters/90-crypto/images/Makefile @@ -0,0 +1,13 @@ +# +# Makefile -- build images for crypto chapter +# +# (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule +# +all: dh.pdf elliptic.pdf + +dh.pdf: dh.tex + pdflatex dh.tex + +elliptic.pdf: elliptic.tex + pdflatex elliptic.tex + diff --git a/buch/chapters/90-crypto/images/dh.pdf b/buch/chapters/90-crypto/images/dh.pdf new file mode 100644 index 0000000..67b95a5 Binary files /dev/null and b/buch/chapters/90-crypto/images/dh.pdf differ diff --git a/buch/chapters/90-crypto/images/dh.tex b/buch/chapters/90-crypto/images/dh.tex new file mode 100644 index 0000000..1faa830 --- /dev/null +++ b/buch/chapters/90-crypto/images/dh.tex @@ -0,0 +1,53 @@ +% +% dh.tex -- diffie hellmann key exchange +% +% (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule +% +\documentclass[tikz]{standalone} +\usepackage{amsmath} +\usepackage{times} +\usepackage{txfonts} +\usepackage{pgfplots} +\usepackage{csvsimple} +\usetikzlibrary{arrows,intersections,math,calc,hobby} +\begin{document} +\definecolor{darkgreen}{rgb}{0,0.6,0} +\def\skala{1} +\begin{tikzpicture}[>=latex,thick,scale=\skala] +\def\l{2.5} +\fill[color=blue!20] (-7,-6.5) rectangle (7,0.5); +\fill[color=red!20] (-\l,-6.5) rectangle (\l,0.501); +\node[color=red] at (0,-1.5) {öffentliches Netzwerk}; +\node[color=blue] at (-7,0.2) [right] {privat}; +\node[color=blue] at (7,0.2) [left] {privat}; +\coordinate (A) at (-\l,-2.5); +\coordinate (C) at (\l,-5.5); +\coordinate (B) at (\l,-2.5); +\coordinate (D) at (-\l,-5.5); +\node at (0,0) {$p\in\mathbb{N},g\in\mathbb{F}_p$ aushandeln}; +\fill[color=white] (-\l,-0.7) circle[radius=0.3]; +\draw (-\l,-0.7) circle[radius=0.3]; +\fill[color=white] (\l,-0.7) circle[radius=0.3]; +\draw (\l,-0.7) circle[radius=0.3]; +\node at (-\l,-0.7) {$A$}; +\node at (\l,-0.7) {$B$}; +\node at (-\l,-1.5) [left] {$a$ auswählen}; +\node at (-\l,-2.0) [left] {$x=g^a\in\mathbb{F}_p$ auswählen}; +\node at (\l,-1.5) [right] {$b$ auswählen}; +\node at (\l,-2.0) [right] {$y=g^b\in\mathbb{F}_p$ auswählen}; +\draw[->] (-\l,-1) -- (-\l,-6); +\draw[->] (\l,-1) -- (\l,-6); +\draw[->] (A) -- (C); +\draw[->] (B) -- (D); +\fill (A) circle[radius=0.08]; +\fill (B) circle[radius=0.08]; +\node at ($0.8*(A)+0.2*(C)$) [above right] {$x=g^a$}; +\node at ($0.8*(B)+0.2*(D)$) [above left] {$y=g^b$}; +\node at (-\l,-5.5) [left] {$s=g^{ab}=y^a\in\mathbb{F}_p$ ausrechnen}; +\node at (\l,-5.5) [right] {$s=g^{ab}=x^b\in\mathbb{F}_p$ ausrechnen}; +\fill[rounded corners=0.3cm,color=darkgreen!20] ({-\l-1},-7) rectangle ({\l+1},-6); +\draw[rounded corners=0.3cm] ({-\l-1},-7) rectangle ({\l+1},-6); +\node at (0,-6.5) {$A$ und $B$ haben den gemeinsamen Schlüssel $s$}; +\end{tikzpicture} +\end{document} + diff --git a/buch/chapters/90-crypto/images/elliptic.pdf b/buch/chapters/90-crypto/images/elliptic.pdf new file mode 100644 index 0000000..d408f1e Binary files /dev/null and b/buch/chapters/90-crypto/images/elliptic.pdf differ diff --git a/buch/chapters/90-crypto/images/elliptic.tex b/buch/chapters/90-crypto/images/elliptic.tex new file mode 100644 index 0000000..f0843cd --- /dev/null +++ b/buch/chapters/90-crypto/images/elliptic.tex @@ -0,0 +1,97 @@ +% +% elliptic.tex -- elliptic curve +% +% (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule +% +\documentclass[tikz]{standalone} +\usepackage{amsmath} +\usepackage{times} +\usepackage{txfonts} +\usepackage{pgfplots} +\usepackage{csvsimple} +\usetikzlibrary{arrows,intersections,math} +\begin{document} +\def\skala{4} +\begin{tikzpicture}[>=latex,thick,scale=\skala] + +\def\uone{-1.1} +\def\utwo{0.3} +\pgfmathparse{-(\uone+\utwo)} +\xdef\uthree{\pgfmathresult} +\xdef\r{0.017} + +\def\gone{-1.05} +\def\gtwo{0.2} +\def\gthree{1.105} + +\pgfmathparse{-sqrt((\gone-\uone)*(\gone-\utwo)*(\gone-\uthree))} +\xdef\yone{\pgfmathresult} +\pgfmathparse{sqrt((\gtwo-\uone)*(\gtwo-\utwo)*(\gtwo-\uthree))} +\xdef\ytwo{\pgfmathresult} +\pgfmathparse{sqrt((\gthree-\uone)*(\gthree-\utwo)*(\gthree-\uthree))} +\xdef\ythree{\pgfmathresult} + +\begin{scope} +\clip (-1.5,-1.5) rectangle (1.5,1.5); +\draw[color=blue] + ({\gone-(\gtwo-\gone)},{\yone-(\ytwo-\yone)}) + -- + ({\gone+2*(\gtwo-\gone)},{\yone+2*(\ytwo-\yone)}); +\draw[color=blue] (\gthree,-2) -- (\gthree,2); +\end{scope} + +\draw[line width=1.4pt,color=red] + (\uone,0) -- + plot[domain={\uone+0.001}:{\utwo-0.001},samples=100] + (\x,{sqrt((\x-\uone)*(\x-\utwo)*(\x-\uthree))}) + -- (\utwo,0); +\draw[line width=1.4pt,color=red] + (\uone,0) -- + plot[domain={\uone+0.001}:{\utwo-0.001},samples=100] + (\x,{-sqrt((\x-\uone)*(\x-\utwo)*(\x-\uthree))}) + -- (\utwo,0); + +\draw[line width=1.4pt,color=red] + (\uthree,0) -- + plot[domain={\uthree}:1.5,samples=100] + (\x,{sqrt((\x-\uone)*(\x-\utwo)*(\x-\uthree))}) ; +\draw[line width=1.4pt,color=red] + (\uthree,0) -- + plot[domain={\uthree}:1.5,samples=100] + (\x,{-sqrt((\x-\uone)*(\x-\utwo)*(\x-\uthree))}) ; + +\draw[->] (-1.5,0) -- (1.5,0) coordinate[label={$u$}]; +\draw[->] (0,-1.5) -- (0,1.5) coordinate[label={right:$v$}]; +\node at (0,0) [below left] {$O$}; + +\fill[color=white] (\uone,0) circle[radius=\r]; +\draw (\uone,0) circle[radius=\r]; +\node at ({\uone+0.01},-0.01) [above left] {$u_1$}; + +\fill[color=white] (\utwo,0) circle[radius=\r]; +\draw (\utwo,0) circle[radius=\r]; +\node at ({\utwo-0.01},-0.01) [above right] {$u_2$}; + +\fill[color=white] (\uthree,0) circle[radius=\r]; +\draw (\uthree,0) circle[radius=\r]; +\node at ({\uthree+0.01},-0.01) [above left] {$u_3$}; + +\fill[color=white] (\gone,\yone) circle[radius=\r]; +\draw[color=blue] (\gone,\yone) circle[radius=\r]; + +\fill[color=white] (\gtwo,\ytwo) circle[radius=\r]; +\draw[color=blue] (\gtwo,\ytwo) circle[radius=\r]; + +\fill[color=white] (\gthree,\ythree) circle[radius=\r]; +\draw[color=blue] (\gthree,\ythree) circle[radius=\r]; +\fill[color=white] (\gthree,-\ythree) circle[radius=\r]; +\draw[color=blue] (\gthree,-\ythree) circle[radius=\r]; + +\node[color=blue] at (\gone,{\yone-0.03}) [above left] {$g_1$}; +\node[color=blue] at ({\gtwo+0.03},{\ytwo+0.01}) [above] {$g_2$}; +\node[color=blue] at (\gthree,{\ythree+0.02}) [below right] {$g_3$}; +\node[color=blue] at (\gthree,{-\ythree+0.03}) [below left] {$g_1g_2=g_3^{-1}$}; + +\end{tikzpicture} +\end{document} + -- cgit v1.2.1