public void fileTransfer(String Cipher_Chosen, InputStream sockIn, OutputStream sockOut) { System.out.println("***************FILE TRANSFER***************"); BufferedReader brin; String fileName; String line; boolean eve = false; int action = 0; try { brin = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the file name you want to transfer: "); fileName = brin.readLine().trim(); System.out.println("Do you want to simulate EVESDROPPER ? y/n"); line = brin.readLine(); if (line.equalsIgnoreCase("y")) { eve = true; System.out.println("Choose an evesdropper action? \nModify - 1 \nRemove - 2 \nAdd - 3"); line = brin.readLine(); action = Integer.parseInt(line); if (!(action != 1 || action != 2 || action != 3)) { System.out.println("Wrong input. Continuing with Remove action"); action = 2; } } else if (line.equalsIgnoreCase("n")) { } else { System.out.println("Wrong input. Continuing without evesdropper"); } if (Cipher_Chosen.equalsIgnoreCase("CBC")) { sendData(fileName, new CBC(key1, key2), sockIn, sockOut, eve, action); } else if (Cipher_Chosen.equalsIgnoreCase("CFB")) { sendData(fileName, new CFB(key1, key2), sockIn, sockOut, eve, action); } else if (Cipher_Chosen.equalsIgnoreCase("PCBC")) { sendData(fileName, new PCBC(key1, key2), sockIn, sockOut, eve, action); } else if (Cipher_Chosen.equalsIgnoreCase("RC4")) { sendData(fileName, new RC4(new String(key1)), sockIn, sockOut, eve, action); } else { System.out.println("something wrong in file transfer"); } } catch (IOException ioe) { ioe.printStackTrace(); } System.out.println("***************END OF FILE TRANSFER***************"); }