AES解密报Given final block not properly padded

错误内容:

{"timestamp":"2021-10-09 17:02:32","status":500,"error":"Internal Server Error","message":"Given final block not properly padded. Such issues can arise if a bad key is used during decryption.","path":"/system/security/cryptography/aes/decrypt"}

解密文本:

tSs27uklYbaWT6uZfp+2CQ==

其他描述:

1、IIS服务器端访问解密接口,Content-Type:application/x-www-form-urlencoded;charset=utf-8

2、参数:content

3、实际请求消息中:content=tSs27uklYbaWT6uZfp+2CQ==

4、导致的结果是,服务器接口端接收到的content值为:tSs27uklYbaWT6uZfp 2CQ==(中间缺少了个+)

5、解决方法:服务器端对content内容进行UrlEncode

6、原因:表单传参数时,加号“+”,被认为错误转化

原文地址:https://www.cnblogs.com/zhanqun/p/15392071.html