chenjiahe
2022-04-25 fb2c9fa355cc2e09bc051677dba89f86e9c0bd00
src/main/java/com/hx/util/rsa/RSASignature.java
@@ -121,4 +121,29 @@
        return false;
    }
    /**
     * ASCII码递增排序(剔除空值)
     * @param params
     * @return
     */
    public static String getSignCheckContent(Map<String, String> params) {
        if (params == null) {
            return null;
        } else {
            StringBuilder content = new StringBuilder();
            List<String> keys = new ArrayList(params.keySet());
            Collections.sort(keys);
            for(int i = 0; i < keys.size(); ++i) {
                String key = (String)keys.get(i);
                Object value = params.get(key);
                if(value == null){
                    continue;
                }
                content.append(i == 0 ? "" : "&").append(key).append("=").append(value);
            }
            return content.toString();
        }
    }
}