Block Cipher Modes, Integrity




CS166

Chris Pollett

Sep. 12, 2012

Outline

Multiple Blocks

Modes of Operation

There are many solutions to this problem -- we discuss three most popular:

ECB Mode

ECB Cut and Paste

ECB Weakness

Alice Hates ECB Mode

Consider the following pair of images of Alice in Wonderland, one the original uncompressed image, one which is ECB encrypted using TEA:
Image of Alice in Wonderland original and ECB encrypted

As you can see, encrypted it still looks like Alice -- the blocks of the image contain relatively few pixels, and a given pattern of pixels will always encrypt in the same way!

Hw Problem

Problem 3.7 The RC4 cipher consists of a lookup table S, which contains 256 byte values, and two indices, i and j.

  1. The lookup table S is initial identity permutation 0, 1, ..., 255 and at each step of the algorithm S contains a permutation. How is this achieved? That is, why does S always have a permutation?
  2. Where is RC4 used in the real world?

Solution. (1) There are two places in the algorithm in which the array S is changed. The first is during the initialization phase where swap(S[i], S[j]); for each 0 ≤ i < 256 and where 0 ≤ j < 256 is determined by a linear function. If the array starts off with each of that values from 0 to 255, a swap preserve the property that for each value between 0 to 255 there is some index with that value. i.e., that we still have a permutation. So after 256 such swaps we still have a permutation. The second place where S is modified is while we are computing the bytestream. Again, the operation is a swap, so the property of being a permutation will be preserved.

(2) According to Wikipedia, RC4 is used in WEP, WPA, and SSL (optionally). It can be used in PDF and is used in a modified form in Skype.

Cipher Block Chaining (CBC) Mode (IBM - 1976)

CBC Mode Remarks

Alice Likes CBC Mode

Performing the same experiment we did with ECB mode, but instead using CBC yields much better results...
Image of Alice in Wonderland original and CBC encrypted

Because the same block of plaintext is not always encoded in the same way.

Counter Mode (CTR)

Data Integrity

Message Authentication Code (MAC)

MAC Computation

Let's assume the message was `N` blocks long. To compute its MAC, we compute:
`C_0 = E(IV oplus P_0, K),`
`C_1 = E(C_0 oplus P_1, K),`
`C_2 = E(C_1 oplus P_2, K),`
`...`
`C_(N-1) = E(C_(N-2) oplus P_(N-1), K) = MAC`

Does a MAC work?

Suppose Alice has four blocks of plaintext:

Confidentiality and Integrity

Uses for Symmetric Crypto

We wrap-up talking about symmetric crypto by giving some of its uses: