Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
anoxia committed Feb 2, 2019
1 parent 5b87c6e commit 3399b9d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Wx/Mini.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,12 @@ public function __construct($appId, $appSecret, $ed, $iv)
*/
public function get($code)
{
$decodeKey = base64_decode($response['session_key']);
$decodeIv = base64_decode(urldecode($this->iv));
$decodeIv = base64_decode($this->iv);
$decodeEd = base64_decode($this->ed);

// 检查iv
if (strlen($decodeIv) != 16) {
$decodeIv = base64_decode($this->iv);
$decodeIv = base64_decode(urldecode($this->iv));

if (strlen($decodeIv) != 16) {
throw new Exception('iv长度错误: [iv]' . $this->iv);
Expand All @@ -77,6 +76,7 @@ public function get($code)
if (strlen($sessionKey) != 20) {
throw new Exception('sesskon_key错误: ' . $sessionKey, 401900);
}
$decodeKey = base64_decode($response['session_key']);

// 获取加密结果
$result = openssl_decrypt($decodeEd, 'AES-128-CBC', $decodeKey, 1, $decodeIv);
Expand Down

0 comments on commit 3399b9d

Please sign in to comment.