商家劵领券事件回调通知API解密出现 Tag mismatch!
Exception in thread "main" 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.tjcloud.tenpay.api.utils.AesUtil.decryptToString(AesUtil.java:58)
at com.tjcloud.tenpay.api.utils.AesUtil.main(AesUtil.java:68)
回调通知结果
({"summary":"商家券领券通知","event_type":"COUPON.SEND","create_time":"2021-02-20T11:47:11+08:00","resource":{"original_type":"coupon","algorithm":"AEAD_AES_256_GCM","ciphertext":"k2O7h/5emD0j8h2OGEgMJFANEBqmYk6ltMpjKqoTs2KoAhilbOE1tiCMgdn8ehNnrZgXiaIFCZ/Hynhx6HiNxMHSskrIsGnFmr7rnbzpmoUkm+5nawIqBUuuGzDU74d01Xn/OaFDriyyZZX0QPh3sGrLg3aF/x9vwUWXb3cblUrfM1JpxJNqZezMSFIufWJQrpUcNZkOqi3dk9AvJO63WClb5iUhsGc7odvbVlUUEtJBZXUqyG18h34j479UEtA316AZJjdca43wzU7GDCrjG3Z1Jb8Smh+9VhIBjFeDpCsy1wvSgkn2RsKV1x3F4GjFcJEuIepVCZyn/XkdBXfZxbBvAoEJWfOeooDexwHBBah2Eaazj5Y6DxfVT0JE891z02DsEL6GbiDhbNf7+6DTrIOB9s5v9/5Ppd7jnM03Ig5eFb0=","associated_data":"coupon","nonce":"ls2ADfEEHn25"},"resource_type":"encrypt-resource","id":"b4ea27d7-c02a-5e89-a660-f9d24b381776"})
问题解决了吗 哥们
APIv3秘钥仔细检查下是否填错
参考解密示例:https://pay.weixin.qq.com/wiki/doc/api/xiaowei.php?chapter=19_11