views:

138

answers:

5

Is there a library or something that will allow me to simply call a function that will AES encrypt a byte array?

I don't want to deal with multiple update blocks/transformFinal/etc, because there is a possibility I will mess up...

A: 

This link has an example of using AES in java's crypto libraries.

Update: The Chilkat library has some AES abstractions. Here is an example.

Präriewolf
The example in the first link you provided uses the default encryption mode of ECB which can be insecure, exactly the kind of pitfall I want to avoid by using a library rather than finding some code on the internet to copy. See http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29 for why ECB is insecure.
Kyle
A: 

Here's a great manual about java security by IBM.

Roman
+1  A: 

I recommend using Jasypt.

Rook
+1  A: 

Haven't used java in a while but Bouncy Castle was pretty nice. For add benefit, there's a c# port.

Krypes
+2  A: 

Cipher.doFinal()

GregS