security (confidentiality is preserved, perfect secrecy)
1.1.1 security notions
Adversary objective: learn confidential information. Typically it is
key recovery.
ciphertext only attack: using ciphertexts in
transit only.
known plaintext attack: same + known (or guess) the
corresponding plaintexts
chosen plaintext attack: force the sender to
encrypt some messages selected by the adversary
chosen ciphertext attack: force the receiver to
decrypt some messages selected by the adversary
1.2 block ciphers
1.2.1 data encryption standard
(DES)
Encrypts blocks of 64 bits. Key of length 64 bits, but 8 bits are
parity bits. We use key schedule to get 16 rounds of 48 bit keys from
the main key. We split the plaintext block into two 32 bit parts. We
apply the Feistel scheme.
Susceptible to exhaustive search due to small key. There exist keys
which produce very weak ciphers.
Arithmetics happens in GF(2^8). We
reduce everything modulo 2 and modulo x^8 +
x^4 + x^3 + x + 1.
1.2.2.1 ECB mode
Encrypt each block of a larger plaintext independently with the same
key. Can leak information on repeating blocks.
1.2.2.2 CBC mode
Start with an initialization vector (IV). We XOR it with first block
and cipher it. Then, the result is XORed with the next block and then
encrypted, this continues. So instead of just encrypting the block, we
first mix the block with the cipher text from the previous block.
Three ways to handle IV:
use a non-secret constant IV (bad idea)
use secret IV which is part of the key (ok if not reused)
random IV that is sent in clear together with ciphertext
If a block of ciphertext is corrupted only this and the next block of
plaintext is corrupted.
1.2.2.3 OFB mode
We encrypt IV and XOR with a block. The result of IV encryption is
passed to next encryption for the next block. We must have a new IV for
every plaintext. IV is a nonce (number
used once).
1.2.2.4 CTR mode
Have a counter t_i and increment for
each block. We encrypt the counter and XOR with the block. t_i must be a nonce but also across every
block across every message. This means each block can be independently
computed.
1.2.2.5 XTS mode
Used for hard disk encryption.
1.2.2.5.1 ciphertext stealing
Method for encrypting messages that cannot be evenly divided into
blocks.
Let x and x' be the last two blocks where x' is shorter than block length.
let Enc(x) = y' || u where
y' has same length as x'
y = Enc'(x'||u)
return y and y'
1.3 stream ciphers
Use a PRNG to generate a key stream. We seed the PRN with a fixed
secret key and a nonce. Optimized for hardware, efficient.
We can:
synchronize participants to a nonce (requires being stateful)
send the nonce in clear with ciphertext (requires nonce being
visible by an adversary)
1.3.1 RC4
Key length from 40 to 256 bits.
Weaknesses:
there are some correlations between some output bytes and key bytes
when the nonce is known
output bytes are not uniformly distributed
1.4 bruteforce inversion
1.4.1 opening a safe
Asking the safe if a key is correct. By bruteforce we can find the
correct key.
1.4.1.1 uniform distribution
Exhaustive search for all keys. Expected value of iterations is \frac{N + 1}{2} for N keys.
1.4.1.2 known distribution
Start search with the most probable keys (ordered by a permutation
\sigma). Expected value of iterations
is \min_\sigma(\sum_{i=1}^N P[K =
k_{\sigma(i)}]i) for a permutation (order of tested keys) \sigma. This expected value is called the
guesswork entropy of the distribution.
1.4.1.3 unknown distribution
We choose a random permutation and start testing. Expected value of
iterations is \frac{N + 1}{2} for N keys.
1.4.1.4 key recovery game (online
attack)
Online because we need to directly ask an oracle if a key is
correct.
Game:
pick K \in_D \mathcal K
\mathcal A^{\mathcal O} \to k
return 1_{K = k}
1.4.1.4.1 with a clue
Game:
pick K \in_D \mathcal K
W \leftarrow clue about K
\mathcal A^{\mathcal O}(W) \to
k
return 1_{K = k}
1.4.2 access control
enrolment: enter user id and password. Register user id and a clue
about password.
access control: enter user id and password. Verify using the
clue.
Example clue: the hash of a password.
1.4.3 offline attack
We use a stop test function to test whether the key candidate is
consistent with the witness.
Offline key recovery:
pick K \in_D \mathcal K
W \leftarrow F(K)
\mathcal A(W) \to k
return 1_{K = k}
Inversion:
pick K \in_D \mathcal K
W \leftarrow F(K)
\mathcal A(W) \to k
return 1_{F(k) = W}
1.4.3.1 inversion by exhaustive
search
For F : K \to Y let N = |K| and M =
|Y|. Finds the pre-image (key) of some clue w \in_U Y. Try keys until F(k) = w.
E_F(P[\text{iterations} > i]) = (1 -
\frac{1}{M})^i. Expected number of iterations is M(1 - e^{-\frac{N}{M}}) or just M when N \gg
M.
1.4.4 metrics of attacks
pre-computation time
memory complexity
time complexity
number of online queries
probability of success
1.4.5 grover’s algorithm
Runs on a quantum computer and does bruteforce in O(\sqrt N).
1.5 double encryption
We run encryption twice with two different keys. This is not much
more secure. The security is only the sum of both encryptions rather
than their product.
1.5.1 meet in the middle
attack
Let y =
C''_{k_2}(C'_{k_1}(x)) be a double encryption of two
(possibly different) encryptions C'' and C' with keys from their respective key
spaces \mathcal K'', \mathcal
K'. We compute the encryption dictionary for \mathcal K' for x. Then we look for the middle encryption by
checking keys from \mathcal K''
by doing decryption of the cipher text y.