Francesco Romeo added section_Symmetric_Ciphers_Let_s__.tex  about 8 years ago

Commit id: 2dcc68711bb602da72da5b15344605d156e953e2

deletions | additions      

         

\section*{Symmetric Ciphers}  Let's start to see mathematically what a crytptosystem is and how it works. \\  When Bob has to send a message $m$ to Alice, he uses a key $k$ and in some way he obtains the ciphertext $c$, so the problem of encrypting messages regards the choice of the keys and we could distinguish two kind of ciphers dependig by the knowledge of them: Symmetric and Asymmetric Ciphers. \\  In a \textbf{Symmetric Cipher}, Alice and Bob share the knoledge of the key $k$ to exchange messages and this problem is mathematically equal to consider three sets $\mathcal{M}$, the plaintext set, $\mathcal{C}$, the ciphertext set, $\mathcal{K}$, the space of the keys.  These three sets could be linked by the introduction of a couple of functions $e$ and $d$, the encryption and decryption functions, defined as follow:  $$e: \mathcal{K} \times \mathcal{M}\rightarrow \mathcal{C}$$  $$ \ \ \ (k,m) \longmapsto c$$  $$d: \mathcal{K} \times \mathcal{C}\rightarrow \mathcal{M}$$  $$ \ \ \ (k,c) \longmapsto m$$  with $k \in \mathcal{K}, \ m \in \mathcal{M}, \ c \in \mathcal{C} $  Or if we fix a key $k$ we could write $e(k,m)$ and $d(k,c)$ as $e_{k}(m)$ and $d_{k}(c)$ and they should be an injective function.  It's clear that if $c = e_{k}(m)$ then $d_{k}(e_{k}(m))=m$.   We could represent mathematically the Caesar's Shift Cipher as follow: the letters in the English Alphabet are 26, we associate at every letter a number in crescent order $A=0,B=1, \ldots , Z=25$ and the \textit{key} is the shift range. To obtain a letter of the ciphertext we have to add the key to the plaintext or vice versa we have to subtract the key from the ciphertext to obtain the plaintext. What is missing? The letters are 26 and every letter has to be between 0 and 25 then this recalls us the congruence, in this case modulo 26.  The encryption and decryption functions are:  $$e_{k}(m) \equiv m + k \ ( \ mod \ 26 \ )$$  $$d_{k}(c) \equiv c - k \ ( \ mod \ 26 \ )$$  \ \\  The Encryption and Decryption functions are the "backbone" of a cryptosystem and these are the missing elements to define a \textbf{Cryptosystem}: the plaintext,the ciphertext, the key space, encryption and decryption functions are a cryptosystem, in brief $(\mathcal{K},\mathcal{M},\mathcal{C},e,d)$.\\  The choice of the functions involves the \textbf{security} of the cryptosystem: referring to \textit{Kerchoff's Principle} we say that $(\mathcal{K},\mathcal{M},\mathcal{C},e,d)$ is a successful cipher ( it is secure enough) if it has the following properties:  \begin{enumerate}  \item For any key $k \in \mathcal{K}$ and plaintext$m \in \mathcal{M}$ it must be easy to compute the ciphertext $e_{k}(m)$.  \item For any key $k \in \mathcal{K}$ and ciphertext $c \in \mathcal{C}$ it must be easy to compute the plaintext $d_{k}(c)$.  \item Given $c_{1},c_{2}, \ldots ,c_{n} $ ciphertexts encrypted with the same key $k \in \mathcal{K}$, it must be very difficult to compute any of the corresponding plaintexts $d_{k}(c_{1}), d_{k}(c_{2}) ,\ldots , d_{k}(c_{n})$, without the knowledge of $k$.  \end{enumerate}  There are other two desiderable properties that are difficult to achieve, but the cryptosystem will be secure against two kind of attacks:  \begin{enumerate}  \item[4.] If someone could choose plaintexts $m_{1},m_{2}, \ldots, m_{n}$ and he could know the corresponding ciphertexts $c_{1},c_{2}, \ldots ,c_{n} $, it must be very difficult to decrypt any $c$ that is not given in the list, without knowing $k$. This is known as security against \textbf{chosen plaintext attack}.  \item[5.] If someone knows pairs $(m_{1},c_{1}),(m_{2},c_{2}), \ldots, (m_{n},c_{n})$ of plaintexts and ciphertexts, it must be very difficult to decrypt any $c$ that is not given in the list, without knowing $k$. This is known as security against \textbf{given plaintext attack}.  \end{enumerate}  The shift cipher described previously has the properties 1,2 and 3, for the 4 and 5 if we know e.g $(a,B)$, $(b,C)$ and $(c,D)$ we will say that at the letter of the ciphertext $P$ corresponds the plaintext $o$. \\  Another example of symmetric cipher is given by taking $p$ prime and considering in $\mathbb{F}_{p}$ the following functions:  $$e_{k}(m) \equiv m \cdot k \ ( \ mod \ p \ )$$  $$d_{k}(c) \equiv c \cdot k^{'} \ ( \ mod \ p\ )$$  where obviously $k^{'} \equiv_{p} k^{-1}$.  If we combine the addition and multiplication of keys, introducing a pair of keys $(k_{1},k_{2})$ we obtain the \textbf{Affine Cipher}  $$ e_{k}(m) \equiv k_{1} \cdot m + k_{2} \ ( \ mod \ p \ )$$  $$ d_{k}(c) \equiv k_{1}^{'} \cdot (c-k_{2}) \ ( \ mod \ p\ )$$