DES, Triple-DES, and AES: Sandy Kutin CSPP 532 7/3/01
DES, Triple-DES, and AES: Sandy Kutin CSPP 532 7/3/01
Symmetric Cryptography
Secure communication has two parts:
Establish a key (public key methods) Encrypt message symmetrically using key
Symmetric encryption is faster Cryptographic scheme is only as good as its weakest link We need to understand strengths and weaknesses of symmetric encryption
7/3/01
DESiderata
Secure: hard to attack
Classic case: given ciphertext, get plaintext Also: given both, get key Achieved through diffusion, confusion
Easy to analyze
7/3/01
DEScription: Overview
Block cipher: 64 bits at a time Initial permutation rearranges 64 bits (no cryptographic effect) Encoding is in 16 rounds
plaintext INITIAL PERMUTATION ROUND 1
ROUND 2
... ROUND 16 INITIAL PERMUTATION-1 ciphertext
7/3/01
Li-1
Ri-1
Li
Ri
DEScription: InsiDES
Expand right side from 32 to 48 bits (some get reused) Add 48 bits of key (chosen by schedule) S-boxes: each set of 6 bits reduced to 4 P-box permutes 32 bits
7/3/01
Ri-1
Expansion
Eight S-boxes
Ki
P-box
Output
In other words:
Ri 1 Li Li 1 Ri f Li
So decryption is the same as encryption Last round, no swap: really is the same 7/3/01
Li
Ri
MoDES of Operation
ECB: Electronic CodeBook mode:
Encrypt each 64-bit block independently Attacker could build codebook
PeDEStrian attacks
Obvious attack: guess the key. 256 keys Complementation Property: 255 keys 1 million per second: 1100 years Store EK(P1) for all K: 512 petabytes Time/Memory Tradeoff (Hellman, 1980):
1 terabyte 5 days
7/3/01
DEStroying Security
Differential Cryptanalysis (1990): Say you know plaintext, ciphertext pairs Difference dP = P1 P2, dC = C1 C2 Distribution of dCs given dP may reveal key Need lots of pairs to get lots of good dPs Look at pairs, build up key in pieces Could find some bits, brute-force for rest
7/3/01
DEServing of Praise
Against 8-round DES, attack requires:
214 = 16,384 chosen plaintexts, or 238 known plaintext-ciphertext pairs
DESperate measures
Linear cryptanalysis:
Look at algorithm structure: find places where, if you XOR plaintext and ciphertext bits together, you get key bits S-boxes not linear, but can approximate
Need 243 known pairs; best known attack DES apparently not optimized against this Still, not an easy-to-mount attack
7/3/01
DESuetude
Weakest link is size of key Attacks take advantage of encryption speed 1993: Weiner: $1M machine, 3.5 hours 1998: EFFs Deep Crack: $250,000
92 billion keys per second; 4 days on average
1999: distributed.net: 23 hours OK for some things (e.g., short time horizon) DES sliDES into wiDESpread DESuetude
7/3/01
Triple-DES
Run DES three times: If K2 = K3, this is DES
ECB mode: Ci EK3 DK2 EK1 Pi Backwards compatibility
Known not to be just DES with K4 (1992) Has 112 bits of security, not 3 56 = 168 Why? Whats the attack? Whats wrong with Double-DES?
7/3/01
DESpair
Double-DES: Ci = EB(EA(Pi)) Given P1, C1: Note that DB(C1) = EA(P1) Make a list of every EK(P1). Try each L: if DL(C1) = EK(P1), then maybe K = A, L = B. (248 Ls might work.) Test with P2, C2: if it checks, it was probably right. Time roughly 256. Memory very large.
7/3/01
May 2001: Comment period ended Summer 2001: Finalized, certified until 06
7/3/01
AESthetics
Similar to DES: block cipher (with different modes), but 128-bit blocks 128-bit, 192-bit, or 256-bit key Mix of permutations, S-boxes S-boxes based on modular arithmetic with polynomials:
Non-linear Easy to analyze, prove attacks fail
7/3/01
in8 in9
in12 in13
s1,0 s1,1 s1,2 s1,3 s2,0 s2,1 s2,2 s2,3 s3,0 s3,1 s3,2 s3,3
out1 out5 out9 out13 out2 out6 out10 out14 out3 out7 out11 out15
7/3/01
AES: Pseudocode
Ciphe r(byt e in[ 4 * N b], b yte out[ 4 * N b], w ord w [Nb * (Nr + 1)] ) begin byte state [4,Nb ] state = in // S e e Sec . 5.1 .4
AddRo undKe y(sta te, w ) for r ound = 1 s tep 1 to N r 1 SubByte s(sta te) Shift Rows( state ) MixCo lumns (stat e) AddRo undKe y(sta te, w + r o und * end f or SubBy tes(s tate) Shift Rows( state ) AddRo undKe y(sta te, w + out = stat e end 7/3/01
// // // N b)
N r * Nb)
AES: SubBytes()
s0,0 s0,1 s0, 2 s0,3
s1,0 s1,1 s1, 2 s1,3
(S-Box)
' ' ' ' s0 s0 s0 s0 ,0 ,1 ,2 ,3
s r ,c
s1' , 0
s1' ,1
s r ,c
s1'', 2
s1' , 3
7/3/01
AES: ShiftRows()
ShiftRows()
sr , 0 sr ,1 sr , 2 sr ,3
S
Figure 9. ShiftRows() cycl ically shifts the last three rows in the State
7/3/01
AES: MixColumns()
MixColumns()
s0,0
s1,0
,c s s0,1 s0 s0 ,2 0 ,3 b0 s s1 s,,cc s
1,1 1, 2 1,3
' 0,0
' 1, 0
'
7/3/01
AES: AddRoundKey()
s0 ,c
s0,0 s0,1 s0, 2 s0,3
s1,0 s1,1 s1, 2 s1,3 l round * Nb
s1,c
wl 1
wl+c wl 2 wl 3
' 1, 0
' 1,1
s1, 2 s1' , 3
' ' s'2,,2c s2' ,3 s2 ,0 s2 ,1 s2 ' ' ' ' s3 , 0 s3,1 s s3',2 s3,3
3 ,c
Figure 11. AddRoundKey() XORs each co lumn of the State with a word from the key schedule.
7/3/01
Key schedule: expand Nb-word key to 4 words per round for (6 + Nb) rounds (Nb could be 4, 6, or 8)
KafkAESque Complexity
S-box: input is a byte B
First take B-1 (mod p) Next, do a linear transformation on the bits Finally, XOR with a fixed byte
MixColumns() also uses polynomials S-box can be done with a lookup table Easier to analyze then random S-boxes used in DES
7/3/01
Suggested Reading
Chapter references are to Stallings Modular Arithmetic: Sections 7.1-7.3, 7.5 Big-Oh Notation: Appendix 6A DES: Chapter 3 Double-DES, Triple-DES: Section 4.1 AES: The AES home page: http://csrc.nist.gov/encryption/aes/
7/3/01