不加密,被篡改逻辑
只关注防篡改,后台具体其它验证不关注
用户---->userId=1&accountMoney=10---->充值账户
| |
| |
被拦截:userId=11&accountMoney=10(修改userId)
加密逻辑
请求后台拿到:key,appid(一一对应)
不要泄露key
参数加密: userId=1&accountMoney=10&appid=666&sigin=Md5(userId=1&accountMoney=10&appid=666key)
加密后,防篡改逻辑
用户---->userId=1&accountMoney=10&appid=666&sigin=greefweg---->充值账户
| |(数据库appid查询key,生成sigin)
| | (sigin校验失败,篡改失败)
被拦截:userId=11&accountMoney=10&appid=666&sigin=greefweg(修改userId)