Question: Extend on the Java program below so that it also: integrates AES to encrypt and then decrypt using keyboard input integrates AES to encrypt and

Extend on the Java program below so that it also:

  • integrates AES to encrypt and then decrypt using keyboard input
  • integrates AES to encrypt and then decrypt using file input
  • integrates Blowfish to encrypt and then decrypt using keyboard input
  • integrates Blowfish to encrypt and then decrypt using file input
  • displays appropriate messages during execution to inform the user of progress

Program code:

import java.io.*; import java.util.*; public class Main { public static void main(String[] args){ try { Scanner in = new Scanner(System.in); System.out.println("Enter the name of the file to read: "); String filename = in.nextLine(); Scanner sc = new Scanner(new File(filename)); //reading the contents of the file while(sc.hasNextLine()){ String line = sc.nextLine(); System.out.println("Line before filtering:"); System.out.println(line); System.out.println("Line after filtering:"); for (int i = 0; i < line.length(); i++) { char ch = line.charAt(i); if(Character.isLetterOrDigit(ch) || ch == '.'|| ch == ','||ch == '!'||ch == '?'||ch == ' '){ //printing only letters, numbers and some punctuation System.out.print(ch); } } System.out.println(" "); } } catch (FileNotFoundException e) { //if file was not found System.out.println("File Error!"); } } }

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!