150 likes | 301 Views
Encryption Types & Modes Chapter 9. Encryption Types Stream Ciphers Block Ciphers Encryption Modes ECB - Electronic Codebook CBC - Cipher Block Chaining CFB - Cipher Feedback OFB - Output Feedback. Stream Ciphers. One unit of the data stream is encrypted at a time.
E N D
Encryption Types & ModesChapter 9 Encryption Types • Stream Ciphers • Block Ciphers Encryption Modes • ECB - Electronic Codebook • CBC - Cipher Block Chaining • CFB - Cipher Feedback • OFB - Output Feedback
Stream Ciphers One unit of the data stream is encrypted at a time. Most often the unit is a byte. Some comm systems it is one bit. Keystream Generator Keystream Generator Ki Ki Keystream Keystream Plaintext Plaintext Ciphertext Pi Pi Å Å Ci
Block Ciphers Block ciphers encrypt a block of data at a time Usually the blocks are 64 bits or 8 bytes or 128 bits (16 bytes) • Computationally efficient • Requires padding at the end of a message B1 ... Bi Padding ... Bn
Electronic Codebook Mode (ECB) 64 bit (8 byte) blocks Ci-1 Ci Ci+1 Pi-1 Pi Pi+1 Ek Ek Dk Dk Ek Dk Ci-1 Ci Ci+1 Pi-1 Pi Pi+1 Ciphertext = (C0C1 ... Cn)
Block Replay (ECB) 1 2 3 4 5 6 7 8 9 10 11 12 13 TS Sending Bank Receiving Bank Depositers Name Acc't # Amount Through many intercepted tansmissions you learn that blocks 2, 3, and 4 never change. Block 1 always changes. By making your own deposits you know where your name is, your acc't # is and the amount is. Then you substitute your info where it is supposed to go.
Cipher Block Chaining Mode (CBC) Encryption Decryption P0 = IVÅ Dk(C0) C0 = Ek(P0Å IV) Pi = Ci-1Å Dk(Ci) Ci = Ek(PiÅ Ci-1) Ci+1 Ci Ci-1 P0 Pi-1 Pi Pi+1 Ci-2 Å Å Å Å IV Ek Ek Ek Dk Dk Ek Dk Å Å Ci-2 Å Ci-1 Ci Ci+1 Pi Pi+1 C0 Pi-1 Ciphertext = (IV C0C1 ... Cn)
CBC – Last Block(without padding) Pn-2 Pn-1 Pn(j-bits long) Å Å Ek Ek Ek Select left j bits Å Cn-2 Cn-1 Cn(j-bits long)
CBC – Initialization Vector • Without the IV every encryption of a plaintext encrypts the same. • With the IV being a random number they are all different • The IV does not have to be random nor unique, but. • The IV need not remain secret (it is XORed with block 0) • The time stamp makes a good IV. • It need not be random, just not predictable
CBC – Error Propagation • 1 bit error in the plaintext feed • Will affect that block and all others • Decryption will correct all but the flipped bit • 1 bit error in the ciphertext feed • Will affect that block • 1 bit of recovered plaintext • CBC mode is self recovering
Cipher Feedback Mode (CFB) Encryption Decryption C0 = P0ÅEk(IV) P0 = Ek(IV) Å C0 Ci = PiÅEk(Ci-1) Pi = CiÅ Ek(Ci-1) Ci-1 Pi-1 Pi Pi+1 Ci Ci+1 P0 Ek Ek Ek Ek Ek Å Å Å Å Å Ci-2 Å IV Ci-1 Ci+1 Pi Pi+1 C0 Ci Ciphertext = (IV C0C1 ... Cn)
CFB – Initialization Vector • CFB must use an IV • The IV does not have to be random but must be unique • The IV need not remain secret (it is XORed with block 0) • The IV must be changed with every message. • Must not be repeated during the lifetime of the key.
CFB – Error Propagation • CFB mode is self recovering • An error corrupts 1 block of data
Output Feedback Mode (OFB) Encryption Decryption C0 = P0ÅEk(IV) P0 = Ek(IV) Å C0 Ci = PiÅEk(Si-1) Pi = CiÅ Ek(Si-1) Pi-1 Pi Pi+1 P0 Å Å Å Å Ek Ek Ek Ek Ci-2 Note: The plaintext is never encrypted. IV and succesive encryptions act as an onetime pad generator. The IV does not have to remain secret IV Ci-1 Ci Ci+1 C0 Ciphertext = (IV C0C1 ... Cn)
OFB – Error Propagation • 1 bit error in the ciphertext feed • causes a single bit error in the plaintext recovery
Block Cipher ModesSummary • ECB • CBC • CFB • OFB