java.lang.IllegalArgumentException:空输入缓冲区

时间:2017-03-28 17:55:05

标签: java encryption aes

我收到java.lang.IllegalArgumentException:当我调用解码输入字符串函数时,空输入缓冲区异常。这是我的功能

public String decodeInputString(String inputString) throws NoSuchAlgorithmException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, NoSuchPaddingException {
        byte[] salt = "MyKey".getBytes();
        SecretKey secretKey = new SecretKeySpec(salt, 0, 16, "AES");
        byte[] encryptedTextByte = Base64.decode(inputString);
        cipher = Cipher.getInstance("AES");
        cipher.init(Cipher.DECRYPT_MODE, secretKey);
        byte[] decryptedByte = cipher.doFinal(encryptedTextByte);
        String decryptedText = new String(decryptedByte);
        return decryptedText;

}

当我调用decodeInputString(“s8aCvIy4pcgc Y Gu / MSAw ==”)时,我收到了java.lang.IllegalArgumentException:Null输入缓冲区异常。

0 个答案:

没有答案