Lecture 5 Flashcards
How do we encrypt a message larger than the block size of the cipher?
Divide the message into multiple blocks, and pad the last block if necessary. Then use an encryption mode on the various blocks.
What are some examples of encryption modes?
- Electronic Code Block (ECB)
Each block is encrypted separately using the block cipher. - Cipher Block Chaining (CBC)
Where each block is the encrypted XOR of the previous block. - Counter Mode (CTR)
Uses a counter.
What restrictions in terms of length do block ciphers require?
The length of the message must be a multiple of the block length.
How does PKCS padding function?
PKCS padding involves adding bytes to data to fit a block cipher’s block size. If the data is 5 bytes and the block size is 8, 3 bytes of 03 are added. If the data length is already a multiple of the block size, a full block of padding is added, each byte equal to the block size. For example, for 16-byte data with an 8-byte block size, an 8-byte 08 padding is added.