小程序授权 返回此提示 ·The given payload is invalid.
代码
public function decryptData(string $sessionKey, string $iv, string $encrypted): array
{
$decrypted = AES::decrypt(
base64_decode($encrypted, false), base64_decode($sessionKey, false), base64_decode($iv, false)
);
$decrypted = json_decode($this->pkcs7Unpad($decrypted), true);
if (!$decrypted) {
throw new DecryptException('The given payload is invalid.');
}
return $decrypted;
}
推荐文章: