Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

解密ShareInfo时AES的KeySize应为256 #2738

Closed
5 of 31 tasks
kchanlee opened this issue Nov 20, 2022 · 3 comments
Closed
5 of 31 tasks

解密ShareInfo时AES的KeySize应为256 #2738

kchanlee opened this issue Nov 20, 2022 · 3 comments

Comments

@kchanlee
Copy link

kchanlee commented Nov 20, 2022

此版块专为反馈 bug 及提交需求服务,不负责解答开发问题,请勿发表开发问题,
如果您需要这方面的帮助,请移步问答社区https://weixin.senparc.com/QA

问题描述

解密ShareInfo时AES的KeySize应为256

重现问题步骤(如果可以)
  1. 小程序端通过如下方法获得ShareInfo
      wx.showShareMenu({
        withShareTicket: true
      })
  
      const options = wx.getLaunchOptionsSync()
  
      if (options.shareTicket) {
        wx.getShareInfo({
          shareTicket: options.shareTicket
          success: (shareInfo) {
            ...
          }
        })
      }
  1. 将shareInfo发到后端,通过以下方式解密,得到乱码
EncryptHelper.DecodeEncryptedData(loginResult.session_key, shareInfo.encryptedData, shareInfo.iv);
解决办法

Senparc.Weixin.WxOpen.Helpers.EncryptHelper.AES_Decryptaes.KeySize设置为256可解决。

微信官方文档 URL
微信官方文档快照(直接复制关键内容到下方)
发现问题的模块
  • Senparc.Weixin 版本:
  • Senparc.Weixin.MP 版本:
  • Senparc.Weixin.MP.MVC 版本:
  • Senparc.Weixin.Open 版本:
    - [ ] Senparc.Weixin.QY 版本:
  • Senparc.Weixin.Work 版本:
  • Senparc.Weixin.WxOpen 版本:
  • Senparc.Weixin.Cache.Redis 版本:
  • Senparc.Weixin.Cache.Memcached 版本:
  • Senparc.Weixin.Tenpay 版本:
  • Senparc.WebSocket 版本:
  • 其他模块:
模块对应的 .net 版本
  • .net 3.5
  • .net 4.0
  • .net 4.5+
  • .net standard 2.0 / 2.1
  • .net core 1.x
  • .net core 2.x
  • .net core 3.x
  • .net 5.x / 6.x
开发环境
  • Visual Studio 2019
  • Visual Studio 2022
  • Visual Studio Code
  • 其他:
缓存环境
  • 服务器内存缓存(默认)
  • Redis 版本:
  • Memcached 版本:
  • 其他:
系统环境
  • Windows,版本:
  • Linux,版本:
  • Mac,版本:
  • 其他:
联系方式

Email:

(也可将问题地址及联系方式发送到 www.jeffrey.su@gmail.com)

发布问题后,请保持对 issue 的关注,有时会有需要进一步沟通的信息,很长时间内没有得到答复的 issue 将被关闭。

@JeffreySu
Copy link
Owner

这里原始的就是256,但是使用256也会有别的问题,使用128暂时没发现问题,是否方便提供一下解密的数据,我这边测试一下?zsu@senparc.com

@JeffreySu
Copy link
Owner

@kchanlee 先发布了一个 beta 版本,您可以试一下。提供了一个 keySize 的可选参数。

@JeffreySu
Copy link
Owner

@kchanlee 没有新的反馈就先关闭了,谢谢。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants