0% found this document useful (0 votes)
6 views3 pages

Ecbvscbc Crypto Assignment

This document provides instructions for a hands-on assignment involving AES-128 encryption using OpenSSL with Electronic Codebook (ECB) and Cipher Block Chaining (CBC) modes. It details the creation of plaintext files, their encryption, and the comparison of ciphertext outputs, including an analysis of encrypted images. Students are required to document their process with screen captures and answer specific questions regarding the differences in encryption methods and their effects on file content.

Uploaded by

Marcus Milles
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Ecbvscbc Crypto Assignment

This document provides instructions for a hands-on assignment involving AES-128 encryption using OpenSSL with Electronic Codebook (ECB) and Cipher Block Chaining (CBC) modes. It details the creation of plaintext files, their encryption, and the comparison of ciphertext outputs, including an analysis of encrypted images. Students are required to document their process with screen captures and answer specific questions regarding the differences in encryption methods and their effects on file content.

Uploaded by

Marcus Milles
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Crypto & Block Cipher Modes

(OpenSSL, AES 128, ECB, CBC)

Hopefully this will give a nice visual illustration of how Electronic codebook (ECB) and Cipher-block chaining
(CBC) work using AES-128 and OpenSSL. You can learn a lot from a known plain text, and repeating patterns.
Grading Submission Report: Provide screen captures with time stamps and answer the questions. Points will
be deducted if you fail to follow the instructions below.
Setup/Required Resources: Use Virginia Cyber Range Kali Linux Machine for this Assignment
Create two (2) files and name them "dawn.txt" and "noon.txt"
Use the command nano to create the files
nano dawn.txt
nano noon.txt
Note: You can used “Ctrl + X” to save from nano editor

Add the content below to the dawn.txt as the plaintext:

The attack will happen at dawn!


Love, itn262

Add the content below to the noon.txt as the plaintext:

The attack will happen at noon!


Love, itn262

using AES-ECB Encryption Command to Encrypt "dawn.txt" and "noon.txt" for comparison:

openssl enc -aes-128-ecb -e -in dawn.txt -out dawnciphered.txt -K 00112233445566778889aabbccddeeff


openssl enc -aes-128-ecb -e -in noon.txt -out noonciphered.txt -K 00112233445566778889aabbccddeeff

note: -e for encrypt, -K for Key


note: -in for input file to be encrypted, -out for saving and name encrypted or ciptertext
View the Encrypted/Ciphertext of both “dawncipthered.txt” and
“nooncipthered.txt” using the "cat" commands
cat dawnciphered.txt
cat noonciphered.txt
**cat is use to view/display file content

Convert the Encrypted/Ciphertext of both “dawncipthered.txt” and


“nooncipthered.txt” using the "hexdump" command so you can analyze the files
hexdump dawnciphered.txt
hexdump noonciphered.txt
**hexdump is use to convert content to hex values

Question: Review and compare both ciphertext and provide feedback. What is different

Let us repeat using this process with an image


Download the image "tux.bmp" from canvas and upload to your CyberRange VM

Use the "ls -l" command to locate the size of the bitmap file (tux.bmp)

Save the first 54 Bytes of the bitmap header so we can use it later
head -c 54 tux.bmp > ecb.bmp

Applying the ECB Encryption to the image file


openssl enc -aes-128-ecb -e -in tux.bmp -out temp.bin -K 00112233445566778889aabbccddeeff

This command uses temp.bin file extracting 943754 Bytes (54B less than the original file tux.bmp file)
and append it to ecb.bmp

tail -c 943754 temp.bin >> ecb.bmp


Repeat for CBC Enryption by entering the following commands (CBC requires an Initialization Vector
(IV))
head -c 54 tux.bmp > cbc.bmp

openssl enc -aes-128-cbc -e -in tux.bmp -out temp.bin -K 00112233445566778889aabbccddeeff -iv


0102030405060708

tail -c 943754 temp.bin >> cbc.bmp

Question: Now, navigate to file manager. Locate the file in your home directory (/home/student/) and analyze
the ECB and CBC cipher images. Compare them to the original image (tux.bmp)
Provide feedback.

You might also like