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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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