小编Sou*_*rta的帖子

(java.security.InvalidKeyException)当cipher.init(Cipher.DECRYPT_MODE,key)出现一个预期错误时,未设置IV

SecretKey key = keyFactory.generateSecret(keySpec);
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, key);
byte[] ciphertext = cipher.doFinal(cleartext);

return bytes2String(ciphertext);
Run Code Online (Sandbox Code Playgroud)

我正在获取java.security.InvalidKeyException,即,当cipher.init(Cipher.DECRYPT_MODE,key).cleartext出现一个预期错误时,没有设置IV,这是基于base64解码字符串的字节数组。我在这里缺少什么?

java encryption

1
推荐指数
1
解决办法
2170
查看次数

标签 统计

encryption ×1

java ×1