签名认证
更新时间: 2017-11-22 15:29:53 访问次数:807
一、拼接签名串

按字段名的字母顺序拼接(包括data中的json字符串也按此规则),将token放在字符串的两端,如下所示: 签名串 = token + action + actionValue + app_key + app_keyValue + data + dataValue + format + formatValue + platform + platformValue + sign_method + sign_methodValue + timestamp + timestampValue + version + versionValue + token

特别说明:生成签名时需要注意一下几点:

  • ◆签名时参数必须按字母顺序从小到大排序(字典序);
  • ◆如果参数的值为空不参与签名,如JAVA中参数值为null的,不会参与签名("" 与 '' 认 为非空,需要参与签名);
  • ◆参数名区分大小写;
  • ◆在向WINIT发送HTTP请求时必须使用正确的编码格式(默认UTF-8)。
二、示例

签名串 =

3956C49B4525EAF246B640C9A6F3CE6BactioncreateOutboundOrderapp_key1378353828@qq.comdata
{ "address1": "1 Stafford Crt.", "address2": "aaaaaaa", "city": "Bayswater North", "deliveryWayID": 1000020, "eBayOrderID": "3298472983749823480", "emailAddress": "abc@winit.com", "insuranceTypeID": 1000010, "phoneNum": "15900001111", "productList": [ { "eBayBuyerID": "PowerBuyerDEF456", "eBayItemID": "34BayItemI34245", "eBaySellerID": "PowerSellerABC123", "eBayTransactionID": "2433ctionI234", "productCode": "EA0000201", "productNum": "1", "specification": "" } ], "recipientName": "mingbao", "region": "Victoria", "repeatable": "N", "sellerOrderNo": "PowerSellerABC123", "state": "AU", "warehouseID": 1000001, "zipCode": "3153" }
formatjsonplatformSELLERERP<sign_methodmd5timestampversion1.03956C49B4525EAF246B640C9A6F3CE6B

三、生成签名

对以上拼接后的签名串进行MD5运算,并转换成大写的32位签名。

签名 = toUpperCase(MD5(签名串))

上述示例生成的签名为:3E3D21E8BB9D39BF84B159B88D3BB11F

备注:所有接口中的sign字段按照此方法生成。
关键词