-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Encryptor基类hack导致小程序的sessionKey base64_decode失败 #614
Comments
补充:去掉附加的=号后,代码执行没问题。即:
改为
|
|
@overtrue 此问题的本质应该是,MiniProgram使用了Encrypter基类进行了解密,然后https://github.com/overtrue/wechat/blob/a2edf275e665402ae0225123aba9a9ea407eb0c8/src/MiniProgram/Encryption/Encryptor.php#L85 getAESKey的时候自动将它补等号了导致key decode失败,所以要修改应该也是在MiniProgram/Encryption/Encryptor.php,我可以提交一个pr |
@tinpont 我知道啊,但是他们应该是使用的同一个加密解密方案,所以这里需要谨慎测试 |
@mingyoung 另外有个跟此问题无关的规范问题我想提一下,就是
这段代码理应遵循parent class的规范,decrypt方法只是作为解密用途,理应只做解密处理,decryptData才是将数据格式化处理的地方,返回格式化后的数据。 PS: decryptData方法的返回类型写错了,昨晚我做的时候IDE一直提示我类型不匹配。 |
@tinpont 好的,我看看❤️ |
@mingyoung Thanks for your contributions!! |
我用的环境
PHP 版本:PHP 7.1
overtrue/wechat 版本:3.2.5
问题及现象
https://github.com/overtrue/wechat/blob/a2edf275e665402ae0225123aba9a9ea407eb0c8/src/Encryption/Encryptor.php#L229
此行代码在后面将AESKey添加了一个=号,导致小程序的sessionKey base64_decode失败,解密不出数据。这里为什么要补一个=号?为什么不在源头上解决这个问题?
The text was updated successfully, but these errors were encountered: