|
|
@@ -1,6 +1,11 @@
|
|
|
package org.jeecg.common.utils;
|
|
|
|
|
|
import org.apache.commons.codec.binary.Base64;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
+import java.net.URLEncoder;
|
|
|
|
|
|
/**
|
|
|
* @Author: zwq
|
|
|
@@ -8,6 +13,24 @@ import org.apache.commons.codec.binary.Base64;
|
|
|
* @Description: 加密工具类
|
|
|
*/
|
|
|
public class CryptTool {
|
|
|
+ private static Logger log = LoggerFactory.getLogger(CryptTool.class);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 请求报文加密
|
|
|
+ *
|
|
|
+ * @param biz_content
|
|
|
+ * @return
|
|
|
+ * @throws UnsupportedEncodingException
|
|
|
+ */
|
|
|
+ public static String encode(String biz_content) throws UnsupportedEncodingException {
|
|
|
+ //将JSON串进行URLEncoder 编码,编码格式都是 UTF-8
|
|
|
+ biz_content = URLEncoder.encode(biz_content, "UTF-8");
|
|
|
+ log.info("urlencode加密=====", biz_content);
|
|
|
+ //base64加密
|
|
|
+ biz_content = encryptBASE64(biz_content.getBytes());
|
|
|
+ log.info("base64加密=====", biz_content);
|
|
|
+ return biz_content;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* base64加密
|