Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Experts Guide To Database 2

Authors: Bruce L. Larson

1st Edition

0070232679, 978-0070232679

More Books

Students also viewed these Databases questions