well, i have problem with my program regarding AeS ecryption and decryption,,.
I have successful encrypt a file using 128bit AES/ECB/PKCS7Padding.but i failed to decrypt the file.
well, i get cipherFileName..public byte[][] decrypt(byte[][] data) throws GeneralSecurityException, Exception { Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); RSAPrivateKey privKey = (RSAPrivateKey) readPrivateKey(keyPath); Cipher cipherA = Cipher.getInstance("AES/ECB/PKCS7Padding", "BC"); Cipher cipher = Cipher.getInstance("RSA/ECB/NOPadding", "BC"); Cipher cipherA2 = Cipher.getInstance("AES/ECB/PKCS7Padding", "BC"); // RSAPublicKey pubKey = (RSAPublicKey) readKeyFromFile(keyPath); cipher.init(Cipher.DECRYPT_MODE, privKey); secretKey = cipher.doFinal(data[2]); System.out.println("\n\n"+"DecryptionClass"); System.out.println("Encrypted Key="+new String(data[2])+"\n"+"Encrypted data"+new String(data[1])); System.out.println("SecretKey="+new String(secretKey)); SecretKeySpec skeySpec = new SecretKeySpec(secretKey, "AES"); cipherA2.init(Cipher.DECRYPT_MODE, skeySpec); cipherData =cipherA2.doFinal(data[0]); cipherA.init(Cipher.DECRYPT_MODE, skeySpec); cipherFileName = cipherA.doFinal(data[1]); decryp[0]= cipherData; decryp[1]= secretKey; decryp[2]=cipherFileName; System.out.println("\n\n"+"DecryptionClass"); System.out.println("data="+new String(decryp[0])+"\n"+"Encrypted data"+new String(data[1])); System.out.println("Decrepted Key"+new String(decryp[1])+"\n"+"Encrypted key="+new String(data[2])); return decryp;