90 likes | 225 Views
Modes of Operation. CS 795. Electronic Code Book (ECB). Each block of the message is encrypted with the same secret key Problems: If two identical blocks are in the same message, cipher text would be identical. Cipher blocks can be rearranged to alter the message. Cipher Block Chaining (CBC).
E N D
Modes of Operation CS 795
Electronic Code Book (ECB) • Each block of the message is encrypted with the same secret key • Problems: If two identical blocks are in the same message, cipher text would be identical. • Cipher blocks can be rearranged to alter the message
Cipher Block Chaining (CBC) • This over comes the repeated message block problem. • Initially, a random initialization vector IV is Modulo-2 ORed with the 1st message block and then encrypted with secret key. • The encrypted output of block 1 is then used in place of IV in step 1; and so on. • CBC Threat 1: Modifying Ciphertext Blocks: (i) Modifying cn would have predictable effect on mn+1, and so on. • CBC Threat 2: Rearranging Ciphertext blocks: By rearranging the ciphertext, the message can be changed.
Output Feedback Mode (OFB) • Stream cipher • Mod-2 OR the message with the one-time pad generated by OFB • Generate a random number IV, encrypt it with secret key; call it b0; use any part of b0 and mod-2 OR with the message to get ciphertext. • For next block of message, use b0 instead of IV; and so on. • Problems: If the plaintext and ciphertext are known by a bad guy, he can modify the plaintext into anything he wants by simply OR-ing the ciphertext with the known plaintext, and OR-ing the result with whatever message he wants to transmit.
Cipher Feedback Mode (CFB) • Similar to OFB---k bits are generated and ORed with the message block. • But the input to the next block is the cipher output of the current block. • Less subject to tampering than CBC or OFB.
Counter Mode (CTR) • Similar to OFB • A one-time pad is generated and modulo-2 ORed with the data • But the random bits are generated by incrementing the IV and encrypting it with the secret key
Generating MACs • (i) Ensuring privacy and integrity together: Use CBC where the ciphertext of the last block is also used as the MAC; preferable to use two different keys for CBC for privacy and integrity separately.
Multiple Encryption 3DES • Two keys are used: K1 and K2 m Encrypt with K1 Decrypt with K2 Encrypt with K1 ciphertext