Top Banner
Chapter 4: Modes of Operation CS 472: Fall 2012
23

Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.

Mar 29, 2015

Download

Documents

Sally Malin
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: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.

Chapter 4: Modes of Operation

CS 472: Fall 2012

Page 2: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.

Encrypting a Large Massage 1. Electronic Code Book (ECB)

2. Cipher Block Chaining (CBC)

3. Output Feedback Mode (OFB)

4. Cipher Feedback Mode (CFB)

Page 3: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.

Electronic Code Book (ECB)

• Break the message into 64-bit blocks (padding the last one) and encrypt each block with the secret key.

• Two problems:

• 1. two identical plain text block produce two identical cipher blocks 2. blocks can be rearranged or modified.

• Example: See Figure 4-3 where an eavesdropper:

1. can see which sets of employees have identical or similar salaries and 2. he can alter his own salary to match another employee with higher salary.

Page 4: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.
Page 5: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.

Cipher Block Chaining (CBC) • Two identical plain messages produce two

different cipher messages. (e.g., continue holding, continue holding, ....., start attach) This prevents Chosen plain text attack.

Page 6: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.
Page 7: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.

CBC Threat 1

• Modifying Cipher Blocks: Fig. 4-3You can modify the contents of one cipher block  (c6) to make the plain text (m7) as you wish, however the preceding block (m6) will be garbled, as shown:

Page 8: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.

Thus  if cn is garbled then mn will be completely garbed.

Only the same portion of mn+1 as what was garbled in cn will be garbed.

This can be solved by attaching a CRC to the plain text before encryption.

Page 9: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.

CBC Threat 2: Rearranging Ciphertext Blocks

• If a hacker knows the plain text and the corresponding cipher text; i.e., m1, m2, …,mn and c1,c2,…,cn; and IV.

• By rearranging c1, c2, …, cn, the intruder can garble the message.

• Solution: Use a 64-bit CRC

Page 10: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.

Output Feedback Mode (OFB) • It is a stream cipher

• Encryption/decryption is performed by ®ing the message with one-time pad generated as follows:  

• 1. A 64-bit random IV is generated (and is transmitted with the encrypted message). 2. b1 is the DES encryption of IV with the secret key.

3. bi , i > 1, is the  DES encryption of bi-1 with secret key.

4. The resulting one-time pad is: b1 | b2 | b3 | ....... 5.  ci = bi ®  mi for i =1, 2, ...

Page 11: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.

Output Feedback Mode (OFB)

Page 12: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.

Major  advantages of OFB:  

• The pad can be generated in advance and used when the message arrive. If some bits of cipher text get garbled, only the corresponding bits in the plain text get garbled.

• Major disadvantages of OFB:  

o if the <plaintext P, ciphertext (P®K) > are known by Trudy, she can modify the plain text into anything she wants (P') since: ((P ® K) ® P) ® P' ) ® K = P'

o If one block is lost, the rest of the blocks will be garbled.o If data is stored on disk, you can not randomly read any block unless

you decrypt all the preceding blocks. • To solve the last  two problems, we use CFB below, where if one

block is lost, only the next block is  garbled and the rest of the blocks will decrypt properly.

Page 13: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.

Cipher Feedback Mode (CFB)

• . A 64-bit random IV is generated (and is transmitted with the encrypted message). 2. b1 is the DES encryption of IV with the secret key. 3. bi , i > 1, is the  DES encryption of ci-1

with secret key.    (Thus you can't generate a one-time pad in advance like OFB) 4.  ci = bi ®  mi for i =1, 2, ...

Page 14: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.
Page 15: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.
Page 16: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.

Counter Mode (CTR) • See Figure 4-10,   CTR have the following

advantages:

o You can generate the one-time pad in advance.

o You can randomly access any block without decrypting all the preceding  blocks

Page 17: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.
Page 18: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.

Generating MACs

• A secret key system can be used to generate a cryptographic checksum MAC (message authentication code) or MIC (message integrity code).

Page 19: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.

Ensuring Integrity Only

• Send  Plain text + CBC residue: (figure 4-11) The receiver computes the CBC residue from the plain text and compare it with

the received CBC residue.

Page 20: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.

Ensuring Privacy & Integrity Together o Use CRC (figure 4-14), CRC is generally

is known to be vulnerable to attacks.

o Use a different key to encrypt the message (the two keys can be independent or related)

Page 21: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.
Page 22: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.

Multiple Encryption DES • It is called 3DES or EDE (encrypt-decrypt-

encrypt):  

• m>>>> E >>>> D >>>> E >>>>c                |             |             |              K1         K2        K1                |             |             | c >>>> E >>>> D >>>> E >>>> m

• CBC is used for stream encryption as shown in Figure 4-15:  

Page 23: Chapter 4: Modes of Operation CS 472: Fall 2012. Encrypting a Large Massage 1.Electronic Code Book (ECB) 2.Cipher Block Chaining (CBC) 3.Output Feedback.