返回报文:
get getCertificates :{"data":[{"effective_time":"2021-08-03T16:17:31+08:00","encrypt_certificate":{"associated_data":"certificate","ciphertext":"6hIsWg8AAWL+sr7Ot2NKNtGoL2GWFUUCSLbyk5hslGkWnbMTkHyy50vL9KIu7dWTZ8M16Gz7ZrGt/U2Y3U9laSbubIEp9X98yaecaFWkZNpPoJhzUs68Fes7IyIR4ETwBER8qsNgv2FxAerbx1AGv39MB+mxZFeDNeRx73mis4/Eai7ZNMOGpVcPHfxvfY963HnM1I0ISsIfqwCBORBEMOt1zFdf7nH8/sxuMhYZVH05UrPsqr1tfh/haHlIgF5gAuSym9Ub//EExViUnI1lPaEvmRIPz26M5gBn40OnI9XRI24lkMe/eiNWi6dzBM6C/Kfiu2hL5CfBwka6U1mh3vk5k29+k6uA9fDZ1pyHV83uhT/uM747t38h7Wudtp3pQicOQYiR2Syks7bJi8YWrkYRo4v8lGoSF1vfrObZAFEHWslfLmfrlUBICeIPpvdfgjeeKIa+FzKvFNiAWOy/ccHc4AOfr5+Z7//LpG/QRXkym1Z6eWngLoDTZjXAqJ0lpSiWwhLLM9pUecdrq/J6ZwN3Z5RgwnQkJGsgpuhlslA9kOqzXqCcLxbW/VKR3mn0zT68d5uHITf4v9aBU5freP3ufZFtQ+e8pW3fg3+NsLsrn6PO2QqY3Qpb8FotvP7taX4Xz3lJJZyFk+UAo+xfFDcNeLszHRKo6dRQWqS37Hp8es6d6pxBqufmQrR685jWUUGtoHkGjZ7zBLI2s39xrSP2qSSGH4cQnjMl+NlPBQ7Sj+fqZ0lxUqZ+pysRES3SIINTZpWan45HpHHnimUbIvQaSFvgP0s6YvXNrEQzluVgNVpSGMBXtk+R0zFKbD8697jwS+tYkXtrclyhSwDPUnxRq56L+LdpQd2n09N8nojoquf1JtfJUwpedmsCbulg7iRQ/ymBhmE6Y7Joh7C7PXYERlhuX4brHsX/amMM3bO5tD2vNVgtoMLjflGA8ghv2OLGVWAV1n3ZAJp/O/SpUgpFLKo7tdY2TyM587ortOub2H+ZaBBHnS9AWx34spR654qxkfYzEGKjr7g5keaO7rWGAj5ptIwjTR5eE9N8/EDmC2bxrOpo/nhAt0D/ThbgkH6kO3XNQjd2xb5A7lHDD3Oor1WaIYEboOcmpVG37MJAewHCytF0A5viddBnQ9DPzq0HuItTzKl7VOdQcZsztx4qSM+bM08uwi+90An4QMsLq6EcsVs9MOFHQ0TNnXtrnWyWG0CYEw2rajQFytE34mrbU2keWkLIsqRqSsbnVXryMfDoi2EXJ2FnX13W3cLyo6BFZAiMMC5uK3KQI5cW2qfgPqscRRjRpreVqPAKRfAn8GA4ZFDu7aDD+cf7y79eBvyFK6FZWSWCJB5R83+5xasCtj9Kn+9yF9t9G4HGaTNFg0A6J/4Pg8yUI5zPnpZngoltiLgFGt2IaUvJBhnD8h7s5orUm8yELFn3tRXca2oOLFKzXpGHcVDkVAuB19mBV6YYgfvkI6A+GC0qw8l+vQ8A2kfu+1FQ0GIwn/ShVNTo6FI5zBLtO/sZ4AohZaOhqJ8JLEbxWk5yuejGXCb0tbpG+4/u2W/Q4mCnISRw+Uq0W8OWV60605lvsWc0ap6joQqoxt6f5+54WeJwc5xmAp1YTQMwajM4SkMsTXKB5KiztCcMpXN3CGAN0mo/BkpElxTslFe3sz3o0hBhrAxEREuLIkuwLd3g/SH0zsTQal4deHgAXxw8PiWwVP1EPC0SLhvB+N5ag7pfSfiwti0DBxga+BYyPWb/42FIn2Dx2JzBRihPmNsZDxh07+vm8Sq9nPhSYSZW0aywClNt89GRHZwLr00riPk/vlmTqgwYHR2LtIobwmVODUA2CmjqYNW6xOTvusq5e6bAQKGMcW813FSr67T5/A==","nonce":"1b2d
https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay7_2.shtml
1)商户号: 161187795
2)商户名称:陕西车佰度
3)问题描述:GET 获取平台证书列表,需要对请求到的json密文进行解密,解密时报
解密时报javax.crypto.AEADBadTagException: Tag mismatch!
使用的是官网示例的AESUtil工具https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_2.shtml
根据官网https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/faq/chapter1_3.shtml给出的问题定位
1、使用了错误的API v3密钥,如使用了其他商户号的密钥,或者使用了APIv2的APIKey。
2、密文不正确。请检查提交解密的密文和收到的密文。注意报文中的密文经过了Base64编码。
3、解密时接口遗漏传入附加数据(associated_data)。
进行排查后都没有问题,但还是报javax.crypto.AEADBadTagException: Tag mismatch!异常
4)错误提示:
javax.crypto.AEADBadTagException: Tag mismatch!
at com.sun.crypto.provider.GaloisCounterMode.decryptFinal(GaloisCounterMode.java:578)
at com.sun.crypto.provider.CipherCore.finalNoPadding(CipherCore.java:1032)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:969)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:833)
at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:446)
at javax.crypto.Cipher.doFinal(Cipher.java:2165)
at BackManage.core.common.utils.AesUtil.decryptToString(AesUtil.java:38)
at BackManage.core.common.weixin.testTag.main(testTag.java:91)
5)相关截图