This question already has an answer here:
I need to know how to create an AES and using it to encrypt and decrypt a file in java.
This question already has an answer here:
I need to know how to create an AES and using it to encrypt and decrypt a file in java.
Try using a
CipherOutputStream
and passing in aFileOutputStream
. See http://www.java2s.com/Tutorial/Java/0490__Security/UsingCipherOutputStream.htm for a quick example, just useCipher.getInstance("AES/CBC/PKCS5Padding")
instead.