Question: This needs to be in Java. I have the rest of the program I just need help with the encryption and decryption. The password to

This needs to be in Java. I have the rest of the program I just need help with the encryption and decryption. The password to use is provided at the bottom of the instructions. After encrypting it should make an encrypted file and leave the original intact, then decrypt and receive another new file identical to the original.

6 Encrypt file (XOR with password) This option prompts the user for a password (max 256 bytes long, may contain letters, digits, other characters) and then prompts the user for a filename and encrypts the content of the selected file using that password. The encryption method is very simple: just XOR the password with the file content byte after byte; the password being shorter than the file content, you must repeat the password as needed. Example: passwordpasswordpasswordpasswordpasswordpasswordpass this is the file content that we need to encrypt now chiphertext is obtained here by XORing byte to byte Note1: the user must be prompted for the filename of the encrypted file (containing the ciphertext) as well, otherwise we would need to overwrite the initial file. Note2: If no directory was selected an error message must be displayed. If the directory does not contain either of the files specified by the user, an error message must be displayed. The filenames do not include any path. 7 Decrypt file (XOR with password) This option prompts the user for a password (max 256 bytes long, may contain letters, digits, other characters) and then prompts the user for a filename and decrypts the content of the selected file using that password. The decryption method is very simple: just XOR the password with the file content byte after byte; the password being shorter than the file content, you must repeat the password as needed. Example: passwordpasswordpasswordpasswordpasswordpasswordpass chiphertext is here this is the file content that we had initially Note1: the user must be prompted for the filename of the decrypted file as well, otherwise we would need to overwrite the initial file. Note2: it may seem strange that we are using the same operation (XOR) both for encryption and for decryption, but this is how XOR (exclusive OR) works. Note3: If no directory was selected an error message must be displayed. If the directory does not contain either of the files specified by the user, an error message must be displayed. The filenames do not include any path. Testing: 1. You should use this file as the test file for Display, Encryption and Decryption. 2. For encryption, use the following password Qwertyuiop[123$4$567] 3. After encrypting this file with the above password, you obtain an encrypted file of the same length; after decrypting that file with the same password you should obtain an exact replica of this file, and this must be reflected in the Report document by appropriate screenshots showing the content of the files involved in these operations.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!