|
|
|
@@ -67,24 +67,17 @@ public class WeappService { |
|
|
|
byte[] sessionKeyBytes = Base64.getDecoder().decode(obj.getSessionKey()); |
|
|
|
byte[] encryptedDataBytes = Base64.getDecoder().decode(encryptedData); |
|
|
|
byte[] ivBytes = Base64.getDecoder().decode(iv); |
|
|
|
log.info("sessionKeyBytes: {}", new String(sessionKeyBytes)); |
|
|
|
log.info("encryptedDataBytes: {}", new String(encryptedDataBytes)); |
|
|
|
log.info("ivBytes: {}", new String(ivBytes)); |
|
|
|
|
|
|
|
// 创建 AES 密钥对象 |
|
|
|
SecretKey secretKey = new SecretKeySpec(sessionKeyBytes, "AES"); |
|
|
|
log.info("secretKey: {} 1===", secretKey.getAlgorithm()); |
|
|
|
|
|
|
|
// 创建 AES 解密器 |
|
|
|
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); |
|
|
|
log.info("cipher: {} 2===", cipher.getAlgorithm()); |
|
|
|
cipher.init(Cipher.DECRYPT_MODE, secretKey, new IvParameterSpec(ivBytes)); |
|
|
|
|
|
|
|
// 解密 |
|
|
|
byte[] decryptedBytes = cipher.doFinal(encryptedDataBytes); |
|
|
|
log.info("decryptedBytes: {} 3===", new String(decryptedBytes)); |
|
|
|
String decoded = new String(decryptedBytes, "UTF-8"); |
|
|
|
log.info("decoded: {} 4===", decoded); |
|
|
|
return decoded; |
|
|
|
|
|
|
|
} |
|
|
|
|