Perform public-key encryption

Assignment Help Computer Engineering
Reference no: EM133263299

CSCE 5550 Introduction to Computer Security - University of North Texas

Homework: Cryptography

Introduction
In this homework, you will write programs which perform public-key encryption and compute cryptographic checksums (keyless and keyed). You may use any programming language in this assignment. We recommend you choose the same one as for the project "Ransomware".
Some of the components created in this homework may be re-purposed for your project.

Section 1: Public-key encryption

1. Create a directory "hw3". Download a file "sensitive.txt" from the assignment page and copy it into the directory "hw3".

2. Write a program "generate_keys". This program will randomly generate a pair of 3072-bit RSA keys and then it will save the public key into a file "pub_key" and the private key into a file "priv_key".

Q0: What programming language did you use? What cryptographic library did you use?

In the terminal window, run the program "generate_keys". Then, display the files "pub_key" and "priv_key" using the "hexdump" command.

Q1: Attach a screenshot of the result.

3. Write a program "encrypt_file". This program will encrypt a file "sensitive.txt" in the directory "hw3" on the key "pub_key". The key will be read from the file "pub_key". The encrypted file will overwrite the original file "sensitive.txt".

Make sure that the original (unencrypted) file "sensitive.txt" is placed into the directory "hw3". In the terminal window, display the first 100 bytes of the original (unencrypted) file "sensitive.txt" using the "head" command. Run the program "encrypt_file". Display the first 100 bytes of the encrypted file "sensitive.txt" using the "hexdump" command.

Q2: Attach a screenshot(s) of the result. Make sure that both original (unencrypted) and encrypted versions of the file are displayed on the screenshots.

4. Write a program "decrypt_file". This program will decrypt the file "sensitive.txt" in
the directory "hw3" using the key "priv_key". The key will be read from the file "priv_key". The decrypted file will overwrite the encrypted file "sensitive.txt".

Make sure that the encrypted file "sensitive.txt" is in the directory "hw3". In the terminal window, display the first 100 bytes of the encrypted file "sensitive.txt" using the "hexdump" command. Run the program "decrypt_file". Display the first 100 bytes of the decrypted file "sensitive.txt" using the "head" command.

Q3: Attach a screenshot(s) of the result. Make sure that both encrypted and decrypted versions of the file are displayed on the screenshots.

5. Write a program "compute_checksum" which computes a keyless cryptographic checksum of a file "sensitive.txt". You will use a hash function SHA256 compute it.
The checksum will be written into a file "sensitive_checksum.txt"-this file should be in the text format.

Copy the original (unencrypted) file "sensitive.txt" into the directory "hw3".
In the terminal window, run the program "compute_checksum". Display the checksum: cat sensitive_checksum.txt
Q4: Attach a screenshot of the result.

6. Write a program "verify_checksum" which works as follows: it computes a checksum of "sensitive.txt" and compares it with the contents of "sensitive_checksum.txt".
If the resulting hash values are the same, then the program outputs "Accept!" and otherwise it outputs "Reject!".

In the terminal window, run the program "verify_checksum". (Observe the result.) Change the first symbol in "sensitive.txt" to a different symbol, and save the file. Come back to the terminal window and run the program "verify_checksum". (Observe the result.)

Q5: Attach a screenshot of the result.

7. Write a program "compute_keyed_checksum" which works similarly to the one in Step 4, but instead of SHA256, you will use the keyed hash function HMAC-SHA256. A 256-bit key will be read from the file "key.bin". The checksum will be written into a file
"sensitive_keyed_checksum.txt"-this file should be in the text format.

Generate a random key:
head -c 256 /dev/urandom > key.bin

Copy the original (unencrypted) file "sensitive.txt" into the directory "hw3".
In the terminal window, run the program "compute_keyed_checksum". Display the checksum: cat sensitive_keyed_checksum.txt
Q6: Attach a screenshot of the result.

8. Write a program "verify_keyed_checksum" which works as follows:
it computes a keyed checksum of "sensitive.txt" using HMAC-SHA256 and compares it with the contents of "sensitive_keyed_checksum.txt". If the resulting values are the same, then
the program outputs "Accept!" and otherwise it outputs "Reject!".

In the terminal window, run the program "verify_keyed_checksum". (Observe the result.) Change the first symbol in "sensitive.txt" to a different symbol, and save the file.
Come back to the terminal window and run the program "verify_checksum". (Observe the result.)

Reference no: EM133263299

Questions Cloud

Career and unit expectations : Take 10 minutes to think about the career you are thinking of following when you graduate from your studies. In words describe your perfect career choice.
Improve organisational practices : Read the ABC case study (available on Moodle) and respond to following questions in a box provided.
Explain the warehousing process : Provide recommendations as to where improvements can be made to a warehousing process?
Describe what electronic performance monitoring : Describe what Electronic Performance Monitoring (EPM) is and give examples of how companies are using this resource to monitor employees.
Perform public-key encryption : CSCE 5550 Introduction to Computer Security - University of North Texas - perform public-key encryption and compute cryptographic checksums (keyless and keyed)
Different types of business analytics : Argue about different types of business analytics including descriptive, predictive and prescriptive analytics. Your arguments should include the following poin
Discuss current issues on teacher salaries. : What is topic you are researching and why is it important? What implications does issue or trend have on your area of study?
Discuss disruptive innovation : Discuss disruptive innovation, disruptive technologies, and the debate over the correct identification of what is actually "disruptive" in New Product Developme
Standard of conduct : There is one Standard of Conduct that applies to how an agent must act in regards to their client's best interests. Find this rule and describe it below:

Reviews

Write a Review

Computer Engineering Questions & Answers

  Determine the minimum number of timeslots required

COMP 9020- Assignment. For this problem in particular determine minimum number of timeslots required. Explain how this can formulated as graph-based problem

  Prepare a business report comparing the three vendors

A list of the antivirus and firewall packages you researched. You should research and list at least three different antivirus and firewall packages.

  Explain the typical operation of a data warehouse

Explains the typical operation of a data warehouse and data marts, along with operational considerations and constraints. Discusses how DreamHome could benefit.

  Define relationships to explore correlations and connections

The chart you select to represent your data will be influenced by many factors. Kirk (2016) has put each chart into the five main families.

  Write a program that takes as input a fully parenthesized

Write a program that takes as input a fully parenthesized, arithmetic expression and converts it to a binary expression tree.

  Write a function definition for a function called one more

Write a function definition for a function called one More, which has a formal parameter for an array of integers and increase value of each array element by 1.

  Write a program that allows a user to input words

Write a program that allows a user to input words at the command line. Your program should stop accepting words when the user enters "STOP".

  Write a phonebook that will have four seperate classes

Person: which represents the name and phone number of a person, you will store instances of this class in the phone book

  What is the snr for each of the reconstructions

What is the SNR for each of the reconstructions? Do the relative values reflect the difference in the perceptual quality?

  What subsystems were involved in this problem

Think about the most difficult troubleshooting problem you've encountered in your recent experience- one where the solutions was not straightforward and where the problem was into a simple request for information.

  Write a function called bruteforcetest

Write a second function called bruteForceTest that uses the bruteForce function to find and then print the highest scoring permutations

  Describe a simple scheme that allows peers to verify blocks

Assume that when a peer joins a torrent, it initially gets a .torrent file from a fully trusted source.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd