报错javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher 的解决方法
时间: 2023-10-12 17:59:22 浏览: 408
引用中提到,当使用AES解密时,报错javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher的意思是解密字符串的数组长度必须是16的倍数。所以解决这个问题的方法就是确保传入解密方法的字符串长度是16的倍数。你可以在加密之前,将原始字符串进行填充,使其长度符合要求。在解密之前,也需要确保解密字符串的长度是16的倍数。具体的实现方法可以参考代码中的示例中的相关部分。<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* [javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padd](https://blog.csdn.net/weixin_45915335/article/details/124152930)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}} ] [.reference_item]
- *2* [javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with pad](https://blog.csdn.net/qq_30624649/article/details/114937740)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}} ] [.reference_item]
- *3* [java AES 加密,报javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when ...](https://blog.csdn.net/qq_36205206/article/details/119993785)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}} ] [.reference_item]
[ .reference_list ]
阅读全文