crypto: rsa
This commit is contained in:
14
crypto.bib
14
crypto.bib
@@ -65,4 +65,18 @@
|
|||||||
year = "2026",
|
year = "2026",
|
||||||
url = "https://en.wikipedia.org/w/index.php?title=Galois/Counter_Mode&oldid=1352962810",
|
url = "https://en.wikipedia.org/w/index.php?title=Galois/Counter_Mode&oldid=1352962810",
|
||||||
note = "[Online; accessed 10-May-2026]"
|
note = "[Online; accessed 10-May-2026]"
|
||||||
|
}
|
||||||
|
@book{rijndael,
|
||||||
|
title={The design of Rijndael},
|
||||||
|
author={Daemen, Joan and Rijmen, Vincent},
|
||||||
|
volume={2},
|
||||||
|
year={2002},
|
||||||
|
publisher={Springer}
|
||||||
|
}
|
||||||
|
@misc{ enwiki:aes,
|
||||||
|
author = "{Wikipedia contributors}",
|
||||||
|
title = "Advanced Encryption Standard --- {Wikipedia}{,} The Free Encyclopedia",
|
||||||
|
year = "2026",
|
||||||
|
url = "https://en.wikipedia.org/w/index.php?title=Advanced_Encryption_Standard&oldid=1358692329",
|
||||||
|
note = "[Online; accessed 28-June-2026]"
|
||||||
}
|
}
|
||||||
59
crypto.tex
59
crypto.tex
@@ -19,6 +19,8 @@
|
|||||||
\usepackage{glossaries}
|
\usepackage{glossaries}
|
||||||
|
|
||||||
\newcommand{\ub}[2]{\underbrace{\text{#1}}_{\text{#2}}}
|
\newcommand{\ub}[2]{\underbrace{\text{#1}}_{\text{#2}}}
|
||||||
|
\newcommand{\secret}[1]{\textcolor{red}{#1}}
|
||||||
|
\newcommand{\public}[1]{\textcolor{blue}{#1}}
|
||||||
\makeglossaries
|
\makeglossaries
|
||||||
\newacronym{DES}{DES}{Data Encryption Standard}
|
\newacronym{DES}{DES}{Data Encryption Standard}
|
||||||
\newacronym{AES}{AES}{Advanced Encryption Standard}
|
\newacronym{AES}{AES}{Advanced Encryption Standard}
|
||||||
@@ -44,7 +46,7 @@ Much later, with the widespread adoption of the internet, the need for several c
|
|||||||
Due to its intended use as a trusted research network (ARPANET),
|
Due to its intended use as a trusted research network (ARPANET),
|
||||||
almost none of the original protocols were 'secure' in any sense of the word.
|
almost none of the original protocols were 'secure' in any sense of the word.
|
||||||
|
|
||||||
Most notably still today is SMTP, the \textit{Simple Mail Transfer Protocol}, used to send email to servers.
|
One of the most notable examples still today is SMTP, the \textit{Simple Mail Transfer Protocol}, used to send email to servers.
|
||||||
In its original implementation, it allowed attackers to intercept emails in transit to read and modify them
|
In its original implementation, it allowed attackers to intercept emails in transit to read and modify them
|
||||||
and even spoof the sender address to impersonate others.
|
and even spoof the sender address to impersonate others.
|
||||||
SMTP today is secured using a combination of mitigations for these attacks, such as STARTTLS, SPF, DKIM and DMARC,
|
SMTP today is secured using a combination of mitigations for these attacks, such as STARTTLS, SPF, DKIM and DMARC,
|
||||||
@@ -165,7 +167,8 @@ diffusion through permutation boxes (P-box).
|
|||||||
The \acrfull{DES} is a symmetric (or private-key) cipher developed in the 1970s at IBM as an archetypal block cipher.
|
The \acrfull{DES} is a symmetric (or private-key) cipher developed in the 1970s at IBM as an archetypal block cipher.
|
||||||
It takes in a block of 64 bits and transforms it to a ciphertext using a key of equal length.
|
It takes in a block of 64 bits and transforms it to a ciphertext using a key of equal length.
|
||||||
Despite suspicions of backdoors engineered into the algorithm due to the involvement of the NSA in the development of \acrshort{DES},
|
Despite suspicions of backdoors engineered into the algorithm due to the involvement of the NSA in the development of \acrshort{DES},
|
||||||
it was approved as a federal standard in the USA in 1976 and only retired due to its short key length,
|
only minor weaknesses were found.
|
||||||
|
It was approved as a federal standard in the USA in 1976 and only retired due to its short key length,
|
||||||
for which the NSA however was directly responsible as well.
|
for which the NSA however was directly responsible as well.
|
||||||
Nevertheless, it sparked public and scientific interest in the research of encryption algorithms, producing a large body of publications.
|
Nevertheless, it sparked public and scientific interest in the research of encryption algorithms, producing a large body of publications.
|
||||||
Extended versions of \acrshort{DES} such as Triple-DES (or 3DES) are still in use in embedded applications (chipcards).
|
Extended versions of \acrshort{DES} such as Triple-DES (or 3DES) are still in use in embedded applications (chipcards).
|
||||||
@@ -187,7 +190,21 @@ they naturally lend themselves to hardware implementations.
|
|||||||
|
|
||||||
\subsection{AES} %TODO
|
\subsection{AES} %TODO
|
||||||
The \acrfull{AES} superseded \acrshort{DES} in 2001 after an official selection process.
|
The \acrfull{AES} superseded \acrshort{DES} in 2001 after an official selection process.
|
||||||
Unlike its predecessor, it does not use a Feistel network.
|
Standardized under \verb|ISO 18033-3|, \acrshort{AES} supports key lengths of 128, 192 and 256 bits,
|
||||||
|
the underlying algorithm supports any key length that is a multiple of 32.
|
||||||
|
Developed as Rijndael, contrary to its predecessor it does not employ a Feistel network,
|
||||||
|
though it does use the familiar pattern of substitution and permutation boxes.
|
||||||
|
|
||||||
|
The key size used also specifies the number of rounds, as a round key is derived for each transformation round.
|
||||||
|
\begin{enumerate}
|
||||||
|
\item
|
||||||
|
\end{enumerate}
|
||||||
|
|
||||||
|
|
||||||
|
Though minor theoretical attacks exist, such as reducing the key search space by a factor of 4,
|
||||||
|
the algorithm can be considered secure even to quantum-computing supported attacks halving the key space,
|
||||||
|
as simply increasing the key length is a viable mitigation.
|
||||||
|
\cite{rijndael,enwiki:aes}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -198,35 +215,53 @@ Symmetric encryption however historically suffered from a key exchange problem;
|
|||||||
because the same key is used for encryption and decryption, a secure channel is required to agree on a common key.
|
because the same key is used for encryption and decryption, a secure channel is required to agree on a common key.
|
||||||
This chicken-and-egg problem can be solved in two major ways, both typically relying on the mathematical theory of
|
This chicken-and-egg problem can be solved in two major ways, both typically relying on the mathematical theory of
|
||||||
\textbf{galois fields}, employing either \textit{modular arithmetic} or \textit{elliptic curves}.
|
\textbf{galois fields}, employing either \textit{modular arithmetic} or \textit{elliptic curves}.
|
||||||
|
%NOTE section on galois fields/ modulo/elliptic curve?
|
||||||
|
|
||||||
\paragraph{The Difie-Hellman Key Exchange} is an algorithm allowing the communication parties to establish a shared secret using
|
\paragraph{The Difie-Hellman Key Exchange} is an algorithm allowing the communication parties to establish a shared secret using
|
||||||
properties of the discrete logarithm.
|
properties of the discrete logarithm.
|
||||||
|
The algorithm is implemented by the following steps, with \public{public values} in blue and \secret{secret values} in red.
|
||||||
|
\begin{enumerate}
|
||||||
|
\item First, Alice and Bob publicly agree on prime numbers \public{$p$} and \public{$g$}.
|
||||||
|
\item Alice (and Bob, each on their own) choose their secret keys \secret{$a$} (\secret{$b$})
|
||||||
|
\item They then exchange
|
||||||
|
$\public{A} = \public{g}^{\secret{a}} \mod \public{p}$ and $\public{B} = \public{g}^{\secret{b}} \mod \public{p}$, respectively.
|
||||||
|
\item Both arrive at the same key $\secret{s}$ by computing $\secret{s} = \public{B}^{\secret{a}} \mod \public{p} =
|
||||||
|
\public{A}^{\secret{b}} \mod \public{p} $.
|
||||||
|
\end{enumerate}
|
||||||
|
|
||||||
Both methods however are still vulnerable to a \acrfull{mitm}, thus also requiring a trusted \acrfull{CA} for authentication. \cite{enwiki:mitm}
|
Both methods however are still vulnerable to a \acrfull{mitm}, thus also requiring a trusted \acrfull{CA} for authentication. \cite{enwiki:mitm}
|
||||||
|
|
||||||
\subsection{RSA}
|
\subsection{RSA}\label{sec:rsa}
|
||||||
\acrfull{RSA} is the first asymmetric (or public-key) cryptographic algorithm and can thus be used for encryption and digital signing.
|
\acrfull{RSA} is the first asymmetric (or public-key) cryptographic algorithm and can thus be used for encryption and digital signing.
|
||||||
It was named after its eponymous inventors in \citeyear{rsa} after trying to disprove the existence of \textit{trapdoor functions},
|
It was named after its eponymous inventors in \citeyear{rsa} after trying to disprove the existence of \textit{trapdoor functions},
|
||||||
a concept introduced by \citeauthor{diffiehellman} in their appropriately named pivotal paper \citetitle{diffiehellman}.
|
a concept introduced by \citeauthor{diffiehellman} in their appropriately named pivotal paper \citetitle{diffiehellman} \cite{diffiehellman}.
|
||||||
|
|
||||||
|
|
||||||
The algorithm they came up with relies on modular arithmetic, which remains the most popular class of asymmetric cryptography.
|
The algorithm they came up with relies on modular arithmetic, which remains the most popular class of asymmetric cryptography.
|
||||||
|
|
||||||
\begin{enumerate}
|
\begin{enumerate}
|
||||||
\item Choose randomly and stochastically independet primes $p,q$ of similar size so that
|
\item Choose randomly and stochastically independet primes $\secret{p,q}$ of similar size so that
|
||||||
\newline$0.1 < | \log_2 p - \log_2 q | < 30 $.
|
\newline$0.1 < | \log_2 p - \log_2 q | < 30 $.
|
||||||
\item Calculate $ N= p \cdot q $
|
\item Calculate $ \public{N}= \secret{p} \cdot \secret{q} $
|
||||||
\item Compute Euler's totient function of $ \varphi (N) = (p-1) \cdot (q-1)$ which is kept secret.
|
\item Compute Euler's totient function of $ \secret{\varphi (N)} = (\secret{p}-1) \cdot (\secret{q}-1)$ which is kept secret.
|
||||||
\item Choose an integer $e$ so that $ 1 < e < \varphi (N) $ and $\gcd(e, \varphi(N)) =1$, i.e. $e$ and $\varphi(N)$
|
\item Choose an integer $\public{e}$ so that $ 1 < \public{e} < \secret{\varphi (N)} $ and $\gcd(\public{e}, \secret{\varphi(N)}) =1$,
|
||||||
are coprime. The most common choice here is $ e= 2^(16) +1 = 65537 $, as $e$ is released as part of the public key.
|
i.e. $\public{e}$ and $\secret{\varphi(N)}$ are coprime.
|
||||||
\item For the private key, % TODO
|
The most common choice here is $ e= 2^(16) +1 = 65537 $, as $\public{e}$ is released as part of the public key.
|
||||||
|
\item Calculate $ \secret{d} \equiv \public{e}^{-1}$, i.e. $\secret{d}\public{e} = 1\quad | \mod \secret{\varphi(N)}$
|
||||||
|
(modular multiplicative inverse).
|
||||||
\end{enumerate}
|
\end{enumerate}
|
||||||
|
The \public{public key} consists of the modulus $N$ and the public exponent $e$.
|
||||||
|
The \secret{private key} consists of the private exponent $d$, as a result of which $p,q,\varphi(N)$ have to be kept secret as well.
|
||||||
|
|
||||||
|
In the encryption process, the ciphertext $c$ is obtained from the message $m$ by calculating $c \equiv m^e \mod N$.
|
||||||
|
After transmission, the message can then be recovered using the the private key exponent $d$ as follows:
|
||||||
|
\[ c^d \equiv (m^e)^d = m^{e*d} \equiv m^1 | \mod N \]
|
||||||
\clearpage
|
\clearpage
|
||||||
|
|
||||||
\section{Conclusion}
|
\section{Conclusion}
|
||||||
Trust on the web with untrusted channels fundamentally remains an unsolved issue,
|
Trust on the web with untrusted channels fundamentally remains an unsolved issue,
|
||||||
though depending on the threat model, everyday communications can be considered relatively secure from non-APT actors.
|
though depending on the threat model, everyday communications can be considered relatively secure from non-APT actors.
|
||||||
A typical cipher suite employed by TLS could look like the following:
|
A typical cipher suite employed by TLS to achieve this security could look like the following:
|
||||||
$$\ub{ECDHE}{Key exchange}-\ub{ECDSA}{authentication}-\ub{AES128}{encryption}-\ub{GCM}{Cipher operation mode}-\ub{SHA256}{hashing} $$
|
$$\ub{ECDHE}{Key exchange}-\ub{ECDSA}{authentication}-\ub{AES128}{encryption}-\ub{GCM}{Cipher operation mode}-\ub{SHA256}{hashing} $$
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item \textbf{ECDHE} Elliptic Curve Diffie Hellman Exchange
|
\item \textbf{ECDHE} Elliptic Curve Diffie Hellman Exchange
|
||||||
|
|||||||
Reference in New Issue
Block a user