ECS726-Week02 Symmetric EncryptionP
ECS726-Week02 Symmetric EncryptionP
Authentication
Week 2: Perfect Secrecy, Practical Security,
Symmetric Key Encryption
Pasquale Malacaria
EECS, QMUL
Table of contents
1. Perfect Secrecy
2. Practical Security
3. Symmetric-Key Encryption
Stream Ciphers
Block Ciphers
Block Ciphers’ Modes of Operation
1
Learning Outcomes
• Perfect secrecy.
• Understand difference between theoretical and
practical security
• Understand that all practical cryptosystems are
(theoretically) insecure.
• Recognise the concept of “practical” security.
• Identify the basic design features of AES, as the
current standard for symmetric key encryption;
• Being able to compare several different block cipher
“modes of operation” and their properties.
2
Perfect Secrecy
Perfect Secrecy: definition
Definition
A cryptosystem has perfect secrecy if, after seeing the
ciphertext, an interceptor gets no extra information about
the plaintext other than what was known before the
ciphertext was observed.
3
Perfect Secrecy: Implication of the definition
4
Achieving Perfect Secrecy!
5
Achieving Perfect Secrecy!
ATTACK RETREAT
Key K1 EK1 (ATTACK) = 0 EK1 (RETREAT ) = 1
Key K2 EK2 (ATTACK) = 1 EK2 (RETREAT ) = 0
6
Achieving Perfect Secrecy
0 1
(k1 = 0) E0 (0) = 0 E0 (1) = 1
(k2 = 1) E1 (0) = 1 E1 (1) = 0
x y x ⊕y
0 0 0
1 0 1
0 1 1
1 1 0
(if the two bits are equal then the XOR operation returns 0
otherwise it returns 1)
9
XOR
x1 x2 · · · ⊕ y1 y2 · · · = (x1 ⊕ y1 )(x2 ⊕ y2 ) . . .
For example
10
Achieving Perfect Secrecy!
m = Deck (c) := c ⊕ k
11
Achieving Perfect Secrecy!
(m ⊕ k ) ⊕ k = m ⊕ (k ⊕ k) = m ⊕ 0 = m
12
Achieving Perfect Secrecy!
N S H R
K1 : EK1 (N) = 00 EK1 (S) = 01 EK1 (H) = 10 EK1 (R) = 11
K2 : EK2 (N) = 01 EK2 (S) = 00 EK2 (H) = 11 EK2 (R) = 10
K3 : EK3 (N) = 10 EK3 (S) = 11 EK3 (H) = 00 EK3 (R) = 01
K4 : EK4 (N) = 11 EK4 (S) = 10 EK4 (H) = 01 EK4 (R) = 00
19
Theoretical vs. Practical Security
20
Theoretical vs. Practical Security
21
Theoretical vs. Practical Security
22
Theoretical vs. Practical Security
For this module, you just need to appreciate that there two
main classes of complexities: polynomial vs. exponential:
I polynomial: if the time taken to execute the process
for an input of size n is no greater than nr , for some r
B Informally, these are ‘quick’ on all inputs of
‘reasonable’ size. E.g.: multiplication of two n-bit
numbers (complexity n2 ), raising a number to an n-bit
power (n3 ), so all ‘easy’ processes.
I exponential time if the time taken to execute the
process for an input of size n is ∼ an , for some a.
B Informally, these are ‘too slow’ on all inputs of
‘reasonable’ size, as it becomes practically impossible
to carry out. E.g. exhaustive search for an n-bit key.
24
Theoretical vs. Practical Security
26
Semantic Security
(side note)
The notion of practical security can still be formalized:
Semantic Security : “a cryptosystem is semantically
secure if any probabilistic, polynomial-time
algorithm (PPTA) that is given the ciphertext
of a certain message m (taken from any
distribution of messages), and the message’s
length, cannot determine any partial
information on the message with probability
non-negligibly higher than all other PPTA’s
that only have access to the message length
(and not the ciphertext)”.
27
Key Distribution: (how to give the key to the receiver?)
this will be covered in the following course
Questions?
27
Symmetric-Key Encryption
Stream Cipher vs Block Cipher
XOR
B Stream Cipher: Process one plaintext bit at a time.
B Block Cipher: Process a block of plaintext at a time.
typically <= 128 bits
28
Stream cipher
29
Properties of stream ciphers
30
Properties of stream ciphers
I Speed:
B XOR is very fast to operate
I On-the-fly encryption
B large chunks of plaintext do not sit around in registers
before being encrypted.
I Implementation efficiency
B Some stream cipher designs can be implemented in
hardware extremely efficiently
32
Properties of block ciphers
33
DES
f1
R0 L0 x f1(R0)
how to decipher? f2
L0 x f1(R0) R0
f3
L0 x f1(R0)x f1(R0)
=>L0 x 0 = L0
L3 R3 34
Feistel cipher
Feistel encryption:
35
Q: what is Feistel decryption?
DES: attributes
36
TDES/3DES
(side-note)
Triple-DES was introduced as an interim solution without
replacing DES completely:
37
AES
38
AES
1
pronounced like rain-doll!
39
AES
2
Animation of AES (Rijndael) block cipher (hyperlink) 40
AES attributes
41
AES today
42
Block-ciphers: Modes of Operation
43
Electronic Code Book (ECB) mode
44
Cipher Block Chaining (CBC) mode
P0 P1 P2 Pn
IV
C0 C1 C2 Cn
IV
P0 P1 P2 Pn
47
Cipher Block Chaining (CBC) mode
48
Cipher Block Chaining (CBC) mode: Properties
CFB Encryption:
IV
P0 P1 P2 Pn
C0 C1 C2 Cn
IV
C0 C1 C2 Cn−1 Cn
P0 P1 P2 Pn
52
90 bits (txt) 38 bits (for counter)
Counter mode (CTR) mode
P0 P1 P2 Pn
C0 C1 C2 Cn
B Perfect secrecy
B Practical secrecy
B Symmetric key standard: AES
B (some) “modes of operation” of block-ciphers and
their properties.
56
Questions?
56