Souhaitez utiliser AES 256-CBC avec 32 octets, mais il montre java.de sécurité.InvalidAlgorithmParameterException

Je suis en utilisant AES 256-CBC. J'ai 32 octets de IV. Mais lorsque je l'exécute il montre une exception:

Exception in thread "main" java.lang.RuntimeException: java.security.InvalidAlgorithmParameterException: Wrong IV length: must be 16 bytes long
    at com.abc.aes265cbc.AESUtil.decrypt(AESUtil.java:50)
    at com.abc.aes265cbc.Security.main(Security.java:48)
Caused by: java.security.InvalidAlgorithmParameterException: Wrong IV length: must be 16 bytes long
    at com.sun.crypto.provider.CipherCore.init(CipherCore.java:430)
    at com.sun.crypto.provider.AESCipher.engineInit(AESCipher.java:217)
    at javax.crypto.Cipher.implInit(Cipher.java:790)
    at javax.crypto.Cipher.chooseProvider(Cipher.java:848)
    at javax.crypto.Cipher.init(Cipher.java:1347)
    at javax.crypto.Cipher.init(Cipher.java:1281)
    at com.abc.aes265cbc.AESUtil.decrypt(AESUtil.java:47)
    ... 1 more

Je ne sais pas comment résoudre ce problème. J'ai cherché mais je n'obtiens pas comment résoudre ce problème. Je suis en train de concepts de sécurité pour la première fois.
Mon code pour l'AES 256-CBC est:

 public static void setENCRYPTION_IV(String ENCRYPTION_IV) {
AESUtil.ENCRYPTION_IV  =   ENCRYPTION_IV;
}
public static void setENCRYPTION_KEY(String ENCRYPTION_KEY) {
AESUtil.ENCRYPTION_KEY  =   ENCRYPTION_KEY;
}
public static String encrypt(String src) {
try {
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, makeKey(), makeIv());
return Base64.encodeBytes(cipher.doFinal(src.getBytes()));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public static String decrypt(String src) {
String decrypted = "";
try {
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, makeKey(), makeIv());
decrypted = new String(cipher.doFinal(Base64.decode(src)));
} catch (Exception e) {
throw new RuntimeException(e);
}
return decrypted;
}
static AlgorithmParameterSpec makeIv() {
try {
return new IvParameterSpec(ENCRYPTION_IV.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
}
static Key makeKey() {
try {
MessageDigest md = MessageDigest.getInstance("SHA-256");
byte[] key = md.digest(ENCRYPTION_KEY.getBytes("UTF-8"));
return new SecretKeySpec(key, "AES");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
}

Pouvez-vous m'aider qu'en changeant ce qui, dans ce code, je vais être en mesure d'utiliser 32 octets de IV.
Merci d'avance

Edit:
Ma fonction principale à laquelle les appels de ces fonctions:

 AESUtil.setENCRYPTION_KEY("96161d7958c29a943a6537901ff0e913efaad15bd5e7c566f047412179504ffb");
AESUtil.setENCRYPTION_IV("d41361ed2399251f535e65f84a8f1c57");
String decrypted = AESUtil.decrypt(new String(sw0SrUIKe0DmS7sRd9+XMgtYg+BUiAfiOsdMw/Lo2RA=));   //AES Decrypt
Pouvez-vous fournir un SSCCE qui est compilable et exécutable hors de la boîte et montre le problème? (y compris une méthode main qui montre les méthodes qui vous appel dans l'ordre)
Quelle est la raison pour laquelle vous souhaitez utiliser 32bytes (256bits)? Voir ma réponse mis à jour - pour AES/CBC/PKCS5Padding, blockLength = Longueur de la clé = IV longueur = 128 bits (16 octets).
J'ai ajouté mes clés de la valeur...Cela va vous montrer l'exception qui je suis.

OriginalL'auteur Vaibs | 2012-11-20