Data Protection and Security

   

I

Secret Key Cryptography

   

I.I

Symmetric Encryption

   

   
 

Block Cipher Modes

Block ciphers encrypt only fixed-size blocks. If you want to encrypt a plaintext that is shorter than one block size, you can simply pad the plaintext until it reaches the length of full block size.

For messages larger than block size, you have to use a block cipher mode. The simplest and unfortunately the least secure mode of operation is Electronic Code Book (ECB) in which you break the message into blocks with block size length and encrypt each block with the secret key. When ECB is used, if a message contains two identical blocks, the corresponding two blocks of ciphertext will be identical. This problem, illustrated in the figures below, might give useful information to the attacker. Another problem with ECB is that an attacker can rearrange blocks or modify blocks to his own advantage.

Other modes of operation are proposed to deal with the problems of ECB:

  • Cipher Block Chaining (CBC): In CBC, the first plaintext block is XORed with a random number (known as initialization vector or IV). As seen from the figure, each of the subsequent plaintext blocks is XORed with the previous ciphertext block. This trick prevents the same plaintext block to have the same corresponding ciphertext.
  • Output Feedback Mode (OFM): The operation of OFM is like a stream cipher. Encryption is performed by XORing the message blocks with the one-time pad blocks generated by OFM. The first OTP block is obtained by encypting an initialization vector. Then, previous OTP blocks are encrypted to get subsequent OTPs.
  • Counter Mode (CM): It is similar to OFM, the only difference is that the second OTP block is produced by encrypting (IV+1), third OTP is by encypting (IV+2) and so on.
  • Cipher Feedback Mode (CFB): The OTP block is obtained by encypting the previous ciphertext block.

Note that in OFB and CM modes, cryptography can be pre-computed. When the message is ready to be encrypted, the only operation required is XOR.

 


Figure I.I-III

Plaintext - Ciphertext representation. [click to enlarge]

 

 


Figure I.I-IV

CBC mode encryption. [click to enlarge]

 


   

I.I.Q

[+] Question

[-] Question

What might be the security problems CBC mode cannot address?

   

   
       
 
«previous session [1] [2] [3] [4] [5] [6] [7] next session »
   
       
 
«return to chapter index proceed to next section »
  concepts »