43
DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC) DES and AES 1/37

DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

DES and AES

Diego F. Aranha

Institute of ComputingUNICAMP

dfaranha (IC) DES and AES 1/37

Page 2: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Introduction

Objectives:

- Visit practical constructions of block ciphers.

- Apply concepts discussed in previous classes.

Hidden intentions:

- Observe how standardization processes can influence cryptographicdesign.

dfaranha (IC) DES and AES 2/37

Page 3: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Introduction

Objectives:

- Visit practical constructions of block ciphers.

- Apply concepts discussed in previous classes.

Hidden intentions:

- Observe how standardization processes can influence cryptographicdesign.

dfaranha (IC) DES and AES 2/37

Page 4: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Feistel network

Definition

A Feistel network is a special case of iterated cipher whereg :M×K → C has the form g(Li−1R i−1,K i ) = (LiR i ), where

Li = R i−1,R i = Li−1 ⊕ f (R i−1,K i ).

Characteristics:

- Cipher state w i split into two halves Li e R i of the same size.

- There are no restrictions to function f , because g is invertible bydefinition.

dfaranha (IC) DES and AES 3/37

Page 5: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Feistel network

dfaranha (IC) DES and AES 4/37

Page 6: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Feistel network

Li = R i−1,R i = Li−1 ⊕ fi (Ki ,R i−1)

dfaranha (IC) DES and AES 5/37

Page 7: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Feistel network

Encryption algorithm

Input: x , π, fi ,⟨K 1,K 2, . . . ,K r

⟩.

1 L0 ‖ R0 ← x

2 for i ← 1 to r do2.1 Li ← R i−1

2.2 R i ← Li−1 ⊕ fi (Ki ,R i−1) (compression!)

3 return y ← Lr ‖ R r

Problem: if fi is not invertible, how to decrypt?

Solution: Round i can be inverted:

R i−1 = Li , Li−1 = R i ⊕ fi (Ki ,R i−1)

dfaranha (IC) DES and AES 6/37

Page 8: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Feistel network

Encryption algorithm

Input: x , π, fi ,⟨K 1,K 2, . . . ,K r

⟩.

1 L0 ‖ R0 ← x

2 for i ← 1 to r do2.1 Li ← R i−1

2.2 R i ← Li−1 ⊕ fi (Ki ,R i−1) (compression!)

3 return y ← Lr ‖ R r

Problem: if fi is not invertible, how to decrypt?

Solution: Round i can be inverted:

R i−1 = Li , Li−1 = R i ⊕ fi (Ki ,R i−1)

dfaranha (IC) DES and AES 6/37

Page 9: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Feistel network

Encryption algorithm

Input: x , π, fi ,⟨K 1,K 2, . . . ,K r

⟩.

1 L0 ‖ R0 ← x

2 for i ← 1 to r do2.1 Li ← R i−1

2.2 R i ← Li−1 ⊕ fi (Ki ,R i−1) (compression!)

3 return y ← Lr ‖ R r

Problem: if fi is not invertible, how to decrypt?

Solution: Round i can be inverted:

R i−1 = Li , Li−1 = R i ⊕ fi (Ki ,R i−1)

dfaranha (IC) DES and AES 6/37

Page 10: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Data Encryption Standard (IBM, 1975)

History:

- Standard defined jointly by IBM and NSA (National SecurityAgency).

- Based on the Lucifer block cipher, designed by Feistel.

- It was proposed to have a lifetime of 10-15 years, but this was muchlonger in practice.

Important: NSA interference in the standardization effort?

dfaranha (IC) DES and AES 7/37

Page 11: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Data Encryption Standard (IBM, 1975)

Features:

- M = (Z2)64,K = (Z2)56.

- 8-bit parity in the key.

- Permutation L0R0 = IP(x) is applied at the beginning.

- Inverse permutation y = IP−1(R16L16) is applied at the end.

- Nr = 16, lm = 64.

- Function f has format {0, 1}32 × {0, 1}48 → {0, 1}32.

- Subkeys (K 1,K 2, . . . ,K 16) are permutations of the bits from K .

Question: Why is the purpose of IP e IP−1?

dfaranha (IC) DES and AES 8/37

Page 12: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Data Encryption Standard (IBM, 1975)

dfaranha (IC) DES and AES 9/37

Page 13: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Data Encryption Standard (IBM, 1975)

Analysis:

- Only the substitution boxes are non-linear.

- They are speculated to be vulnerable or to store a backdoor.

- They were actually chosen to resist differential cryptanalysis.

- 20 years later, researchers from academia independently discoveredthe attack.

- Any other problem?

dfaranha (IC) DES and AES 10/37

Page 14: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Data Encryption Standard (IBM, 1975)

Analysis:

- Only the substitution boxes are non-linear.

- They are speculated to be vulnerable or to store a backdoor.

- They were actually chosen to resist differential cryptanalysis.

- 20 years later, researchers from academia independently discoveredthe attack.

- Small key space!

dfaranha (IC) DES and AES 10/37

Page 15: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Data Encryption Standard (IBM, 1975)

Cryptanalysis:

- 1977: special-purpose machine costing 20 million was capable ofbrute-forcing the key space in a single day.

- CRYPTO 1993: special machine costing 100,000 capable ofexhaustive search in 7

2 of a day of a million in 1.5 day.

- 1994: Linear cryptanalsysis needs 243 pairs (x , y).

- 1998: EFF builds DES cracker costing 250,000 and capable ofexhaustive search in 56 hours.

dfaranha (IC) DES and AES 11/37

Page 16: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Data Encryption Standard (IBM, 1975)

NSA wanted a secure cipher to everyone, but not too secure:

- Substitution boxes were chosen to improve resistance againstdifferential cryptanalysis.

- Key length was reduced from 64 to 56 bits.

Conclusion: Never trust cryptographic standards to intelligence agencies(see DUAL EC DRBG and TLS export-grade cipher suites!)

Warning: Avoid DES at all costs, use AES!

dfaranha (IC) DES and AES 12/37

Page 17: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Triple DES

Encryption and decryption:

- eK (x) = eK3(dK2(eK1(x)))

- dK (y) = dK1(eK2(dK3(y)))

dfaranha (IC) DES and AES 13/37

Page 18: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Triple DES

Variants:

- K1 = K2 = K3 (56 bits of security).

- K1 = K3 6= K2 (112 bits of security).

- K1 6= K2 6= K3 (168 bits of security).

dfaranha (IC) DES and AES 14/37

Page 19: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Triple DES

Variants:

- K1 = K2 = K3 (56 bits of security).

- K1 = K3 6= K2 (80 of security).

- K1 6= K2 6= K3 (112 bits of security).

dfaranha (IC) DES and AES 14/37

Page 20: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Meet-in-the-middle attack

Definition

It is a known-plaintext attack what exploits the naive intuition thatdouble encryption with different keys is equivalent to encrypting with akey two times longer.

Assumptions:

- Encryption function is eK (x) = eK1(eK2(x)).

- Decryption function is dK (y) = dK2(dK1(x)).

dfaranha (IC) DES and AES 15/37

Page 21: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Meet-in-the-middle attack

Algorithm

Input: Plaintext and ciphertext pair (x , y).Output: Key K .

1 Attacker computes encryptions y ′ = eK1(x) for all keys K1.

2 Attacker stores all y ′ in a table.

3 Attacker computes decryptions x ′ = dK2(y) for all keys K2.

4 If x ′ = y ′, attacker finds correct key K = (K1,K2).

Important: What is the complexity?

dfaranha (IC) DES and AES 16/37

Page 22: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Meet-in-the-middle attack

Algorithm

Input: Plaintext and ciphertext pair (x , y).Output: Key K .

1 Attacker computes encryptions y ′ = eK1(x) for all keys K1.

2 Attacker stores all y ′ in a table.

3 Attacker computes decryptions x ′ = dK2(y) for all keys K2.

4 If x ′ = y ′, attacker finds correct key K = (K1,K2).

Important: 2n+1 encryptions and storage of 2n ciphertexts!

dfaranha (IC) DES and AES 16/37

Page 23: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Advanced Encryption Standard (2001, NIST)

History:

- Public challenge.

- 21 submissions, 15 accepted.

- 5 finalists: MARS, RC6, Rijndael, Serpent e Twofish.

- Cipher Rijndael selected as the standard.

Criteria:

- Security.

- Computational cost in software and hardware.

- Simplicity and flexibility in the design.

dfaranha (IC) DES and AES 17/37

Page 24: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Advanced Encryption Standard (2001, NIST)

Features:

- Three security levels: 128, 192 e 256 bits.

- M = (Z2)128,K = (Z2)128, (Z2)192, (Z2)256.

- Nr = 10, 12, 14, respectively, lm = 128.

- Follows the SPN paradigm.

Curiosity: Implemented as native instruction in modern Intel processors!

dfaranha (IC) DES and AES 18/37

Page 25: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Advanced Encryption Standard (2001, NIST)

Credit: Jeff Moserdfaranha (IC) DES and AES 19/37

Page 26: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Advanced Encryption Standard (2001, NIST)

dfaranha (IC) DES and AES 20/37

Page 27: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Advanced Encryption Standard (2001, NIST)

dfaranha (IC) DES and AES 21/37

Page 28: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Advanced Encryption Standard (2001, NIST)

dfaranha (IC) DES and AES 22/37

Page 29: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Advanced Encryption Standard (2001, NIST)

dfaranha (IC) DES and AES 23/37

Page 30: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Advanced Encryption Standard (2001, NIST)

dfaranha (IC) DES and AES 24/37

Page 31: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Advanced Encryption Standard (2001, NIST)

dfaranha (IC) DES and AES 25/37

Page 32: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Advanced Encryption Standard (2001, NIST)

dfaranha (IC) DES and AES 26/37

Page 33: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Advanced Encryption Standard (2001, NIST)

dfaranha (IC) DES and AES 27/37

Page 34: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Advanced Encryption Standard (2001, NIST)

dfaranha (IC) DES and AES 28/37

Page 35: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Advanced Encryption Standard (2001, NIST)

dfaranha (IC) DES and AES 29/37

Page 36: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Advanced Encryption Standard (2001, NIST)

dfaranha (IC) DES and AES 30/37

Page 37: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Advanced Encryption Standard (2001, NIST)

dfaranha (IC) DES and AES 31/37

Page 38: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Advanced Encryption Standard (2001, NIST)

dfaranha (IC) DES and AES 32/37

Page 39: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Advanced Encryption Standard (2001, NIST)

dfaranha (IC) DES and AES 33/37

Page 40: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Advanced Encryption Standard (2001, NIST)

dfaranha (IC) DES and AES 34/37

Page 41: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Advanced Encryption Standard (2001, NIST)

dfaranha (IC) DES and AES 35/37

Page 42: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Advanced Encryption Standard (2001, NIST)

dfaranha (IC) DES and AES 36/37

Page 43: DES and AES - ic.unicamp.brrdahab/cursos/mo422-mc938/2018-2s/Welcome... · DES and AES Diego F. Aranha Institute of Computing UNICAMP dfaranha (IC)DES and AES1/37

Advanced Encryption Standard (2001, NIST)

dfaranha (IC) DES and AES 37/37