import java.io.*; import java.security.Key; import java.security.KeyStore; import java.security.KeyStoreException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.Provider; import java.security.Security; import java.security.UnrecoverableKeyException; import java.security.cert.CertificateException; import java.security.spec.KeySpec; import java.util.*; import javax.crypto.*; import javax.crypto.*; import javax.crypto.spec.DESKeySpec; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; public class Decrypt{ public static void main(String[] args) { try { CipherInputStream ci; String TransactionLog="ABC.xml"; String FEK="C9063155B07A542BD678B1E2969C1B775E47BFA9"; Cipher c =null; SecretKeySpec secretKey=null; InputStreamReader reader =null; FileInputStream fis = null; fis=new FileInputStream(TransactionLog); /*Please do paste this data into file adP2rz4phDL01MmgPz/B+QoWvWr8UAwKcBNOVcDOvbHI1tIpIaW5a+Vyd8eK6K2WW2mjyhrhIGI9 TeL552EnzKmOjefkCV8miv1yxUG+TfshXNVlaS5n4xHQ178cnsqyOylg0HoOGOIGBwE/HMEo1jlf l/+bRy7o8j5+ruDvqs4ztSnG/lj09dCIvkOSUS454adFtllpYATyWSQLBesNbqWrerDKH52GTBiR 3OvXyYGAqdlah3iN4MQ56B8HtOZt3CD9y+v0lhYmVHeBrVZ0m5+b2EG12xDBCezy7JitALQP/175 pt9+rbQLDBMJKvd7DKZs */ c = Cipher.getInstance("AES/CBC/PKCS5Padding" ); byte[] deskeydata = null; deskeydata = Hex.fromString(FEK); byte[] newiv=new byte [] {99, 126, 11, -10, -128, -58, -122, -16, -48, -82, 40, 69, 52, -121, 121, 88}; IvParameterSpec ivspec = new IvParameterSpec(newiv); deskeydata = Arrays.copyOf(deskeydata, 16); secretKey = new SecretKeySpec(deskeydata, "AES"); c.init(2, secretKey, ivspec); ci = new CipherInputStream(new Base64.InputStream(fis, Base64.DECODE), c); reader = new InputStreamReader(ci, "UTF-8"); BufferedReader br = new BufferedReader(reader); String xmlString = ""; String xmlData = ""; while ((xmlString=br.readLine()) != null) { xmlData += xmlString; } reader.close(); fis.close(); ci.close(); br.close(); System.out.println(" File is decrypted"+xmlData); } catch (Exception ex) { System.out.println(" File is Not decrypted in Exception"); ex.printStackTrace(); } } }