title: java.security.InvalidKeyException: Illegal key size
body: <p>When I run this code in Android it produces no errors, but when I run it in a standard Java program it produces the exception: java.security.InvalidKeyException: Illegal key size.</p>
  
  <pre><code>Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
  SecretKeySpec keySpec = new SecretKeySpec(CHUNK_ENCRYPTION_KEY.getBytes(), 0, 32, "AES");
  IvParameterSpec initVector = new IvParameterSpec(AES_INITIALIZATION_VECTOR.getBytes(), 0 , 16);
  cipher.init(Cipher.ENCRYPT_MODE, keySpec, initVector);
  </code></pre>
  
  <p>CHUNK_ENCRYPTION_KEY is a 32 byte key hard-coded into the program.
  AES_INITIALIZATION_VECTOR is a 16 byte hard-coded initialization vector.</p>
  
  <p>Does anyone know why it would work on Android and not on a Desktop?</p>