原文:解決:擾人的報錯 Input length must be multiple of 8 when decrypting with padded cipher

轉載自https: www.lanhusoft.com Article .html 最近在做token用DES加密解密的時候遇到擾人的報錯 。 加密沒有問題,解密有時候會出現下面問題: Input length must be multiple of when decrypting with padded cipherjavax.crypto.IllegalBlockSizeException: ...

2020-07-06 10:14 0 4766 推薦指數:

查看詳情

url請求時,參數中的+在服務器接收時為空格,導致AES加密報出javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher

報錯的意思的是使用該種解密方式出入長度應為16bit的倍數,但實際的錯誤卻不是這個,錯誤原因根本上是因為在http請求是特殊字符編碼錯誤,具體就是base64生成的+號,服務器接收時成了空格,然后導致base64解碼出的字節數組有改變。 下面來還原並分析一下具體原因: 請求代碼 ...

Fri Aug 23 02:20:00 CST 2019 0 3584
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM