requestVirtualPayment:fail SIGNATURE_INVALID !?
我参考微信官方提供的python文档,写了一份java的签名方法,但是一直提示签名错误,辛苦帮我看一下哪里写的有问题吗?以下是签名代码: public String signature(String postBody, String sessionKey) throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException {
String needSignMessage = postBody;
Mac sha256Hmac = Mac.getInstance("HmacSHA256");
SecretKeySpec secretKey = new SecretKeySpec(sessionKey.getBytes("UTF-8"), "HmacSHA256");
sha256Hmac.init(secretKey);
byte[] hashBytes = sha256Hmac.doFinal(needSignMessage.getBytes("UTF-8"));
return Hex.encodeHexString(hashBytes);
}
@微信官方