I'm implementing an encryption mechanism where I work, and the security guy's demands are as follows:
- Create a 256 bit key using PBKDF2WithHmacSHA512, secret password, 256bit salt and 20000 iterations minimum.
- Salt should be generated using SecureRandom.getInstance("SHA1PRNG");
- Encrypt using AES256 with the derived key.
I'm trying to use Jasypt's StandardPBEStringEncryptor class
encryptor.setPassword(PASSWORD);
encryptor.setAlgorithm("AES/CBC/PKCS5Padding");
encryptor.setKeyObtentionIterations(20000);
encryptor.setSaltGenerator(new RandomSaltGenerator());
encryptor.encrypt("something");
When I do this I get the following exception:
java.security.NoSuchAlgorithmException: AES/CBC/PKCS5Padding SecretKeyFactory not available
Am I using Jasypt incorrectly? What am I missing here?
Thanks
I ended up contacting Daniel Fernández who is Jasypt's lead programmer and his answer:
I used this bit of java code for doing this (Without Jasypt):