跳到主要内容

验签方法

为了防止API返回过程中被恶意篡改,调用方需对返回值做签名验证,并解密获取到返回值内容

  • 签名算法: MD5

对所有返回的公共参数(sign除外),根据参数名称的ASCII码表的顺序排序,以url拼装方式把参数名和参数值拼接在一起。 如:

code=0&msg=1&data=2
信息

什么是 设备deviceSecret

class Signxxx {
public void makeSign(String secretKey) {
Map<String, String> map = new HashMap<>();
map.put("code", code);
map.put("msg", msg);
if (data != null) {
map.put("data", data);
}
this.sign = SignUtils.md5Sign(map, secretKey);
}
}