|
|
@@ -1,16 +0,0 @@
|
|
|
-package top.husj.husj_wx.utils;
|
|
|
-
|
|
|
-import java.util.Arrays;
|
|
|
-
|
|
|
-public class SignUtil {
|
|
|
- public static boolean checkSignature(String token, String signature, String timestamp, String nonce) {
|
|
|
- String[] arr = new String[]{token, timestamp, nonce};
|
|
|
- Arrays.sort(arr); // 字典序排序
|
|
|
- StringBuilder content = new StringBuilder();
|
|
|
- for (String s : arr) content.append(s);
|
|
|
-
|
|
|
- // 使用Apache Commons Codec或自定义SHA1加密
|
|
|
- String temp = DigestUtils.sha1Hex(content.toString());
|
|
|
- return temp.equalsIgnoreCase(signature);
|
|
|
- }
|
|
|
-}
|