eec 688/788 secure and dependable computing

21
EEC 688/788 EEC 688/788 Secure and Dependable Secure and Dependable Computing Computing Lecture 4 Lecture 4 Wenbing Zhao Wenbing Zhao Department of Electrical and Computer Department of Electrical and Computer Engineering Engineering Cleveland State University Cleveland State University [email protected] [email protected]

Upload: kristen-haynes

Post on 31-Dec-2015

33 views

Category:

Documents


3 download

DESCRIPTION

EEC 688/788 Secure and Dependable Computing. Lecture 4 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University [email protected]. Outline. Cipher modes. 11/13/2014. EEC688: Secure & Dependable Computing. Wenbing Zhao. Stream Ciphers. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: EEC 688/788 Secure and Dependable Computing

EEC 688/788EEC 688/788Secure and Dependable Secure and Dependable ComputingComputing

Lecture 4Lecture 4

Wenbing ZhaoWenbing ZhaoDepartment of Electrical and Computer EngineeringDepartment of Electrical and Computer Engineering

Cleveland State UniversityCleveland State University

[email protected]@ieee.org

Page 2: EEC 688/788 Secure and Dependable Computing

04/19/2304/19/23 EEC688: Secure & Dependable ComputingEEC688: Secure & Dependable Computing Wenbing ZhaoWenbing Zhao

OutlineOutline

Cipher modes

Page 3: EEC 688/788 Secure and Dependable Computing

04/19/2304/19/23 EEC688: Secure & Dependable ComputingEEC688: Secure & Dependable Computing Wenbing ZhaoWenbing Zhao

Stream Ciphers Stream Ciphers Stream ciphers: convert one symbol of plaintext immediately into

a symbol of ciphertext The transformation depends only on the symbol, the key, and the

control information of the encryption algorithm

Page 4: EEC 688/788 Secure and Dependable Computing

04/19/2304/19/23 EEC688: Secure & Dependable ComputingEEC688: Secure & Dependable Computing Wenbing ZhaoWenbing Zhao

Block CiphersBlock Ciphers Block cipher: encrypts a group of plaintext symbols as one block

It works on blocks of plaintext and produce blocks of ciphertext The columnar transposition is an example of block ciphers

Page 5: EEC 688/788 Secure and Dependable Computing

04/19/2304/19/23 EEC688: Secure & Dependable ComputingEEC688: Secure & Dependable Computing Wenbing ZhaoWenbing Zhao

Cipher ModesCipher Modes A block cipher (e.g., AES & DES) is basically a

monoalphabetic substitution cipher using big characters Whenever the same plaintext block goes in the front end,

the same ciphertext block comes out the back end If you encrypt the plaintext abcdefgh 100 times with same

DES key, you get the same ciphertext 100 times An intruder can exploit this property to help subvert the

cipher

Page 6: EEC 688/788 Secure and Dependable Computing

04/19/2304/19/23 EEC688: Secure & Dependable ComputingEEC688: Secure & Dependable Computing Wenbing ZhaoWenbing Zhao

Electronic Code Book ModeElectronic Code Book Mode In ECB mode, each plaintext block is encrypted independently with

the block cipher ECB allows easy parallelization to yield higher performance.

However, no processing is possible before a block is seen

Page 7: EEC 688/788 Secure and Dependable Computing

04/19/2304/19/23 EEC688: Secure & Dependable ComputingEEC688: Secure & Dependable Computing Wenbing ZhaoWenbing Zhao

Electronic Code Book Mode - Electronic Code Book Mode - ProblemsProblems In ECB, plaintext patterns are not concealed

Each identical block of plaintext gives an identical block of ciphertext. The plaintext can be easily manipulated by removing, repeating, or interchanging blocks

Example

Page 8: EEC 688/788 Secure and Dependable Computing

04/19/2304/19/23 EEC688: Secure & Dependable ComputingEEC688: Secure & Dependable Computing Wenbing ZhaoWenbing Zhao

Cipher Block Chaining ModeCipher Block Chaining Mode To avoid the ECB mode problem: replacing a block

will cause the plaintext decrypted starting at the replaced to become garbage

Exclusive OR the encrypted text with the next block of plaintext before encryption: Need an initialization vector (IV) to boostrap

C0 = E(P0 XOR IV), C1 = E(P1 XOR C0), etc.

Drawback: must wait until full 64-bit (128-bit) block to arrive to decrypt

Page 9: EEC 688/788 Secure and Dependable Computing

04/19/2304/19/23 EEC688: Secure & Dependable ComputingEEC688: Secure & Dependable Computing Wenbing ZhaoWenbing Zhao

Cipher Block Chaining ModeCipher Block Chaining Mode Exclusive OR the encrypted text with the next block

of plaintext before encryption: C0 = E(P0 XOR IV), C1 = E(P1 XOR C0), etc.

InitializationVector

Encryption Decryption

Page 10: EEC 688/788 Secure and Dependable Computing

04/19/2304/19/23 EEC688: Secure & Dependable ComputingEEC688: Secure & Dependable Computing Wenbing ZhaoWenbing Zhao

Cipher Feedback ModeCipher Feedback Mode Basic operation (Pi and Ci are blocks):

Ci = E(Ci-1) XOR Pi, Pi = E(Ci-1) XOR Ci, C0 = IV Issue: Losing a single bit or byte will ruin all data after that

Page 11: EEC 688/788 Secure and Dependable Computing

04/19/2304/19/23 EEC688: Secure & Dependable ComputingEEC688: Secure & Dependable Computing Wenbing ZhaoWenbing Zhao

Cipher Feedback ModeCipher Feedback Mode To enable byte-by-byte encryption

When plaintext byte n (Pn) arrives, DES algorithm operates a 64-bit register to generate a 64-bit ciphertext

Leftmost byte of that ciphertext is extracted and XORed with Pn

That byte is transmitted on the transmission line The shift register is shifted left 8 bits, causing Cn-8 to fall off

the left end, and Cn is inserted in the position just vacated at the right end by C9

Page 12: EEC 688/788 Secure and Dependable Computing

04/19/2304/19/23 EEC688: Secure & Dependable ComputingEEC688: Secure & Dependable Computing Wenbing ZhaoWenbing Zhao

Cipher Feedback ModeCipher Feedback Mode

Encryption Decryption

Page 13: EEC 688/788 Secure and Dependable Computing

04/19/2304/19/23 EEC688: Secure & Dependable ComputingEEC688: Secure & Dependable Computing Wenbing ZhaoWenbing Zhao

Stream Cipher ModeStream Cipher Mode To be insensitive to transmission error, an arbitrarily

large sequence of output blocks, called the keystream, is treated like a one-time pad and XORed with the plaintext to get the ciphertext It works by encrypting an IV, using a key to get an output

block The output block is then encrypted, using the key to get a

second output block This block is then encrypted to get a third block, and so on

The keystream is independent of the data, so (1) It can be computed in advance (2) It is completely insensitive to transmission errors

Page 14: EEC 688/788 Secure and Dependable Computing

04/19/2304/19/23 EEC688: Secure & Dependable ComputingEEC688: Secure & Dependable Computing Wenbing ZhaoWenbing Zhao

Stream Cipher ModeStream Cipher Mode

Encryption Decryption

Page 15: EEC 688/788 Secure and Dependable Computing

04/19/2304/19/23 EEC688: Secure & Dependable ComputingEEC688: Secure & Dependable Computing Wenbing ZhaoWenbing Zhao

Stream Cipher ModeStream Cipher Mode It is essential never to use the same (key, IV) pair

twice with a stream cipher because doing so will generate the same keystream each time

Using the same keystream twice exposes the ciphertext to a keystream reuse attack

Stream cipher mode is also called output feedback mode

Page 16: EEC 688/788 Secure and Dependable Computing

04/19/2304/19/23 EEC688: Secure & Dependable ComputingEEC688: Secure & Dependable Computing Wenbing ZhaoWenbing Zhao

Keystream Reuse AttackKeystream Reuse Attack Plaintext block, P0, is encrypted with the keystream to get P0

XOR K0 Later, a second plaintext block, Q0, is encrypted with the same

keystream to get Q0 XOR K0

An intruder who captures both ciphertext blocks can simply XOR them together to get P0 XOR Q0, which eliminates the key

The intruder now has the XOR of the two plaintext blocks If one of them is known or can be guessed, the other can also be

found In any event, the XOR of two plaintext streams can be attacked

by using statistical properties of the message

Page 17: EEC 688/788 Secure and Dependable Computing

04/19/2304/19/23 EEC688: Secure & Dependable ComputingEEC688: Secure & Dependable Computing Wenbing ZhaoWenbing Zhao

Counter ModeCounter Mode To allow random access to encrypted data

The IV plus a constant is encrypted, and the resulting ciphertext XORed with the plaintext

By stepping the IV by 1 for each new block, it is easy to decrypt a block anywhere in the file without first having to decrypt all of its predecessors

Page 18: EEC 688/788 Secure and Dependable Computing

04/19/2304/19/23 EEC693: Secure and Dependable ComputingEEC693: Secure and Dependable Computing Wenbing ZhaoWenbing Zhao

ExerciseExercise

Q1. Assuming that the DES block cipher is used in the Electronic Code Book mode. If one bit in a block of ciphertext is inverted during transmission, how many bits will likely be damaged after decryption at the receiver?

Page 19: EEC 688/788 Secure and Dependable Computing

04/19/2304/19/23 EEC693: Secure and Dependable ComputingEEC693: Secure and Dependable Computing Wenbing ZhaoWenbing Zhao

ExerciseExercise

Q2. Assuming that the DES block cipher is used in the Cipher Block Chaining mode. If one bit of ciphertext is inverted during transmission, how many bits will likely be damaged after decryption at the receiver?

Page 20: EEC 688/788 Secure and Dependable Computing

04/19/2304/19/23 EEC693: Secure and Dependable ComputingEEC693: Secure and Dependable Computing Wenbing ZhaoWenbing Zhao

ExerciseExercise

Q3. Assuming that the DES block cipher is used in the Cipher Feedback mode. If one bit of ciphertext is inverted during transmission, how many bits will likely be damaged after decryption at the receiver (for both variations)?

Page 21: EEC 688/788 Secure and Dependable Computing

04/19/2304/19/23 EEC693: Secure and Dependable ComputingEEC693: Secure and Dependable Computing Wenbing ZhaoWenbing Zhao

ExerciseExercise

Q4. Assuming that the DES block cipher is used in the Stream Cipher mode (it is also called output feedback mode). If one bit of ciphertext is inverted during transmission, how many bits will likely be damaged after decryption at the receiver?