最近在开发项目,黑坑风云榜微信小程序时,需要使用到小程序的开放接口,获取用户手机号码。
原来后台系统里面有 easywechat 3.2 的扩展,调用相关解密函数,结果报错:IV passed is 24 bytes long which is longer than the 16 expected by se。

什么意思呢?
意思是说:给的 sessionKey 是24位的,但解密只需要16位。
如是就多写一行,截取前16位。

$aesKey= substr($aesKey,0,16);

调试了一下,还是不行。

然后去微信小程序官网下载解密的demo. 加上这行,一运行,OK,解密成功。

{"phoneNumber":"17681849100","purePhoneNumber":"17681849100","countryCode":"86","watermark":{"timestamp":1580825334,"appid":"wx2f0dd38d9ca7a188"}}

 

demo下载查看地址:https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html

注: php版本5.6

相关文章:

  • 2022-01-17
  • 2021-09-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-14
  • 2021-09-24
  • 2021-07-10
猜你喜欢
  • 2021-09-24
  • 2021-11-07
  • 2021-09-01
  • 2021-06-17
  • 2022-12-23
  • 2022-02-05
  • 2021-11-25
相关资源
相似解决方案