written 6.1 years ago by |
3. Cipher feedback (CFB) Mode:
In this mode each ciphertext block gets feedback into the encryption process in order to encrypt the next plaintext block.
The block size n is predetermined by the underlying cipher in EBC and CBC mode for example n=64 for DES and 128 for AES. But if the plaintext or ciphertext block sizes are smaller , the solution to this is to use DES or AES in CFB mode.
In this mode the size of the block used in DES or AES is n but the plaintext or ciphertext block is r where r ≤ n
Encryption:
$C_{i} = P_{i} ⊕ Selectleft_r {E_{k}[shiftleft_r(S_{i-1})|C{i-1}]}$
Decryption:
$P_{i} = C_{i} ⊕ Selectleft_r {E_{k}[shiftleft_r(S_{i-1})|C{i-1}]}$
Operation:
The operation of CFB mode is depicted in the following illustration. For example, in the present system a message block has a size s bit where 1$\lt$s$<$n. The CFB mode requires an initialization vector (IV) as the initial random n-bit input block. The IV need not the secret. Steps of operation are:
Load the IV in the top register.
Encrypt the data value in top register with underlying block cipher with key k.
Take only s number of most significant bits (left bits) of o/p of encryption process & XOR them with s bit plaintext message block to generate ciphertext block.
- feed ciphertext block into top register by shifting already present data to the left and continue the operation till all the plaintext blocks are processed.
- Essentially, the previous ciphertext block is encrypted with the key & then the result is XORed to the current plaintext block.
- Similar steps are followed for decryption. Pre-decided IV is initially loaded at the start of decryption.
Analysis of CFB mode:
- Unlike ECB mode , the ciphertext corresponding to a given plaintext block depends not just on that plaintext block & the key, but also on the previous ciphertext block, i.e the ciphertext block is dependent of message.
- CFB has a feature in which user decrypts the ciphertext using only the encryption process of the block cipher. The decryption algorithm of the underlying block cipher is never used.
- Apparently, CFB mode is converting a block cipher into a type of stream cipher. The encryption algorithm is used as a key-stream generator to produce key-stream that is placed in the bottom register. This keystream is then XORed with the plaintext as in case of Stream Cipher.
- By converting a block cipher into a stream cipher, CFB mode provides some of the advantageous properties of a stream cipher while retaining the advantageous properties of block cipher & on the other side, the error of transmission gets propagated due to the chaining of blocks.