|
@ -35,7 +35,7 @@ public class ActWithoutProofUtils { |
|
|
public static final String LOGIN_ID = "zhihuishequ"; |
|
|
public static final String LOGIN_ID = "zhihuishequ"; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 数据加解密密钥 |
|
|
* 数据加解密秘钥 |
|
|
*/ |
|
|
*/ |
|
|
public static final String KEY = "1122334455667788"; |
|
|
public static final String KEY = "1122334455667788"; |
|
|
|
|
|
|
|
@ -169,11 +169,10 @@ public class ActWithoutProofUtils { |
|
|
|
|
|
|
|
|
json.put("loginid", "zhihuishequ"); |
|
|
json.put("loginid", "zhihuishequ"); |
|
|
String content = json.toString(); |
|
|
String content = json.toString(); |
|
|
String key = "1122334455667788"; |
|
|
|
|
|
// 加密
|
|
|
// 加密
|
|
|
System.out.println("加密前:" + content); |
|
|
System.out.println("加密前:" + content); |
|
|
|
|
|
|
|
|
byte[] encryptResult = encrypt(content, key); |
|
|
byte[] encryptResult = encrypt(content, ActWithoutProofUtils.KEY); |
|
|
String encryptResultStr = parseByte2HexStr(encryptResult); |
|
|
String encryptResultStr = parseByte2HexStr(encryptResult); |
|
|
String baseEncode = Base64.getEncoder().encodeToString(encryptResultStr.getBytes()); |
|
|
String baseEncode = Base64.getEncoder().encodeToString(encryptResultStr.getBytes()); |
|
|
System.out.println("加密后:" + baseEncode); |
|
|
System.out.println("加密后:" + baseEncode); |
|
@ -181,7 +180,7 @@ public class ActWithoutProofUtils { |
|
|
//解密
|
|
|
//解密
|
|
|
String baseDecode = new String(Base64.getDecoder().decode(baseEncode)); |
|
|
String baseDecode = new String(Base64.getDecoder().decode(baseEncode)); |
|
|
byte[] decryptFrom = parseHexStr2Byte(baseDecode); |
|
|
byte[] decryptFrom = parseHexStr2Byte(baseDecode); |
|
|
byte[] decryptResult = decrypt(decryptFrom, key); |
|
|
byte[] decryptResult = decrypt(decryptFrom, ActWithoutProofUtils.KEY); |
|
|
System.out.println("解密后:" + new String(decryptResult)); |
|
|
System.out.println("解密后:" + new String(decryptResult)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|