Question

In: Computer Science

Using Ubuntu SeedLab For block ciphers, when the size of a plaintext is not a multiple...

Using Ubuntu SeedLab

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#5 padding, which is known as standard block padding. We will conduct the following experiments to understand how this type of padding works:

1. 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.

2. Let us create three files, which contain 5 bytes, 10 bytes, and 16 bytes, respectively. We can use the following "echo -n" command to create such files. The following example creates a file f1.txt with length 5 (without the -n option, the length will be 6, because a newline character will be added by echo): $ echo -n "12345" > f1.txt

We then use "openssl enc -aes-128-cbc -e" to encrypt these three files using 128-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 enc -aes-128-cbc -d". 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, i.e., 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:

$ hexdump -C p1.txt 00000000 31 32 33 34 35 36 37 38 39 49 4a 4b 4c 0a |123456789IJKL.

$ xxd p1.txt 00000000: 3132 3334 3536 3738 3949 4a4b 4c0a 123456789IJKL.

Solutions

Expert Solution

Answer 1
*********
In Electronic Code Book (ECB) and Cipher Block Chaining (CBC) mode require their contribution to be a careful various of the square size. On the off chance that the plaintext to be encoded isn't a precise various, you have to cushion before scrambling by including a cushioning string. While unscrambling, the getting party has to realize how to expel the cushioning in an unambiguous way.

CFB and OFB do not need padding

Answer 2
*********
encrypted size if 32 bytes as shown in the screenshot

and padded bytes are 0b 0b 0b 0b

in decimal its 11
in octal its 13
in binary its 1011

if you have any doubt then please ask me without any hesitation in the comment section below , if you like my answer then please thumbs up for the answer , before giving thumbs down please discuss the question it may possible that we may understand the question different way and we can edit and change the answers if you argue, thanks :)


Related Solutions

Information Security -Why are modes of operation needed for block ciphers like AES?
Information Security -Why are modes of operation needed for block ciphers like AES?
3. When signing and verifying a plaintext document electronically using digital signatures, describe the function of...
3. When signing and verifying a plaintext document electronically using digital signatures, describe the function of the message digest or hash function in this process. Describe also how the X.509 Digital Certificate and the chain of trust concept could be related to digital signatures.
Using playfair cipher, encrypt the plaintext “SUCCESS” using the keyword “MIDTERMEXAM”
Using playfair cipher, encrypt the plaintext “SUCCESS” using the keyword “MIDTERMEXAM”
Encrypt the given plaintext with the key. Built the key matrix (big size). And show how...
Encrypt the given plaintext with the key. Built the key matrix (big size). And show how you get each letter ciphertext (you can do that by making shapes and arrows in key matrix). No need to draw key matric again and again.    Show all your work. If you just write cipher text and key matric without showing (shapes and arrow on key matrix) that how you get the ciphertext then your marks will be deducted. key :  alphabets plaintext :   smartness
Consider a disk with block size B = 512 bytes. A block pointer is P =...
Consider a disk with block size B = 512 bytes. A block pointer is P = 6 bytes long, and a record pointer is PR = 7 bytes long. A file has r = 30,000 EMPLOYEE records of fixed length. Each record has the following fields: Name (30 bytes),Ssn (9 bytes), Department_code (9 bytes), Address (40 bytes), Phone (10 bytes), Birth_date (8 bytes), Sex (1 byte), Job_code (4 bytes), and Salary (4 bytes, real number). An additional byte is used...
A wooden block A of mass m1 slides on a frictionless table when pulled using a...
A wooden block A of mass m1 slides on a frictionless table when pulled using a massless string and pulley array by a hanging box B of mass m2, as shown in the figure. What is the acceleration of block A as it slides on the frictionless table? Hint: Think carefully about the acceleration constraint.
What happens to the size of atoms in p-block elements when we move from left to right in the same period? a) Size does not change b) Size increases then decreases c) Size increases d) Size decreases
What happens to the size of atoms in p-block elements when we move from left to right in the same period?a) Size does not changeb) Size increases then decreasesc) Size increasesd) Size decreases
These questions are about math cryptography 1) Encrypt the plaintext "this is a secret message" using...
These questions are about math cryptography 1) Encrypt the plaintext "this is a secret message" using the affine function f(x) = 5x + 7 mod 26. 2) Determine the number of divisors of 2n, where n is a positive integer.
Cryptography: Using columnar cipher, find the plaintext and the key that generated this ciphertext: ykccjosaiawiekhriogrrlrni Keep...
Cryptography: Using columnar cipher, find the plaintext and the key that generated this ciphertext: ykccjosaiawiekhriogrrlrni Keep in mind that only letter j was used for padding. (Show your detailed work)
Using Python, write a simple application that takes user input of plaintext and key, and encrypt...
Using Python, write a simple application that takes user input of plaintext and key, and encrypt the plaintext with Vigenere Cipher. The application should then print out the plaintext and the ciphertext.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT