Question: 3 Task 3 : Padding For block ciphers, when the size of a plaintext is not a multiple of the block size, padding may be
Task : Padding
For block ciphers, when the size of a plaintext is not a multiple of the block size, padding may be required.
All the block ciphers normally use PKCS# padding, which is known as standard block padding. We will
conduct the following experiments to understand how this type of padding works:
Use ECB, CBC CFB and OFB modes to encrypt a file you can pick any cipher Please report
which modes have paddings and which ones do not. For those that do not need paddings, please
explain why.
Let us create three files, which contain bytes, bytes, and bytes, respectively. We can use
the following "echo command to create such files. The following example creates a file
with length without the option, the length will be because a newline character will be added
by echo:
$echo n fltxt
We then use "openssl encaescbce to encrypt these three files using bit AES with CBC
mode. Please describe the size of the encrypted files.
We would like to see what is added to the padding during the encryption. To achieve this goal, we
will decrypt these files using "openssl encaescbcd Unfortunately, decryption by default
will automatically remove the padding, making it impossible for us to see the padding. However,
the command does have an option called nopad", which disables the padding, ie during the
decryption, the command will not remove the padded data. Therefore, by looking at the decrypted
data, we can see what data are used in the padding. Please use this technique to figure out what
paddings are added to the three files.
It should be noted that padding data may not be printable, so you need to use a hex tool to display
the content. The following example shows how to display a file in the hex format:
$ hexdumpC pltxt
$ xxd pltxt
:ab ca IJKL.
Submission for Task points
Which modes have paddings and which ones do not? How did you know if a mode has a padding
through the encrypted file? For those that do not need paddings, please explain why. Please also list the
commands that you used in step points
Please describe the size of the encrypted files which are encrypted in step points
What paddings are added to the three files in step Please attach the screenshots of decrypted files
with paddings ie decrypt the files with nopad" points
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
