商圈商户的V3密钥是正确的,解密工具是用的官方提供的。
回调结果: {"id":"2eb20456-0245-5cf7-a661-78de9cad3a32","create_time":"2021-09-03T10:01:19+08:00","resource_type":"encrypt-resource","event_type":"MALL_TRANSACTION.SUCCESS","summary":"支付成功","resource":{"original_type":"mall_transaction","algorithm":"AEAD_AES_256_GCM","ciphertext":"9Hk5bvtXeB3g/RQJm3cW6bBjxs41gd5vIUDD+VHJ/FfMV9wsCDAW8BOY+K4ynt+e+alCTdWeH7BeRMojJiESXWYqg86H87u+d7/soAoQ/nWNNBhBT/uC+v8ZFqvZ1d0COvsbvUd6uCBiL4MRzA+i4x0t9apwJXHJnVgoavk9c9pViOAhjjemnz0/cMnFUPY7iGhIAi4T1TDVPr8FEo0GP25k2RhQvo463CFGc8kVzgwpA54OKkewqqqfZXu4oxDUtvXUfb+Xq6rJcojJLUQKIUcxl1gPruXmpm+KJnE3t7Ut9jBVj3+zrH+RqpT8W7tyaX11XsMKkH4Fa1k1q3tWGDvSa3Uv5TmzJktvqO65HszgcHVVT+TMS7kCYfS+Fgpomt2P94T4Y/voREQfs4U=","associated_data":"mall_transaction","nonce":"sQCkxIGiowJX"}}
一直解密失败,报错如下
javax.crypto.AEADBadTagException: Tag mismatch!
at com.sun.crypto.provider.GaloisCounterMode.decryptFinal(GaloisCounterMode.java:578)
at com.sun.crypto.provider.CipherCore.finalNoPadding(CipherCore.java:1049)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:985)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:847)
at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:446)
at javax.crypto.Cipher.doFinal(Cipher.java:2164)
at com.smelep.acemade.util.AesUtil.aesgcmDecrypt(AesUtil.java:84)
at com.smelep.acemade.util.AesUtil.main(AesUtil.java:92)