Introduction To Modern Cryptography Symmetric Encryption: Stream & Block Ciphers
Introduction To Modern Cryptography Symmetric Encryption: Stream & Block Ciphers
Lecture 2
: Symmetric Encryption
Stream & Block Ciphers
Stream Ciphers
Start with a secret key (seed)
Generate a keying stream
i-th bit/byte of keying stream is a function
of the key and the first i-1 ciphertext bits.
Combine the stream with the plaintext to
produce the ciphertext (typically by XOR)
Stream
Plaintext
=
Ciphertext
Stream
Ciphertext
=
Plaintext
Terminology
Stream cipher is called synchronous
if keystream does not depend on the
.plaintext (depends on key alone)
.Otherwise cipher is called asynchronous
RC4 Properties
Variable key size stream cipher with byte oriented
operations.
Based on using a random looking permutation.
8-16 machine operations per output byte.
Very long cipher period (over 10100).
Widely believed to be secure. Used for encryption in
SSL web protocol.
RC-4 Initialization
1. j=0
2. S0=0, S1=1, , S255=255
3. Let the key be (bytes) k0,,k255 (repeating
bits if necessary)
4. For i=0 to 255
Swap Si and Sj
B = St
Block Ciphers
Encrypt a block of input to a block of output
Typically, the two blocks are of the same
length
Most symmetric key systems block size
is 64
In AES block size is 128
Different modes for encrypting plaintext
longer than a block
DES, 3-DES
AES (Rijndael)
RC-2
RC-5
IDEA
Blowfish, Cast
Gost
P2
P3
Ek
Ek
Ek
C1
C2
C3
Properties of ECB
P1
P2
P3
Ek
Ek
Ek
C1
C2
C3
Properties of CBC
OFB Mode
(Output FeedBack)
Properties of OFB
Iterated Ciphers
Plaintext undergoes encryption repeatedly
by underlying cipher
Ideally, aach stage uses a different key
In practice triple cipher is usually
C= Ek1(Ek2(Ek1(P))) [EEE mode] or
C= Ek1(Dk2(Ek1(P))) [EDE mode]
EDE is more common in practice
Necessary Condition
For some block ciphers iteration does not
enhance security
Example substitution cipher
Consider a block cipher: blocks of size b
bits, and key of size k
The number of all possible functions
mapping b bits to b bits is (2b)2
b
Adversarys Goals
Final goal: recover key
Intermediate goals:
Generic Attacks
Exhaustive search
Type: ciphertext only
Time: 2|k| decryptions per ciphertext
Storage: constant
Table lookup
Type: chosen plaintext
Time: offline 2|k| decryptions, online constant
Storage: 2|k| ciphertexts
The Problem
Break ECB mode (known fixed cleartext
header)
The idea:
Define f(k) = Enck(constant)
Invert f(k)
Time/Space Tradeoffs
1st Simple solution:
Time 2|k| - exhaustive search per message
?Why
Values of f(k) on a small cycle will be inverted
Consider what happens when we add the ith chain
(si, ti):
If we cover a constant times L new values then were
done
If not, assume that the previous chains have covered
less than a constant of the L2 values
The uncovered values must themselves lie on chains whose
average length is a constant times L (as all values lie on some
chain)
Thus, we have a constant probability of covering at least a
constant fraction of L new values
Inverting g(f(x))
Not a permutation:
Choose L=2|k|/3 random start points s1, , sL
For every such point, compute ti=f(f(f(si))), repeated
L times.
Store a lookup table of values (ti,si), i=1, , L, indexed
by ti.