不要转base64 public static String decryptData(String base64Data,String key) throws Exception { System.out.println(key); SecretKeySpec keySpec = new SecretKeySpec(key.getBytes("utf-8"), "AES"); Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, keySpec); return new String(cipher.doFinal(Base64Util.decodeByte(base64Data)),"utf-8"); } public static void main(String[] args) { String reqInfo="xxxxxx"; // String reqInfoB=Base64Util.encode(reqInfo); // System.out.println(Base64Util.decode(reqInfoB)); try { String jiemi=WxApiV3AesUtil.decryptData(reqInfo,MD5Util.getMd5("key").toLowerCase()); System.out.println(jiemi); } catch (Exception e) { e.printStackTrace(); } }
微信支付退款通知中的加密串req_info如何解密?1)官方的文档和demo没有提供了方法? 2)搞这么复杂干什么,多此一举 3)网上搜的那些方法基本不能用。 我用的是java,在mac 电脑上调试。
2023-08-12