diff --git a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/ShHttp.java b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/ShHttp.java index a601047..19d5327 100644 --- a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/ShHttp.java +++ b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/ShHttp.java @@ -1,5 +1,6 @@ package com.yxt.supervise.gf.shanhai; +import cn.hutool.core.util.StrUtil; import cn.hutool.crypto.SecureUtil; import cn.hutool.crypto.asymmetric.KeyType; import cn.hutool.crypto.asymmetric.RSA; @@ -15,14 +16,16 @@ import java.util.Map; public class ShHttp { private static final Logger L = LoggerFactory.getLogger(ShHttp.class); - private static String publicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1Z/+Bslu203UtutmzMW/" + + private static final String RSA_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1Z/+Bslu203UtutmzMW/" + "FqS9bQvaMXQHgvU+ilNR5Hm2IZZalBWPoSbCGzlCUA19C3X6T17X09OMa6aDPKBm" + "F6yXvUI7E/nWM9qUJ5hj4zVO/9GoH03WUyCWSBQg4f+LcnLS75v8nI6moOJ5ILkH" + "mg2KNbEdx55UWjSqBatEopnLWtMFDGZswEbKBH3e2yalK6ddh2kUrtcuQGqFYm/u" + "ViAOV+KoptwY2MCNSRLKYE4pCA2BCit7nr3EqNZRqqhKaOE44iyv45zCFrllx3nn" + "wF3X/l+rR4G7Vc7HZwiqKF3RXl9PqmTLJkzhdpAdQX/Kr3SRRHsv/DzKjAZr/2jK" + "rQIDAQAB"; - private static String key = "sJI8PuGweKztQ6nLgp3dqcwljdKGFjPBD3XyUqCFsVG8rYhAIbD2AkNIKaefbjOB"; + private static final String RSA_KEY = "sJI8PuGweKztQ6nLgp3dqcwljdKGFjPBD3XyUqCFsVG8rYhAIbD2AkNIKaefbjOB"; + private static final String RSA_KEY_MD5 = SecureUtil.md5(RSA_KEY); + private static final RSA RSA_OBJ = new RSA(null, RSA_PUBLIC_KEY); // private static String baseUrl = "http://hf-service.tiefaos.com"; private static String baseUrl = "http://hf.lx-obj.top"; @@ -73,13 +76,14 @@ public class ShHttp { // "R6meDCI2OM0GtCWwBxOagCYt8V5DfD47VyNHYn0xFRva4GFBF6K19061h1cu68eXxfIZj+clMweGlICgeXhktq8Z1T0Xmbah" + // "FjhyTmdXuRxZBeQkLsot00XJHwQ48B6Z/VdOPpqoD95NTngRdV3+A=="; // 测试数据 - String keyMd5 = SecureUtil.md5(key); - String val = key + date + keyMd5; - RSA rsa = new RSA(null, publicKey); - String res = rsa.encryptBase64(val, KeyType.PublicKey); +// String val = RSA_KEY + date + RSA_KEY_MD5; +// String val = StrUtil.format("{}{}{}", RSA_KEY, date, RSA_KEY_MD5); + String val = new StringBuilder(RSA_KEY).append(date).append(RSA_KEY_MD5).toString(); + String res = RSA_OBJ.encryptBase64(val, KeyType.PublicKey); return res; } + private static String headerDate() { String res = "" + (System.currentTimeMillis() / 1000); // res = "1683516744"; // 测试数据