|
|
|
|
package com.ynxbd.wx.wxfactory;
|
|
|
|
|
|
|
|
|
|
import com.ynxbd.common.helper.common.AesHelper;
|
|
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 请求参数加密处理
|
|
|
|
|
*/
|
|
|
|
|
public class AesWxHelper extends AesHelper {
|
|
|
|
|
private static final String KEY = "wsqysqsdssjtwmyd";
|
|
|
|
|
private static final String IV = "xbdynwdykkrinkll";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 加密
|
|
|
|
|
*/
|
|
|
|
|
public static String encode(String data) {
|
|
|
|
|
return encryptHex(data, KEY, IV);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 加密
|
|
|
|
|
*/
|
|
|
|
|
public static String encode(String data, boolean isDataNotNull) {
|
|
|
|
|
if (isDataNotNull && ObjectUtils.isEmpty(data)) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return encryptHex(data, KEY, IV);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 解密
|
|
|
|
|
*/
|
|
|
|
|
public static String decode(String enData) {
|
|
|
|
|
if (ObjectUtils.isEmpty(enData)) return null;
|
|
|
|
|
return decryptHex(enData, KEY, IV);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
System.out.println(encode("001"));
|
|
|
|
|
// System.out.println(decode("E6835E243069406F53EC8464898B37C0"));
|
|
|
|
|
}
|
|
|
|
|
}
|