import java.security.*; import javax.crypto.*; import java.io.*; public class DecryptHandler { // public static void main(String args[]) { try { //secretKey FileInputStream fis = new FileInputStream(args[1]); ObjectInputStream ois = new ObjectInputStream(fis); //decryptedData FileOutputStream fos = new FileOutputStream(args[2]); SecretKey key = (SecretKey)ois.readObject(); ois.close(); Cipher c = Cipher.getInstance("Blowfish/ECB/PKCS5Padding"); c.init(Cipher.DECRYPT_MODE, key); //encryptedData fis = new FileInputStream(args[0]); CipherOutputStream cos = new CipherOutputStream(fos, c); byte[] b = new byte[8]; int i = fis.read(b); while (i != -1){ cos.write(b, 0, i); i = fis.read(b); } cos.flush(); cos.close(); fis.close(); fos.close(); }catch(Exception e){ e.printStackTrace(); } } }