Given final block not properly padded. Such issues can arise if a bad key is used during decryption
时间: 2023-08-25 19:16:01 浏览: 98
问题: "Given final block not properly padded. Such issues can arise if a bad key is used during decryption."这个错误是什么原因引起的?
回答: 这个错误是因为解密过程中使用了错误的密钥导致的。具体原因可能是使用了错误的密钥进行解密,或者解密过程中使用的SecureRandom对象在加密时根据操作系统底层进行加密,导致每次加密后的结果不同,无法进行解密。解决这个问题的办法是使用正确的密钥进行解密,并且使用SecureRandom对象时指定特定的算法和种子。例如,可以使用SecureRandom.getInstance("SHA1PRNG")来获取SecureRandom对象,并通过setSeed方法设置种子。<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* [javax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a](https://blog.csdn.net/kangweijian/article/details/127570890)[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^chatsearchT3_1"}} ] [.reference_item]
- *2* [DES加密工具类在不同系统编码导致加密失败](https://blog.csdn.net/qq314499182/article/details/103177031)[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^chatsearchT3_1"}} ] [.reference_item]
- *3* [“Given final block not properly padded. Such issues can arise if a bad key is used during“错误解决](https://blog.csdn.net/u012660464/article/details/128341544)[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^chatsearchT3_1"}} ] [.reference_item]
[ .reference_list ]
相关推荐
![dll](https://img-home.csdnimg.cn/images/20210720083646.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)