title: Using Jasypt for password based AES encryption with PBKDF2WithHmacSHA1 key
body: <p>I'm implementing an encryption mechanism where I work, and the security guy's demands are as follows:</p>
  
  <ol>
  <li>Create a 256 bit key using PBKDF2WithHmacSHA512, secret password, 256bit salt and 20000 iterations minimum.</li>
  <li>Salt should be generated using SecureRandom.getInstance("SHA1PRNG");</li>
  <li>Encrypt using AES256 with the derived key.</li>
  </ol>
  
  <p>I'm trying to use Jasypt's <em>StandardPBEStringEncryptor</em> class</p>
  
  <pre><code>encryptor.setPassword(PASSWORD);
  encryptor.setAlgorithm("AES/CBC/PKCS5Padding");
  encryptor.setKeyObtentionIterations(20000);
  encryptor.setSaltGenerator(new RandomSaltGenerator());
  encryptor.encrypt("something");
  </code></pre>
  
  <p>When I do this I get the following exception:</p>
  
  <blockquote>
    <p>java.security.NoSuchAlgorithmException: AES/CBC/PKCS5Padding SecretKeyFactory not available</p>
  </blockquote>
  
  <p>Am I using Jasypt incorrectly? What am I missing here?</p>
  
  <p>Thanks</p>