public static String hmac_sha256(String sessionKey) throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException { if (!StringUtils.hasText(sessionKey)) { return null; } SecretKeySpec secretKeySpec = new SecretKeySpec(sessionKey.getBytes(), "HmacSHA256"); Mac mac = Mac.getInstance("HmacSHA256"); mac.init(secretKeySpec); byte[] hmac = mac.doFinal("".getBytes("utf-8")); return Base64.getEncoder().encodeToString(hmac); } [图片]
服务端internet.getUserEncryptKey中参数signature是如何生成的?https://developers.weixin.qq.com/minigame/dev/api-backend/open-api/internet/internet.getUserEncryptKey.html hmac_sha256的方法没有说明,这个要怎么生成?
04-30没有了,只是想找文档,没找到!感谢
扩展接口在api帮助里找不到了wx.arrayBufferToBase64(arrayBuffer)wx.base64ToArrayBuffer(base64)
2019-01-16