Commit 8c16df69 authored by 张永's avatar 张永

1

parent 9614ad10
......@@ -43,6 +43,26 @@ public class MD5Util {
return sign;
}
public static String createSign_pospay(String characterEncoding,SortedMap<Object,Object> parameters,String keyName,String keyValue){
StringBuffer sb = new StringBuffer();
Set<?> es = parameters.entrySet();//所有参与传参的参数按照accsii排序(升序)
Iterator<?> it = es.iterator();
while(it.hasNext()) {
Entry<?, ?> entry = (Entry<?, ?>)it.next();
String k = (String)entry.getKey();
Object v = entry.getValue();
if(null != v && !"".equals(v)&& !"sign".equals(k) ) {
sb.append(k + "=" + v + "&");
}
}
sb.deleteCharAt(sb.length()-1);
String signstr = sb.toString()+"&"+keyName+"="+keyValue;
System.out.println("签名的字符串:"+signstr);
logger.info("签名的字符串: {}",signstr);
String sign = MD5Encode(signstr, characterEncoding).toLowerCase();
return sign;
}
private static String byteArrayToHexString(byte b[]) {
StringBuffer resultSb = new StringBuffer();
for (int i = 0; i < b.length; i++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment