audit4j / audit4j-core

An open source auditing framework.
http://audit4j.org
Apache License 2.0
125 stars 77 forks source link

Initialization vectors should be randomly generated for proper security guarantees. #76

Open naskovai opened 6 years ago

naskovai commented 6 years ago

As part of some research about the common crypto mistakes that developers make, I noticed that your application has one of them.

In EncryptionUtil.getCipher you're initializing a Cipher instance with a static IV which is insecure.

One possible solution would be to generate the initialization vector using SecureRandom:

byte[] iv = new byte[16];
new SecureRandom().nextBytes(iv);