使用官网的示例方法对获取到的微信平台证书报文进行解密,在decryptToString方法中,使用new String(cipher.doFinal(Base64.getDecoder().decode(ciphertext)), "utf-8");
报错java.lang.IllegalArgumentException: Illegal base64 character 22,说有非法字符
我获取的报文是这么解析的
//创建json解析器
JsonParser parse = new JsonParser();
JsonObject json = (JsonObject) parse.parse(pcs);
//json字符串解析,获取result节点
JsonObject encryptCertificate = json.get("encrypt_certificate").getAsJsonObject();
//获取节点的数值
String associatedData = encryptCertificate.get("associated_data").toString();
String ciphertext = encryptCertificate.get("ciphertext").toString();
String wxnonce = encryptCertificate.get("nonce").toString();
请问为什么解析不了呢