240 likes | 252 Views
Learn about stream ciphers, block ciphers, confusion, diffusion, cryptanalysis, symmetric-key algorithms, DES, AES, and cipher modes in secure and dependable computing.
E N D
EEC 688/788Secure and Dependable Computing Lecture 5 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University wenbing@ieee.org
Outline • Reminder • Lab0, Wednesday 2/11 • Stream and block Ciphers • Confusion and diffusion • Symmetric-key algorithms • Cipher modes EEC688: Secure & Dependable Computing
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 EEC688: Secure & Dependable Computing
Block 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 EEC688: Secure & Dependable Computing
Confusion and Diffusion • Confusion: An algorithm providing good confusion has a complex functional relationship between the plaintext/key pair and the ciphertext • The interceptor should not be able to predict what will happen to the ciphertext by changing one character in the plaintext • Question: Does Caesar cipher provide good confusion? How about monoalphabetic cipher? How about one-time pad? EEC688: Secure & Dependable Computing
Confusion and Diffusion • Diffusion: distributing the information from single plaintext letters over the entire output • Good diffusion means that the interceptor needs access to much of the ciphertext to be able to infer the algorithm • Diffusion is associated with dependency of bits of the output on bits of the input. In a cipher with good diffusion, flipping an input bit should change each output bit with a probability of one half • Question: Which one provides better diffusion? • Substitution cipher • Transposition cipher EEC688: Secure & Dependable Computing
Cryptanalysis –Breaking Encryption Schemes • Ciphertext-only: cryptanalyst has a quantity of ciphertext and no plaintext • Known plaintext: cryptanalyst has some matched ciphertext and plaintext • Chosen plaintext: cryptanalyst has the ability to encrypt pieces of plaintext of his own choosing EEC688: Secure & Dependable Computing
Symmetric-Key Algorithms • DES – The Data Encryption Standard • AES – The Advanced Encryption Standard • Other Ciphers • Cipher Modes EEC688: Secure & Dependable Computing
Data Encryption Standard • Developed by IBM. US standard for unclassified info(1977) • Same key for encryption as for decryption • Encrypts in 64-bit blocks • Uses 56-bit key • Has 19 stages, 16 parameterized by different functions of the key EEC688: Secure & Dependable Computing
Triple DES • Triple DES – effectively increases the key length. It uses two keys and three stages • In first stage, the plaintext is encrypted using DES in the usual way with K1 • In second stage, DES is run in decryption mode, using K2 as the key • In third stage, another DES encryption is done with K1 Triple DES encryption Triple DES decryption EEC688: Secure & Dependable Computing
AES – The Advanced Encryption Standard • AES is a result of a cryptographic contest • Organized by NIST in 1997 • Rules for AES proposals • The algorithm must be a symmetric block cipher • The full design must be public • Key lengths of 128, 192, and 256 bits supported • Both software and hardware implementations required • The algorithm must be public or licensed on nondiscriminatory terms • Winner: Rijndael (from two Belgian cryptographers: Joan Daemen and Vincent Rijmen) EEC688: Secure & Dependable Computing
Other Symmetric-Key Ciphers EEC688: Secure & Dependable Computing
Cipher Modes • AES and DES (or any block cipher) 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 EEC688: Secure & Dependable Computing
Electronic 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 EEC688: Secure & Dependable Computing
Electronic Code Book Mode - Problems • 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 EEC688: Secure & Dependable Computing
Cipher 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: • 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 EEC688: Secure & Dependable Computing
Cipher 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. Initialization Vector Decryption Encryption EEC688: Secure & Dependable Computing
Cipher 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 • Drawback: One byte of transmission error will ruin 8 bytes of data EEC688: Secure & Dependable Computing
Cipher Feedback Mode Encryption Decryption EEC688: Secure & Dependable Computing
Stream 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 EEC688: Secure & Dependable Computing
Stream Cipher Mode Encryption Decryption EEC688: Secure & Dependable Computing
Stream 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 EEC688: Secure & Dependable Computing
Keystream 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 EEC688: Secure & Dependable Computing
Counter 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 EEC688: Secure & Dependable Computing