Top Banner
1 Chapter 3 Block Ciphers & The Data Encryption Standard
57

1 Chapter 3 Block Ciphers & The Data Encryption Standard.

Dec 29, 2015

Download

Documents

Ashley Lester
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

1

Chapter 3

Block Ciphers & The Data Encryption Standard

Page 2: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

2

Contents

Block Cipher Principles

The Data Encryption Standard

The Strength of DES

Differential and Linear Cryptananlysis

Block Cipher Design Principles

Page 3: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

3

Block Cipher principles

Stream Ciphers and Block Ciphers

Motivation for the Feistel Cipher Structure

The Feistel Cipher

Page 4: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

4

Stream Ciphers and Block Ciphers

Stream cipher encrypts one bit or one byte at a time. Vigenère cipher, Verman cipher

Block cipher encrypts a block of plaintext as a whole to produce a ciphertext block of equal length. Typical block size: 64 or 128 bits

Page 5: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

5

Motivation for the Feistel Cipher Structure

A block cipher operates on a plaintext block of n bits to produce a ciphertext block of n bits. Each plaintext must produce a unique ciphertext block (fo

r decryption to be possible). Such transformation is called reversible or nonsingular.

Reversible Mapping Irreversible Mapping

PlaintextCipherte

xtPlaintext

Ciphertext

00 11 00 11

01 10 01 10

10 00 10 01

11 01 11 01

Page 6: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

6

Motivation for the Feistel Cipher Structure

The logic of a general substitution cipher. (for n = 4)

Page 7: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

7

Motivation for the Feistel Cipher Structure

A practical problem with the general substitution cipher If a small block size is used, then the system is equivalent

to a classical substitution cipher. Such systems are vulnerable to a statistical analysis of the

plaintext.

If block size is sufficiently large and an arbitrary reversible substitution is allowed, then statistical analysis is infeasible. This is not practical from a performance point of view. For n-bit block cipher, the key size is n X 2n bits. For n = 4, the key size is 4 x 16 = 64 bits. For n = 64, the key size is 64 x 2n 16 = 64 bits

Page 8: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

8

The Feistel Cipher

Feistel proposed the use of a cipher that alternates substitutions and permutations.

In fact, this is a practical application of a proposal by Claude Shannon to develop a product cipher that alternates confusion and diffusion functions.

Page 9: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

9

Diffusion and Confusion

Shannon suggests two methods for frustrating statistical cryptanalysis. Diffusion and Confusion

Page 10: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

10

Diffusion and Confusion

Diffusion To make the statistical relationship between the plaintext

and ciphertext as complex as possible in order to thwart attempts to discover the key.

Confusion To make the relationship between the statistics of the

ciphertext and the value of the encryption key as complex as possible to thwart attempts to discover the key.

Page 11: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

11

Diffusion and Confusion

Diffusion can be achieved by a permutation followed by a function.

Confusion can be achieved by a substitution.

Page 12: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

12

Feistel Cipher Structure

Feistel structure Input

Plaintext : 2w bits A Key K

Output Ciphertext : 2w bits

Page 13: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

13

Feistel Cipher Structure

The input is divided into two halves L0 and R0 and they pass through n rounds.

Round i Input: Li-1, Ri-1, and Ki (round key)

Output: Li and Ri

A substitution is performed on the left half Li-1.

A permutation is performed by swapping the two halves.

),( 11

1

iiii

ii

KRFLR

RL

),( 11 iii KRFL

Page 14: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

14

Feistel Cipher Structure

Design features Block size

The larger it is, the securer the cipher is but the slower the cipher is.

64 or 128 bits

Key size The larger it is, the securer the cipher is but the slower the

cipher is. 64 or 128 bits

Number of rounds The larger it is, the securer the cipher is but the slower the

cipher is. 16 rounds is typical.

Page 15: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

15

Feistel Cipher Structure

Design features Subkey generation

The more complex it is, the securer the cipher is but the slower…

Round function The more complex it is, the securer the cipher is but the

slower…

Fast software encryption/decryption

Ease of analysis

Page 16: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

16

Feistel Decryption Algorithm

Decryption is the same as the encryption except that the subkeys are used in reverse order.

Page 17: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

17

Feistel Cipher Structure

Round i

),( 11

1

iiii

ii

KRFLR

RL

),( 11

1

iiii

ii

KRFRL

LR

),(1

1

iiii

ii

KLFRL

LR

Page 18: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

18

The Data Encryption Standard

DES Encryption

Initial Permutation

Details of Single Round

Key Generation

The Avalanche Effect

Page 19: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

19

The Data Encryption Standard

The most widely used encryption. Adopted in 1977 by NIST FIPS PUB 46

Data are encrypted in 64-bit blocks using a 56-bit key.

Page 20: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

20

DES Encryption

DES is a Feistel cipher with the exception of IP and IP-1.

Page 21: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

21

Initial Permutation

The permutation X = IP(M)

The inverse permutation Y = IP-1(X) = IP-1(IP(M))

The original ordering is restored

Page 22: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

22

Single Round

),( 11

1

iiii

ii

KRFLR

RL

F function R i-1 is expanded to 48-bits using E. The result is XORed with the 48-bit r

ound key. The 48-bit is substituted by a 32-bit. The 32-bit is permuted by P.

Page 23: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

23

Single Round

Expansion E 32 bits 48 bits 16 bits are reused.

Permutation P

Page 24: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

24

Single Round

Substitution 48 bits 32 bits 8 S-boxes Each S-box gets 6 bits and outputs 4 bits.

Page 25: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

25

Single Round

Each S-box is given in page 79. Outer bits 1 & 6 (row bits) select one rows Inner bits 2-5 (col bits) are substituted

Example : Input : 011001 the row is 01 (row 1) the column is 1100 (column 12) Output is 1001

Page 26: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

26

Key Generation

A 64-bit key used as input Every 8th bit is ignored. Thus, the key is 56 bits.

PC1 permute 56 bits into two 28-bit halves.

Page 27: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

27

Key Generation

In each round, each 28 bits are rotated left

and 24 bits are selected from each

half.

Page 28: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

28

Key Generation

Page 29: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

29

Key Generation

Page 30: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

30

DES Decryption

Decryption uses the same algorithm as encryption. Feistel cipher Roundkey schedule is reversed.

Page 31: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

31

The Avalanche Effect

A small change of plaintext or key produces a significant change in the ciphertext.

DES exhibits a strong avalanche effect.

Page 32: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

32

The Avalanche Effect

Example

Plaintext 1 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

Plaintext 2 10000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

Key 00000001 1001011 0100100 1100010 0011100 0011000 0011100 0110010

Page 33: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

33

The Avalanche Effect

Example

plaintext 01101000 10000101 00101111 01111010 00010011 01110110 11101011 10100100

Key 1 1110010 1111011 1101111 0011000 0011101 0000100 0110001 11011100

Key 2 0110010 1111011 1101111 0011000 0011101 0000100 0110001 11011100

Page 34: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

34

The Strength of DES

The Use of 56-bit keys

The Nature of the DES Algorithm

Timing Attacks

Page 35: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

35

The Use of 56-bit Keys

If the key length is 56-bit, we have 256 = 7.2 x 1016 keys.

In 1998, Electronic Frontier Foundation (EFF) announced ‘DES cracker’ which can attack DES in 3 days. It was built for less than $250,000.

Alternatives to DES AES (key size is 128 ~ 256 bit) and triple DES (112 ~ 168 bit)

Page 36: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

36

Differential and Linear Cryptanalysis

Differential Cryptanalysis History Differential Cryptanalysis Attack

Linear Cryptanalysis

Page 37: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

37

Differential Cryptanalysis

One of the most significant advances in cryptanalysis in recent years is differential cryptanalysis.

Page 38: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

38

History

Murphy, Biham & Shamir published 1990.

The first published attack that is capable of breaking DES in less than 255 complexity. As reported, can successfully cryptanalyze DES with an

effort on the order of 247, requiring chosen plaintexts.

This is a powerful tool, but it does not do very well against DES Differential cryptanalysis was known to IBM as early as

1974

Page 39: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

39

Differential Cryptanalysis Attack

The differential cryptanalysis attack is complex.

Change in notation for DES Original plaintext block : m

Two halves : m0, m1

At each round for DES, only one new 32-bit block is created. The intermediate message halves are related.

mi1 mi 1 f(mi,K i)

i 1,2,...,16

Page 40: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

40

Differential Cryptanalysis Attack

Start with two messages m and m’, and consider the difference between the intermediate message halves : With a known XOR difference

Then

mi mi m'i

m m m'

mi1 mi1 m'i1

[mi 1 f (mi,K i)] [m'i 1 f (m'i ,K i)]

mi 1 m'i 1 f (mi,K i) f (m'i ,K i)

mi 1 [ f (mi,K i) f (m'i ,K i)]

Page 41: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

41

Differential Cryptanalysis Attack

The Overall strategy is based one these considerations for a single round. The procedure is

to begin with two plaintext message m and m’ with a given difference.

to trace through a probable pattern of differences after each round to yield a probable difference for the ciphertext.

Page 42: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

42

Differential Cryptanalysis Attack

Actually, there are two probable differences for the two 32-bit halves.

Next, submit m and m’ for encryption to determine the actual difference under the unknown key.And compare the result to the probable difference.If there is a match,

Then, suspect that all the probable patterns at all the intermediate rounds are correct.

With that assumption, can make some deductions about the key bits.

m17 ||m16

EK (m) EK (m') (m17 ||m16)

Page 43: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

43

Linear Cryptanalysis

another recent development also a statistical method must be iterated over rounds, with decreasing probabilitiesdeveloped by Matsui et al in early 90'sbased on finding linear approximationscan attack DES with 247 known plaintexts, still in practise infeasible

Page 44: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

44

Linear Cryptanalysis

find linear approximations with prob p != ½P[i1,i2,...,ia](+)C[j1,j2,...,jb] = K[k1,k2,...,kc]

where ia,jb,kc are bit locations in P,C,K

gives linear equation for key bitsget one key bit using max likelihood algusing a large number of trial encryptions effectiveness given by: |p–½|

Page 45: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

45

Block Cipher Design Principles

DES Design Criteria

Number of Rounds

Design of Function F Design Criteria for F S-Box Design

Key Schedule Algorithm

Page 46: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

46

Block Cipher Design Principles

Although much progress has been made that are cryptographically strong, the basic principles have not changed all.

Page 47: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

47

DES Design Criteria

Focused on the design of the S-boxes and on the P function.

The criteria for the S-boxes. No output bit of any S-box should be too close a linear

function of the input bits. Each row of an S-box should include all 16 possible output

bit combinations If two inputs differ in exactly one bit, the outputs must differ

in at least two bits. If two inputs differ in the two middle bits exactly, the

outputs must differ in at least two bits.

Page 48: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

48

DES Design Criteria

The criteria for the S-boxes (~ continue) If two inputs differ in their first two bits and are identical

in their last two bits, the two outputs must not be the same.

For any nonzero 6-bit difference between inputs, no more than 8 of the 32 pairs of inputs exhibiting that difference may result in the same output difference.

This is a criterion similar to the previous one, but for the case of three S-boxes.

Page 49: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

49

DES Design Criteria

The criteria for the permutation P The four output bits from each S-box at round i are distributed so that two

of them affect “middle bits” of round (i + 1) and the other two affect end

bits. The two middle bits of input to an S-box are not shared with adjacent

S-boxes. The end bits are the two left-hand bits and the two right-hand

bits, which are shared with adjacent S-boxes.

The four output bits from each S-box affect six different S-boxes on the

next round, and no two affect the same S-boxes.

For two S-boxes j, k, if an output bit from Sj affects a middle bit of Sk on the

next round, then an output bit from Sk cannot affect a middle bit of Sj .

These criteria are intended to increase the diffusion of the algorithm.

Page 50: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

50

Number of Rounds

The greater the number of rounds, the more difficult it is to perform cryptanalysis, even for a relatively weak F.

This criterion is attractive because it makes it easy to judge the strength of an algorithm and to compare different algorithms.

Page 51: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

51

Design of Function F

The heart of a Feistel block cipher is the function F.

The function F provides the element of confusion. One obvious criterion is that F be nonlinear.

The more nonlinear F, the more difficult.

Have good avalanche properties. Strict Avalanche Criterion (SAC)

The bit independence criterion (BIC) States that output bits j and k should change independently

when any single input bit i is inverted, for all i, j, and k.

Page 52: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

52

S-Box Design

One of the most intense areas of research.

One obvious characteristic of the S-box is its size. An n m S-box has n input bits and m output bits.

DES has 6 4 S-boxes. Blowfish has 8 32 S-boxes.

Larger S-boxes are more resistant to differential and linear cryptanalysis. For practical reasons, a limit of n equal to about 8 to 10 is

usually imposed.

Page 53: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

53

S-Box Design

S-boxes are typically organized in a different manner than used in DES. An n m S-box typically consists of 2n rows of m bits each. Example, in an 8 32 S-box

If the input is 00001001, the output consists of the 32 bits in row 9.

Page 54: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

54

S-Box Design

Mister and Adams proposed for S-box design. S-box should satisfy both SAC and BIC. All linear combinations of S-box columns should be bent.

Bent functions A special class of Boolean functions that are highly nonlinear

according to certain mathematical criteria.

Increasing interest in designing and analyzing S-boxes using bent functions.

Page 55: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

55

S-Box Design

Heys, H. and Tavares, S. proposed for S-boxes. Guaranteed avalanche (GA) criterion An S-box satisfies GA of order if, at least output bits

change. Conclude that a GA in the range of order 2 to order 5

provides strong diffusion characteristics for the overall encryption algorithm.

Page 56: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

56

S-Box Design

Best method of selecting the S-box entries. Nyberg suggests the following approaches.

Random Use some pseudorandom number generation or some table of

random digits to generate the entries in the S-boxes. Random with testing

Choose S-box entries randomly, then test the results against various criteria, and throw away those that do not pass.

Human-made This is a more or less manual approach with only simple

mathematics to support it. This approach is difficult to carry through for large S-boxes.

Math-made Generate S-boxes according to mathematical principles.

Page 57: 1 Chapter 3 Block Ciphers & The Data Encryption Standard.

57

Key Schedule Algorithm

With any Feistel block cipher, the key is used to

generate one subkey for each round.

We would like to select subkeys to maximize the

difficulty of deducing individual subkeys and the

difficulty of working back to the main key.

No general principles have not been proposed.

Hall suggests that the key schedule should guarantee

key/ciphertext Strict Avalanche Criterion and Bit

Indepence Criterion.