final String associatedData = "certificate";
final String nonce = "8f6add69ed9b";
final String cipherText = "d40SFeRcAZpDMDQnejCMmhxZrJFZfLdOSK6H4V+benxSEhHVEd9aEl8l966rUgezR6j3c24c+m3X8sWnQ4fghIQ2zmJHQAW61rs4JNkdaJLkYFebhvdk8e1BcumF8InZIZ7vslCScmtKdUqH90JvFHAKg5Rz6hW+m6QSYL0zirL4+monseqbYOGQ1oMC/x53WGff0X18vYvPRa5BQykfod9kMGmwQbfRIOloEuqu8hcxaCk8CQNxrSOF6rdDwQ8I0OTGERbEd7o4WIhAZHGBZR+6liYcxj1V1wW0YIh1Vp+6wh3ldmjSV/Y/aneQgDffTaDCYz0J9tDmJ0nYp8LVp8J9kUc1sSFkUKm4iJKAxrZFikdJGYjHpZqg1A8NAtDobwYTsK1bR5nyMm2SI+wDbFz5D+D7pHWkhccg17h/aVdEcjGWyTevZPPCF8wvsFmtN8k38oKzq+6IkIfp8hVrnelHKtZkH/nZPcGs/1gEQvdhHsuNPsBMAa7Vlbown7qgSpGQQgCerXu8Kc/SVtIIndAngrsQR8xEhBylRtfHMHeoNrlX0f/bFlYIyH9Hykmnpf8fQlQUjBZIhDWTlSDOycbAUaU8Pu5ZnY/7mSH+cE6ubAc/DCNrLquVWi/kc2SMpEH1VmUvmZiLJyVWTgIuv97stgbCw7ctudL+2j7w+18uDU7hJcTrZhs8vJJ/fYQghALRiBbrjIeJR6ANwMPuHjxwIpgk2AYIPy39c98MMiDSHrlT5l9W0asU54kpEhg/95f+6+PL7YHGQb/sWilOCPadZ08NNAYigVX7QqpUNlUutB/TUhPvz244YowFMIdvuI1RLXaXUOJhQw2xeg91iQSZUVUeW27apGxxykPSZswaQhkv2aXtS+QOluj89mhSiV6723cW+EMRc7eoaaFNgStRqVXZ53Y9MlaRCyEf2XxV2Fr+O5SsEgmvVOvvvEwwOfNoXsLVT1pEkanOBbWAme0K88cfJGWsW6dQ7jU8taZbmqXVktWlV+Dh+bRQmnxhbWDM0tmgPsjzEUqW4hfE/YirAGnW/Kxigz3djVM6w1BgEgOOlD9oOsJY49XavtUnDyakPvN2SXgUlJ2t/BLhtAhAiJ6u4W1vLOK30XWyIbo+xV0fgpc4uaCR+4Clv0JbroTGD/It6kXKcWLCbcGSMo9BlZtgOn+PFrq3sFBJs86Wyp3Xcj/XbiNSq6PASOtoyLSFlMI9FMQXbjUTGm6riu8QXCcTsfYXSKPq2a7bunCmJAAxUymb7isaaB78JgMQIr9NswyPZvVG4heX2umk9/PeCDKBs3w2wgTzHXPWos0OQzx/LYWjurkrsLPZX6QUEdhY5ydEh6MBI+jhM4kpxgKeuC0Ls5+VczUSicYEVtd5fmaujcFWARUCjW+4tLWUHOZ+1wUIIJIr8xOdesbXD1scesPJNL/mZ3jruItubvywH6AVaVBUrSRWgXTBMDsiy7tu2OZNnMTg40vnnXHwzx0FcD76KqaXT7ck1f8exMgqrA9vzwHoxh3wrVmZnVpESsIzDXit5LI5x8BNxTmLXfIQIPH643JrkbNvfNaDFp5/SRlIyQon6KRWC9OrlQUdBt5E6NsoI/dgvdWksBf0x8kJ3h2FXERaAm7h/r2vyBoDG8qPiIl6c2QHLwHAvqdQofnLIVzJ0LGpGCuyTEM82ieU0AsVQSTEhFof4eEYnGtNn6oQlMQGK/08P45nn5GiKU2hRA0s+8QEEZDeIdx+AiGQHHOpKSCTeIGEUl2AiQd7Jft90uuv77Rg04SocJPk4DsfpfCh47xiVM4iXbDcFCji6xPd7uE++lLiIBhcoqJVCXif7+lVfW4CB430FRwBIQ9BjgJMWKN3tQEQnQNceu/cqSnIsQ==";
try {
String wechatpayCert = aesgcmDecrypt(associatedData, nonce, cipherText);
System.out.println(wechatpayCert);
} catch (Exception e) {
e.printStackTrace();
}
会报错javax.crypto.AEADBadTagException: Tag mismatch!
java1.8
不出意外是你的api v3 key和微信支付后台设置的不一致,最简单的验证办法就是重置一下你的api v3 key。