Use the Internet to research the correct syntax for using this encryption method
ID: 3918337 • Letter: U
Question
Use the Internet to research the correct syntax for using this encryption method with GPG and complete the following tasks to encrypt and decrypt a new file. Make screen captures to record your progress. a. On TargetLinux01, log in as the student and create a new file called yourname.txt, replacing yourname with your own name, and add the following text: This is a test of AES256 encryption. b. Use AES256 encryption with GPG to encrypt the file and remove the original file from the directory, leaving only the encrypted version of the file. c. Copy the file to the Instructor account, change the permissions on the file, and then decrypt the file using the encryption passphrase.
Explanation / Answer
In the Linux world, you have a built-in GPG (GnuPG) tool which can be used to encrypt and decrypt files easily. Since gpg is built into almost every Linux system, you don't have to install it.
Encrypt (using AES256 Algorithm with GPG)
Decrypt File
With the above information, let solve each part of question one by one
Seems like you are required to log in some actual machine first ( In your LAB) with your student credentials first.
Then you are required to create the new file with format <yourname.txt>. For instance, if your name is Sally then you are required to create a file sally.txt and then you need to add the given contents. Exact command to do this is as follows
1. Open a terminal window. ( Command shell where you issue commands)
2. Type vi <yourname>.txt and press ? Enter. Do not forget to replace <youname> with your actual name.
4. Type i to enter insert/editing mode.
5. Enter text "This is a test of AES256 encryption."
6. Press Esc to enter command mode.
7. Type :wq and press ? Enter.
With above 7 steps you have successfully created a given file and first part is complete. Congratulations.
Tip : You can create the file in Linux by other commands too. For instance cat command, this is one of the several ways to do it. Try your own if you know. :-)
Let us move to the next step for encrypting the above-created file.
2. Use AES256 encryption with GPG to encrypt the file and remove the original file from the directory, leaving only the encrypted version of the file.
In this part, you are required to encrypt the file and then delete the original file. Exact commands are as follows
gpg --cipher-algo AES256 --output <yourname>.gpg --symmetric <yourname>.txt
You will be prompted for a passphrase, which will be used later to decrypt the file.
After this step you will see 2 files
1. <yourname>.txt : This is the original file
2. <yourname>.gpg : This is the Encrypted file
This step also requires you to delete the original plain text <yourname>.txt file. Let's do that using the following command
rm <yourname>.txt
3. Copy the file to the Instructor account, change the permissions on the file, and then decrypt the file using the encryption passphrase.
// Copy to the Instructor account and change permissions
Assuming that you have sudo privileges the following command will do.
Will copy the file from the student account to Instructor account, and then change the owner of the copy in /home/Instructor to Instructor
Now its time to decrypt file using passphrase
The following command decrypts the file "<yourname>.gpg" and produces the file "<yourname>.txt."
gpg --output <yourname>.txt. -d <yourname>.gpg
Congratulations, you now know how to encrypt and decrypt files using AES256 algorithm with GPG tool.
This method is also used inside NASA when transferring files from one host to another host.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.