alipay icon indicating copy to clipboard operation
alipay copied to clipboard

为什么验签是false呢?

Open cielswift opened this issue 4 years ago • 6 comments

AlipayTradeQueryResponse response = alipayClient.execute(request);

    HashMap hashMap = Faster.parseJson(response.getBody(), HashMap.class);
    JSONObject bo = (JSONObject)hashMap.get("alipay_trade_query_response");

    Map<String, String> map = new HashMap<>();
    map.put("sign",hashMap.get("sign").toString());
    bo.entrySet().forEach(t -> {
        map.put(t.getKey(),t.getValue().toString());
    });
    boolean v1 = AlipaySignature.rsaCheckV1(map, PARAM.get("PUBLIC"), PARAM.get("CHARSET"), PARAM.get("SIGN"));
    System.out.println("验签:"+v1);

查询和预订单都是false, 但是回调是true

Map<String, String> map = request.getParameterMap() .entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, t -> t.getValue()[0]));

    boolean v1 = AlipaySignature.rsaCheckV1(map, PARAM.get("PUBLIC"), PARAM.get("CHARSET"), PARAM.get("SIGN"));

    System.out.println("验签:"+v1);

cielswift avatar Jul 18 '20 11:07 cielswift

??

smartwalle avatar Jul 20 '20 00:07 smartwalle

遇到同样的问题,预订单、查询和回调都验签失败,使用的是v3版本

coder8088 avatar Sep 25 '20 02:09 coder8088

遇到同样的问题,预订单、查询和回调都验签失败,使用的是v3版本

可以试试项目里面的测试用例

smartwalle avatar Sep 25 '20 07:09 smartwalle

可能是支付宝生成的公私钥的问题,在支付宝生成的时候下面有个非java版本的选项,换成那个版本的再试一下

GENG824 avatar May 19 '21 11:05 GENG824

可能是支付宝生成的公私钥的问题,在支付宝生成的时候下面有个非java版本的选项,换成那个版本的再试一下

我就是非Java的 同样验签失败。

liasica avatar Jul 11 '21 11:07 liasica

你解决这个问题了吗,我同样遇到了

maxyang107 avatar Aug 08 '22 10:08 maxyang107