I'm trying to decrypt a file received from my REST API. I've encrypted the file with openssl on linux with the command line
openssl aes-256-cbc -k mypassword -in file_test.pdf -out file_crypted.pdf
I've tried almost all possibilities with android and it always end up with an error, nothing works well.
This is my last code version
String password = "mypassword";
byte[] srcString = FileUtils.readFileToByteArray(new File("my_file.pdf"));
SecretKeySpec key = new SecretKeySpec(password.getBytes(), "AES");
Cipher aesCBC = Cipher.getInstance("AES/CBC/PKCS5Padding");
aesCBC.init(Cipher.DECRYPT_MODE, key);
byte[] decrypted = aesCBC.doFinal(srcString);
Do you have any idea how could I fix this