收藏
回答

用户数据的解密问题

RT,完全按照官方提供的示例写的代码,反复确认appId, sessionKey, encryptedData, iv是正确的,但是就是报


WXBizDataCrypt.js:25
    throw new Error('Illegal Buffer')
    ^
 
Error: Illegal Buffer

这个错误。



wxUserInfo的信息获取到如下:

{
    "wxUserInfo": {
        "errMsg": "getUserInfo:ok",
        "rawData": "{\"nickName\":\"Eason 6\",\"gender\":1,\"language\":\"zh_CN\",\"city\":\"Chaoyang\",\"province\":\"Beijing\",\"country\":\"CN\",\"avatarUrl\":\"http://wx.qlogo.cn/mmopen/vi_32/TnmicUjMibdUqIhwkjtyFC6bcnWc4CeaBsUjlQa7OylMzyNSSiajPe54rmvyCUU64wkc7wdIQd7zjcYOTFkLHloFg/0\"}",
        "userInfo": {
            "nickName": "Eason 6",
            "gender": 1,
            "language": "zh_CN",
            "city": "Chaoyang",
            "province": "Beijing",
            "country": "CN",
            "avatarUrl": "http://wx.qlogo.cn/mmopen/vi_32/TnmicUjMibdUqIhwkjtyFC6bcnWc4CeaBsUjlQa7OylMzyNSSiajPe54rmvyCUU64wkc7wdIQd7zjcYOTFkLHloFg/0"
        },
        "signature": "7cf8445c359af01e800119f5b262014c63c5b420",
        "encryptData": "8z8b9xBMZBdTr5ddfrBCTpqSy9gxKZLfE0YyAEXcN7xzz3O+F3bEkYo2A9a2h+nUWKviwbatugTh3Ubr90mjtL27r/Kqi7lpStibatmxO3GQlh6mhSQ+AV53ZpoENAhPxsDZntqNbhJiCLW4S4JFsJ258buQJW0+uRBWbqH8H8Hen5cV+I4VbuPDIGBFkPtRwOsAN5gVuYquoOqgOeS3SsYXTDhxa96r4+UEV5szDBBPEXrRLT+k+7iNRXDh2vvKDcEfrWSMJNNzzACcdMnEuoE1PXsbPd3jnE62OjX328+pi+hcXfcO/3G3po2REISEtQUu2eleLRnj6QlVxlNFleXYddJJ3rF4OYkbDBjGT4rnh9cdTeVK1oMMmORkBrCmf/fre5+CieUhUQedw/GKwfMFCUHT5oRrJ9tsy6oP/oFTITM1Dcb08fyRRhQWrczTJk/Ak4ffoWJOkSloq6TeomqMuUp7FbEaNaThZYZZcyahKyHzhk7FaQjsc5ziPnZLfGXhyYfYh/5yMs0Mbu5uqw==",
        "encryptedData": "vLzC6MrKzrNx5XE2E3sUnf/XqrrUX9c8VZkZQ/9EXN0MbSxzsOa3AJZzzJSqeGLs5k1rVY97uD8v5GrpnOEMqRXqwqrhVWTKiM07qdjFB7iTL1ygENp/QLND+CvX54i5tJZb8Pv7INBEICYlWZSytm/diZ2QzhxH6IOwUT2c70YLfyKmvqDoqk6NCMLbGV5UHVhb9NPSD+ES8NorZ/csd+FNQXgramuvPyo87Xek7oTjeFJWtihn/yMOzqCIX22qWH5nzY4yuDaUzfTZF949LQZQ+NrDSTheY+sBb/GDZBRMKRF2CiBCK87oLM4RgMwQlMh3SESKxdCa29AqqPOEKoOTKgA+8cA3FGeE16kGuEE3DCZud8gINC8Y73hsQSBLrADvosamLgV+KzhVNUi2H9tLY/K2j/dO8837d/ku+hoknYAvqJsjyWM0p7ZtybqNsAzKbA1rEHI+gvsu0jb1Q8GGIZK5T6/EjA/QgHuPMIU5Y9/Ssas4JfyXEuERL6iV/PARf5Dkr8QeT1LZpU40Tw==",
        "iv": "quoCR+p9cUkJfFOIfUfIBw=="
    }
}


回答关注问题邀请回答
收藏

2 个回答

  • 2018-05-04

    楼主好,请问这个问题解决了吗?

    2018-05-04
    有用
    回复
  • 亚里士朱德
    亚里士朱德
    2017-07-03

    返回的字符串有问题,无法正确解析成json对象

    2017-07-03
    有用
    回复
登录 后发表内容