title: Need solution for wrong IV length in AES
body: <p>I'm trying to implement AES in Java and this is the code I use:</p>
  
  <pre><code> byte[] sessionKey = {00000000000000000000000000000000};
   byte[] iv = {00000000000000000000000000000000};
   byte[] plaintext = "6a84867cd77e12ad07ea1be895c53fa3".getBytes();
   Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
  
   cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(sessionKey, "AES"), new IvParameterSpec(iv));
   byte[] ciphertext = cipher.doFinal(plaintext);
  
   cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(sessionKey, "AES"), new IvParameterSpec(iv));
   byte[] deciphertext = cipher.doFinal(ciphertext);
  </code></pre>
  
  <p>I need this fixed key and IV for test purpose but I get the following exception:</p>
  
  <pre><code>Exception in thread "main"
  java.security.InvalidAlgorithmParameterException: 
    Wrong IV length: must be 16 bytes long    at
  com.sun.crypto.provider.SunJCE_h.a(DashoA12275)     at
  com.sun.crypto.provider.AESCipher.engineInit(DashoA12275)   at
  javax.crypto.Cipher.a(DashoA12275)  at
  javax.crypto.Cipher.a(DashoA12275)  at
  javax.crypto.Cipher.init(DashoA12275)   at
  javax.crypto.Cipher.init(DashoA12275)
  </code></pre>
  
  <p>How can I use this fixed IV with this implementation of AES? Is there any way?</p>