签名工具优化

This commit is contained in:
egan
2019-01-06 13:16:33 +08:00
parent 24b3e22df8
commit 485438a4f1
2 changed files with 4 additions and 2 deletions

View File

@@ -1,5 +1,7 @@
package com.egzosn.pay.common.util.sign;
import com.egzosn.pay.common.bean.result.PayException;
import com.egzosn.pay.common.exception.PayErrorException;
import com.egzosn.pay.common.util.sign.encrypt.sm3.SM3Digest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -91,7 +93,7 @@ public class SecureUtil {
try {
bytes = digestByData(data.getBytes(encoding),ALGORITHM_SHA1);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
throw new PayErrorException(new PayException("error", e.getLocalizedMessage()));
}
StringBuilder sha256StrBuff = new StringBuilder();
for (int i = 0; i < bytes.length; i++) {

View File

@@ -230,7 +230,7 @@ public enum SignUtils {
if ("".equals(value)){ continue;}
valueStr += (i == values.length - 1) ? value : value + ",";
}
} else if (o != null) {
} else {
valueStr = o.toString();
}
if (null == valueStr || "".equals(valueStr.toString().trim()) || (null != ignoreKey && Arrays.binarySearch(ignoreKey, k ) >= 0)) {