Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Convert the for loop in private static String getTextFileAsString ( ) method to a while loop. Make sure to comment the method as well. 2
Convert the for loop in private static String getTextFileAsString method to a while loop. Make
sure to comment the method as well.
Surround the long ifelse structure in main method with a dowhile loop, such that the program
will only end when the user enters in the value as a choice.
Convert the long ifelse structure to a switchcase Also take care of the scenario where the user
does not enter a valid choice Tell them they made an invalid choice. Hint: look up the
default keyword.
For choices through slightly modify the code to allow the user to choose the names of the
files instead of them being hardcoded Hint, use an instance of Scanner to get the users
response, and store their answer in a String.
Change choice so the decrypted text is written to a text file of the users choice instead of
the console Hint: replace System.out with an instance of PrintWriter... dont forget to close it
either!
Test the program. Create a text file either with notepad or Eclipse and put a message in it less
than characters Run the program, choose and encrypt the text file.
Immediately choose See if the decrypted text file matches the original text files message.
Choose options and to save the current pair of public and private keys to text files.
Choose to quit.
Rerun the program.
Use the private key provided to you MasterPrivateKey.key on myCourses with choice Use the
file Encrypted.bin from myCourses as the encrypted file to decrypt here. The resulting file, if all
works properly, will contain a message in English.
Rerun the program again a few times, choosing option to encrypt a new text file with varying
amounts of text. Be sure to save the encrypted files with different names.
Answer the following questions in the comments at the top of your code
SimpleAsymKeyEncryptAppjava
a For each of the encrypted files you created, what can you note about the file size? right
click on the file and choose properties
b Does it seem like the amount of text you encrypted seemed to have an impact on the
encrypted files size?
c Does the size seem to relate to the limitation of the number of characters in the textfile
d If we cant go above characters to encrypt, but we have more than to encrypt,
what would be a simple solution to fix this? Hint: If you have to ship a large item, but
that item is bigger than the biggest single box allowed to ship it what can you do to the
item to ship it and make sure it all makes it there in the end?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started