Algorithm Modes ECB, CBC, CFB, OFB.

Slides:



Advertisements
Similar presentations
Cryptography and Network Security Chapter 6 Block Cipher Modes of Operation Lecture slides by Lawrie Brown for “Cryptography and Network Security”, 5/e,
Advertisements

Block Cipher Modes of Operation and Stream Ciphers
ECE454/CS594 Computer and Network Security
“Advanced Encryption Standard” & “Modes of Operation”
Modern Symmetric-Key Ciphers
Modern Symmetric-Key Ciphers
Cryptography and Network Security Chapter 6 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Cryptography and Network Security Chapter 6. Chapter 6 – Block Cipher Operation Many savages at the present day regard their names as vital parts of themselves,
Cryptography1 CPSC 3730 Cryptography Chapter 6 Triple DES, Block Cipher Modes of Operation.
1 Lect. 9 : Mode of Operation. 2 Modes of Operation – ECB Mode  Electronic Code Book Mode Break a message into a sequence of plaintext blocks Each plaintext.
Chapter 3 – Block Ciphers and the Data Encryption Standard Jen-Chang Liu, 2004 Adopted from lecture slides by Lawrie Brown.
EEC 693/793 Special Topics in Electrical Engineering Secure and Dependable Computing Lecture 5 Wenbing Zhao Department of Electrical and Computer Engineering.
Cryptography and Network Security Chapter 6
Computer Networking Lecture 21: Security and Cryptography Thanks to various folks from , semester’s past and others.
Lecture 23 Symmetric Encryption
CSCE 790G: Computer Network Security Chin-Tser Huang University of South Carolina.
Block Cipher Transmission Modes CSCI 5857: Encoding and Encryption.
Modes of Operation. Topics  Overview of Modes of Operation  EBC, CBC, CFB, OFB, CTR  Notes and Remarks on each modes.
Applied Cryptography Example: AES. Advanced Encryption Standard "It seems very simple." "It is very simple. But if you don't know what the key is it's.
Cryptography and Network Security Chapter 6. Multiple Encryption & DES  clear a replacement for DES was needed theoretical attacks that can break it.
Slide 1 Stream Ciphers uBlock ciphers generate ciphertext Ciphertext(Key,Message)=Message  Key Key must be a random bit sequence as long as message uIdea:
Chapter 20 Symmetric Encryption and Message Confidentiality.
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
3DES and Block Cipher Modes of Operation CSE 651: Introduction to Network Security.
Multiple Encryption & DES  clearly a replacement for DES was needed Vulnerable to brute-force key search attacks Vulnerable to brute-force key search.
Chapter 9: Algorithms Types and Modes Dulal C. Kar Based on Schneier.
Encryption Types & Modes Chapter 9 Encryption Types –Stream Ciphers –Block Ciphers Encryption Modes –ECB - Electronic Codebook –CBC - Cipher Block Chaining.
More About DES Cryptography and Network Security Reference: Sec 3.1 of Stallings Text.
Data Encryption Standard (DES) © 2000 Gregory Kesden.
Chapter 2 (B) – Block Ciphers and Data Encryption Standard.
Lecture 4 Page 1 CS 236 Stream and Block Ciphers Stream ciphers convert one symbol of plaintext immediately into one symbol of ciphertext Block ciphers.
1.1 Chapter 8 Encipherment Using Modern Symmetric-Key Ciphers Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Modes of Operation INSTRUCTOR: DANIA ALOMAR. Modes of Operation A block cipher can be used in various methods for data encryption and decryption; these.
Data Security and Encryption (CSE348) 1. Lecture # 13 2.
Stream Ciphers and Block Ciphers A stream cipher is one that encrypts a digital data stream one bit or one byte at a time. Examples of classical stream.
Cryptography and Network Security Chapter 6 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Lecture 23 Symmetric Encryption
Privacy and Integrity: “ Two Essences of Network Security” Presenter Prosanta Gope Advisor Tzonelih Hwang Quantum Information and Network Security Lab,
Lecture 4 Page 1 CS 236 Stream and Block Ciphers Stream ciphers convert one symbol of plaintext immediately into one symbol of ciphertext Block ciphers.
Cipher Transmission and Storage Modes Part 2: Stream Cipher Modes CSCI 5857: Encoding and Encryption.
Block Cipher Modes Last Updated: Aug 25, ECB Mode Electronic Code Book Divide the plaintext into fixed-size blocks Encrypt/Decrypt each block independently.
Modes of Operation block ciphers encrypt fixed size blocks – eg. DES encrypts 64-bit blocks with 56-bit key need some way to en/decrypt arbitrary amounts.
Block Cipher Encrypting a large message Electronic Code Book (ECB) message m1 m2 m3 m4 m5 m6 c1 c2 c3 c4 c5 c6 E E E Secret.
CS480 Cryptography and Information Security
Modes of Operation.
Computer and Network Security
CSCE 715: Network Systems Security
(Data Encryption Standard)
Chapter 6 – Block Cipher Operation
Cryptography and Network Security Chapter 6
Cryptography and Network Security Chapter 6
Outline Desirable characteristics of ciphers Stream and block ciphers
Block Cipher Modes CS 465 Make a chart for the mode comparisons
PART VII Security.
Cryptography and Network Security
Cryptography and Network Security Chapter 6
Algorithm Types & Algorithm Modes
Cryptography and Network Security Chapter 6
Cryptography and Network Security Chapter 6
Block vs Stream Ciphers
Cryptography and Network Security Chapter 6
ADVANCED ENCRYPTION STANDARDADVANCED ENCRYPTION STANDARD
Block Ciphers (Crypto 2)
Cryptography and Network Security Chapter 6
Counter Mode, Output Feedback Mode
Elect. Codebook, Cipher Block Chaining
Review of Cryptography: Symmetric and Asymmetric Crypto Advanced Network Security Peter Reiher August, 2014.
Secret-Key Encryption
Presentation transcript:

Algorithm Modes ECB, CBC, CFB, OFB

Two Key Aspects of Algorithm Algorithm type :- It defines what should be the size of PT. Stream Block Algorithm Modes:- It defines the details of the cryptographic Algorithm. It is a combination of the basic steps on block cipher & some kind of feedback from previous step

Algorithm Modes

1.ECB Encryption Process:- PT divided 64 bits each. Encrypted Independently Same key Decryption Process:- Divide Same Key PT Limitation:- If Repeated PT Then Repeated CT Small Messages where the scope of repeating quite less.

Electronic Codebook Book (ECB) Message is broken into independent blocks which are encrypted Each block is a value which is substituted, like a codebook, hence name Each block is encoded independently of the other blocks Ci = K1(Pi) Uses: transmission of single values.(i.e;-PW or key for E/D) in secure fashion. E=Encryption , D= Decryption ECB is the simplest of the modes, where each block is en/decrypted independently of all the other blocks, and is used when only a single block of info needs to be sent (eg. a session key encrypted using a master key).

Electronic Codebook Book (ECB) Stallings Fig 3-11.

Electronic Code Book (ECB) Mode Plaintext Block 1 Block 2 Block 3 Block 4 Block 5 … E(block) E(block) E(block) E(block) E(block) E(block) Block Encryption Ciphertext Block 1 Block 2 Block 3 Block 4 Block 5 … Pad last block, if necessary

Advantages and Limitations of ECB Repetitions in message may show in cipher text if aligned with message block particularly with data such graphics Or with messages that change very little, which become a code-book analysis problem . weakness due to encrypted message blocks being independent. main use is sending a few blocks of data. ECB is not appropriate for any quantity of data, since repetitions can be seen, esp. with graphics, and because the blocks can be shuffled/inserted without affecting the en/decryption of each block.

2.CBC Different CT for every PT including identical/repeat PT. Feed back Mechanism used(i.e: Chaining). Initialization Vector(IV) for creating unique message. Random Block called IV can be XOR with plain text in First step. Not a secret – just prevents a codebook. Often times a timestamp. I/O-> IV XOR PT Block 1 = CT Block 1<- we can call it as New IV for next step. Same key Dependent on previous one.

Cipher Block Chaining (CBC) Message is broken into blocks But these are linked together in the encryption operation Each previous cipher blocks is chained with current plaintext block, hence name Use Initial Vector (IV) to start process (Block 1) C-1 = IV Ci = K1(Pi XOR IV ) From block 2 Ci = K1(Pi XOR Ci-1) Uses: bulk data encryption, authentication To overcome the problems of repetitions and order independence in ECB, want some way of making the ciphertext dependent on all blocks before it. This is what CBC gives us, by combining the previous ciphertext block with the current message block before encrypting. To start the process, use an Initial Value (IV), which is usually well known (often all 0's), or otherwise is sent, ECB encrypted, just before starting CBC use. CBC mode is applicable whenever large amounts of data need to be sent securely, provided that its available in advance (eg email, FTP, web etc)

Cipher Block Chaining (CBC) Mode Plaintext Random Block 1 Block 2 Block 3 Block 4 … XOR XOR XOR XOR XOR E(block) E(block) E(block) E(block) E(block) Block Encryption Ciphertext Block 2 Block 3 Block 4 Block 5 … Pad last block, if necessary

Cipher Block Chaining (CBC) Stallings Fig 3-12.

Advantages and Limitations of CBC Each cipher text block depends on all message blocks Thus a change in the message affects all cipher text blocks after the change as well as the original block Need Initial Value (IV) known to sender & receiver However if IV is sent in the clear, an attacker can change bits of the first block, and change IV to compensate Hence either IV must be a fixed value or it must be sent encrypted in ECB mode before rest of message At end of message, handle possible last short block By padding either with known non-data value (eg nulls) Or pad last block with count of pad size eg. [ b1 b2 b3 0 0 0 0 5] <- 3 data bytes, then 5 bytes pad+count CBC is the generally used block mode. The chaining provides an avalanche effect, which means the encrypted message cannot be changed or rearranged without totally destroying the subsequent data. One issue is how to handle the last block, which may well not be complete. In general have to pad this block (typically with 0's), and then must recognise padding at other end - may be obvious (eg in text the 0 value should usually not occur), or otherwise must explicitly have the last byte as a count of how much padding was used (including the count). Note that if this is done, if the last block IS an even multiple of 8 bytes, will have to add an extra block, all padding so as to have a count in the last byte.

CFB Where Stream Cipher must be used? An operator typing keystrokes at a terminal, which need to be immediately transmitted across communication link in a secure manner. Max Size of unit is 8.

Cipher Feed Back (CFB) Ci = Pi XOR K1(Ci-1) C-1 = IV Message is treated as a stream of bits Added to the output of the block cipher Result is feed back for next stage (hence name) Standard allows any number of bit (1,8 or 64 or whatever) to be feed back denoted CFB-1, CFB-8, CFB-64 etc Is most efficient to use all 64 bits (CFB-64) Ci = Pi XOR K1(Ci-1) C-1 = IV Uses: stream data encryption, authentication If the data is only available a bit/byte at a time (eg. terminal session, sensor value etc), then must use some other approach to encrypting it, so as not to delay the info. Idea here is to use the block cipher essentially as a pseudo-random number generator (see stream cipher lecture later) and to combine these "random" bits with the message. Note as mentioned before, XOR is an easily inverted operator (just XOR with same thing again to undo). Again start with an IV to get things going, then use the ciphertext as the next input. As originally defined, idea was to "consume" as much of the "random" output as needed for each message unit (bit/byte) before "bumping" bits out of the buffer and re-encrypting. This is wasteful though, and slows the encryption down as more encryptions are needed. An alternate way to think of it is to generate a block of "random" bits, consume them as message bits/bytes arrive, and when they're used up, only then feed a full block of ciphertext back. This is CFB-64 mode, the most efficient. This is the usual choice for quantities of stream oriented data, and for authentication use.

Step 1 64 bit IV PT Kept in Shift Register Encrypted 64 bit IV CT

Step 2 Leftmost bit (i.e MSB)

Step 3 Left Shift IV by j positions. Move j bits of C into the rightmost side of blank IV . Step 1 through 3 continue until all the PT units are encrypted. *C=Cipher Text from step 2. Left shift IV by j position IV Move j bit of C into the rightmost side of IV IV C

Cipher Feedback Mode (CFB) 1 unit is 1/N block Shift Register (1 Block wide) C I-6 C I-5 C I-4 C I-3 C I-2 C I-1 Block Encryption E(register) Encrypted Register Leftmost After each unit, shift input register and insert the most recently generated unit of cipher text Shown by <………………. First j bit of the Plain text Cipher text (C) XOR output

Cipher FeedBack (CFB) Stallings Fig 3-13.

Limitations of CFB Errors propagation if Ci bit contain error. Ci is feed back as input to the shift register & would corrupt the other bits in the message. CFB is the usual stream mode. As long as can keep up with the input, doing encryptions every 8 bytes. A possible problem is that if its used over a "noisy" link, then any corrupted bit will destroy values in the current and next blocks (since the current block feeds as input to create the random bits for the next). So either must use over a reliable network transport layer (pretty usual) or use OFB.

4.OFB The output of the IV encryption process is feed into the next of the encryption process. Advantage Of This Scheme:- Bit error do not get propagated(i.e;-Other bits are not affected) If there are error in individual bits will not corrupt the whole message. disadvantage Of This Scheme:- Attacker changes both the cipher text and the checksum at the same time hence there is no way to detect this change.

Output Feedback Mode (OFB) 1 unit is 1/N block Shift Register (1 Block wide) C I-6 C I-5 C I-4 C I-3 C I-2 C I-1 Block Encryption E(register) Encrypted Register Leftmost After each unit, shift input register and insert the leftmost unit of the encrypted register. First j bit of the Plain text Cipher text (C) XOR output

5.CTR(Counter) It uses sequence numbers called as counters as the inputs to the algorithm. After each block is encrypted, the next counter value is used to fill the register. Usually, a constant is used as a initial counter value and is incremented by 1 for every iteration , hence name The size of counter block is same as PT. Encryption:- Decryption:- Counter is encrypted ->Same Sequence is used XOR’ed with PT -> XOR’ed with CT CT ->PT

Advantages & Limitations Of CRT Encryption & Decryption process can be done in parallel on multiple text blocks. No chaining process is involved. Faster execution Speed. Used in Multiprocessing to reduce overall processing time. Pre processing can be achieved to prepare the O/P of the encryption boxes that I/P to the XOR operation. Encrypt Counter O/P Key