Symmetric Encryption

FIND A SOLUTION AT Academic Writers Bay

Symmetric Encryption1 OverviewThe learning objective of this coursework is for you to become familiar with the concepts in symmetricencryption. After finishing the coursework, you should have first-hand experience on encryption algorithms,encryption modes, and initialisation vectors (IV). Moreover, you will be able to use tools and write simplescripts or programs to encrypt/decrypt messages.This is an independent coursework and you are expected to work on your own to complete the coursework tasks. Your coursework submissions will be automatically checked for plagiarism. Here are somefurther points to take into consideration:• Coursework reports must be written in your own words and any code in your coursework must be your owncode. If some text or code in the coursework has been taken from other sources, these sources must beproperly referenced.• Failure to reference work that has been obtained from other sources or to copy the words and/or codeof another student is plagiarism and if detected, this will be reported to the School’s DisciplineCommittee. If a student is found guilty of plagiarism, the penalty could involve voiding the course.• Students must never give hard or soft copies of their coursework reports or code to another student.Students must always refuse any request from another student for a copy of their report and/or code.• Sharing a coursework report and/or code with another student is collusion, and if detected, this will bereported to the School’s Discipline Committee. If found guilty of collusion, the penalty could involvevoiding the course.• And remember: the consequences of taking unacceptable short cuts in coursework are much worse thangetting a bad mark (or even no marks) on a piece of coursework. There has been one case this yearwhere a student was awarded on Ordinary degree (rather than an Honours degree) becauseof the sanction imposed by the University’s Discipline Committee. The offence was plagiarism ofcourseworkYou are required to submit a coursework report. At the end of each task, the information that you needto provide to answer the task is indicated. For further information, including submission, see Section 4.2 Lab Environment for CourseworkThe tasks in this lab require access to a computing device that runs Linux OS. There are a few ways for youto do this:1. IfOpenSSL. In this lab, we will use openssl commands and libraries, which are installed on all Linuxlab machines. To confirm that you have openssl on your personal machine, your can type either of thefollowing commands:
%
openssl version
OpenSSL 1.1.1
11 Sep 2018
% which openssl/usr/bin/openssl3 Coursework Tasks3.1 Task 1: Frequency Analysis: Monoalphabetic Substitution CipherIt is well-known that monoalphabetic substitution cipher is not secure because it can be subjected to frequency analysis. In this task, you are given a ciphertext that is encrypted using a monoalphabetic cipher;namely, each letter in the original text is replaced by another letter, where the replacement does not vary(i.e., a letter is always replaced by the same letter during the encryption). However, note that the shiftamount for each letter varies (i.e., amongst the alphabet of plaintext characters, the shift amount for theencryption varies). Your job is to find out the original text using frequency analysis. It is known that theoriginal text is an English article. Each student is assigned a different ciphertext file, for which a differentplaintext file and different key was used for encryption. There is a pdf file on Canvas that matchesyour name to the ciphertext filename that you must useNote that the plaintext was modified before encrypting, so that all upper case letters have been convertedto lower cases, all the punctuations and numbers were removed. However, the spaces between words weremaintained in the plaintext (and appear as corresponding spaces in the ciphertext), so that you can still seethe boundaries of the words in the ciphertext.Your task is to use frequency analysis to figure out the encryption key and the original plaintext.Using the frequency analysis, you can find out the plaintext for some of the ciphertext characters quiteeasily. For those characters, you may want to change them back to its plaintext, as you may be able to getmore clues. It is better to use capital letters for plaintext, so for the same letter, we know which is plaintextand which is ciphertext. You can use the tr command to do this. For example, in the following, we replaceletters a, e, and t in in.txt with letters X, G, E, respectively; the results are saved in out.txt.$ tr aet XGE < in.txt > out.txtThere are many online resources that you can use. We list four useful links in the following:• https://onlinetoolz.net/letter-frequency: This website can produce the statisticsfro a ciphertext, including the single-letter frequencies, bigram frequencies (2-letter sequence), andtrigram frequencies (3-letter sequence), etc.• https://en.wikipedia.org/wiki/Frequency_analysis: This Wikipedia page provides frequencies for a typical English plaintext.• https://en.wikipedia.org/wiki/Bigram: Bigram frequency.• https://en.wikipedia.org/wiki/Trigram: Trigram frequency.In your report, include• A short description (no more than a page) that explains what you did in your attempt to discoverthe encryption key and the original plaintext. This description should indicate how you decryptedvarious ciphertext letters, e.g., whether you used the single letter frequency analysis, bigram or trigramfrequencies, or some other reason to guess a particular plaintext character.• The encryption key. You should write this as an encryption table that shows the mapping of eachplaintext letter to its corresponding ciphertext letter.• The plaintext, included as an appendix in your report.3.2 Task 2: Encryption Mode — Corrupted Cipher TextTo understand the properties of various encryption modes, we would like to do the following exercise:1. Create a text file that is exactly 128 bytes long. To do this, use numbers or alphabetic characters foryour text each of which are 8 bits in length. Create your file with the command echo -n ‘‘YOURTEXT HERE’’ > 128bits.txt where you enter your 128 bytes of text in between the quotationmarks.2. Encrypt the file using the AES-192 cipher, separately for each of the encryption modes of operation:ECB, CBC, CFB, and OFB, using the appropriate key and iv as required by each mode. Include the-nopad option in your encryption and decryption commands.3. Assume that the 55th byte of each of the ciphertext files has been corrupted (don’t worry about howthis might have happened) and you’ve been instructed by your manager to remove the block containingthis byte. Thus, create new ciphertexts that remove this block.4. Decrypt each new ciphertext file using the same key and initialisation vector (IV) as used to encrypt,including again the -nopad option.5. Observe the plaintexts that result from decrypting each new ciphertext file. You should explain whatyou observe (i.e., in terms of what plaintext blocks are missing or corrupted and why) by using theequations for the modes of operation.In your report, include• Screenshots to demonstrate your original plaintext, plaintext encryption, creation of the new ciphertexts, and recovered plaintexts for each of the four modes of operation.• An explantion of the results, including a comparison between the modes.3.3 Task 3: Partial known-plaintext attackDownload the English word list (words.txt) from Canvas. Each student is assigned a different ciphertextfile, for which a different key and plaintext file was used for encryption. There is a pdf file on Visionthat matches your name to the ciphertext filename that you must use for this task. TheHere is what you know:• The plaintext was encrypted using 128-bit AES with CBC mode.• The plaintext was encrypted using a password from the dictionary file words.txt that is shorterthan 16 characters, with a single digit from 0-9 appended to the word before encryption. A key wasgenerated from the password using the SHA-256 message digest with no salting performed.• The plaintext consists of a short sentence “The secret word is: ” (with no carriage return or line feed)that is followed by another word from the dictionary file. Thus you have partially known plaintextcorresponding to your ciphertext.Your goal is to write a program using a shell script to find out the password and the plaintext, usingthe downloaded English word list, and your ciphertext file. As part of your script you should use the commandline tools provided by openssl to encrypt and decrypt messages in order to perform a brute-forcecryptanalysis. Your script should also be clear (e.g., appropriate variable names, and suitably commented),flexible (e.g., using variables and not hard-coded values, and taking options from the command line), efficient (e.g., complete in the least number of steps) and clearly present output (e.g., redirect unnecessaryerrors).Reflections on security: Give a critical analysis explaining why this attack is successful, and describe afew countermeasures that could be put in place to reduce the likelihood of the attack (i.e., if done differently,how might the encryption have been performed in order to mitigate the attack). You should also explainwhy you believe that your countermeasures would be effective at mitigating this attack, e.g,. why, with yourcountermeaures in place, an attack would take longer to execute.In your report, include• A short description (no more than a page) that explains what you did in your attempt to discover theencryption key. Your description should talk about the key components of your script, and shouldexplain how may have validated the correct operation of key components.• A copy of your script. Your script should be well commented to explain what is happening in thescript. Your script should also be flexible (e.g., using variables and not hard-coded values, and takingoptions from the command line), efficient (e.g., finds the key in the least number of steps) and clearlypresents output (e.g., redirects unnecessary errors).• Your reflections on security.• A screenshot(s) to show the execution of your script.Using shell scripting and command line opensslAs an example of how to process the word list file for another purpose, is available in the line count scripton Canvas (line count.sh) which reads text from a file and counts the number of lines. You will have toreplace the body of the loop by calls to the appropriate openssl command and checking the result file.Hans-Wolfgang Loidl has kindly provided a screen-cast explaining the steps of the line countHint: to speed up development, test your script on a self encrypted, short text, and use a much shorterword list; once your solution works for your own text, run it on the given text and the4 SubmissionYou should submit a report to describe what you have done and what you have observed. With each taskabove, some guidance is provided on what to include in your report. You should also explain any observations that are interesting or surprising. Document any difficulties that you met while doing any of thetasks.In your report, you need to answer all the points listed for each task. Structure the report in sections,addressing each of the tasks. Include an introduction section, discussing what you expect to learn from theassignment in general (and for each task), and describe the environment that you used to complete the tasks(e.g., what machines, software and versions). Include a summary/conclusion section, where you discusswhether your expectations were met, highlighting issues of particular importance, what you learned (overalland for each task), and suggesting further work, i.e. what kind of exercise could be done next building onthe material from this assignment. In writing-up the work you performed on the above tasks, make sure toassess the strengths and weaknesses of the ciphers and modes used in for this assignm

Order from Academic Writers Bay
Best Custom Essay Writing Services

QUALITY: 100% ORIGINAL PAPERNO PLAGIARISM – CUSTOM PAPER