Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to encrypt a file in java using AES [duplicate]

I need to know how to create an AES and using it to encrypt and decrypt a file in java.

like image 432
Princeyesuraj Avatar asked Mar 15 '11 04:03

Princeyesuraj


1 Answers

Try using a CipherOutputStream and passing in a FileOutputStream. See http://www.java2s.com/Tutorial/Java/0490__Security/UsingCipherOutputStream.htm for a quick example, just use Cipher.getInstance("AES/CBC/PKCS5Padding") instead.

like image 163
WhiteFang34 Avatar answered Oct 18 '22 22:10

WhiteFang34