@static
@param $keyinfo
@param $payload

@return bool|array
777316
public static function decrypt($keyinfo, $payload)
	{
		if (isset($keyinfo->secret) && isset($keyinfo->hash) && function_exists('mcrypt_decrypt')) {
			ob_start();
			$decrypted = json_decode(trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $keyinfo->secret, base64_decode($payload), MCRYPT_MODE_NOFB, $keyinfo->hash)), true);
			ob_end_clean();
		} else {
			$decrypted = false;
		}
		return $decrypted;
	}
892086
protected function isRelativizable($payload): bool
    {
        $payload = $this->hostToAscii($payload);

        return $this->base_uri->getScheme() === $payload->getScheme()
            && $this->base_uri->getAuthority() === $payload->getAuthority()
            && !is_relative_path($payload);
    }
419309
public static function create(array $payload): AbstractEvent
    {
        foreach (array_keys($payload) as $key) {
            if (\array_key_exists($key, self::EVENTS)) {
                $className = self::EVENTS[$key];
                if (isset($payload['message']['is_echo'])) {
                    $className = MessageEchoEvent::class;
                }

                return $className::create($payload);
            }
        }

        return RawEvent::create($payload);
    }
308010
protected function processPayload(Array $payload)
	{
		// verify the payload
		if (isset($payload['security']) and isset($payload['data']) and isset($payload['flash']))
		{
			if (( ! $this->config['match_ip'] or $payload['security']['ip'] === $_SERVER['REMOTE_ADDR']) and
				( ! $this->config['match_ua'] or $payload['security']['ua'] === $_SERVER['HTTP_USER_AGENT']) and
				($payload['security']['ex'] == 0 or $payload['security']['ex'] >= time()) and
				$payload['security']['id'] == $this->sessionId)
			{
				// restore the session id
				$this->setSessionId($payload['security']['id']);

				// restore the last session id rotation timer
				$this->manager->setRotationTimer($payload['security']['rt']);

				// and store the data
				$this->data->setContents($payload['data']);
				$this->flash->setContents($payload['flash']);

				return true;
			}
		}

		return false;
	}
1110217
private function sign(array $payload): string
    {
        $jsonConverter = new StandardConverter();
        $payload = array_merge(
            $payload,
            $this->getAdditionalPayload()
        );
        $headers = $this->getSignatureHeader();
        $signatureKey = $this->signatureKeyset->get($this->signatureKeyIndex);
        if ($signatureKey->has('kid')) {
            $headers['kid'] = $signatureKey->get('kid');
        }

        $jws = $this->jwsBuilder
            ->create()
            ->withPayload($jsonConverter->encode($payload))
            ->addSignature($signatureKey, $headers)
            ->build();

        $serializer = new JWSCompactSerializer($jsonConverter);

        return $serializer->serialize($jws, 0);
    }
1356439
private static function getJsonPayload($payload)
    {
        $payload = json_decode(base64_decode($payload), true);
        if (! $payload || self::isInvalidPayload($payload)) {
            throw new Exceptions\DecryptionException('The payload is invalid.');
        }

        return $payload;
    }
161792
protected function verifyGroup(&$payload){
        
        // 消息格式如果错误不继续.
        if(!$this->verifyMessage($payload)){
            // 错误信息应有verifyMessage中生成.
            
            return false;
        }
            
        // 没有type,认为是push/tags的简单调用方式, 需要将type置为1
        $payload['type'] = array_key_exists('type', $payload) ? $payload['type'] : 1;
        
        if($payload['type']  === 1){
            // 必须要求有tag.
            if(!array_key_exists('tag', $payload)){
                $this->onError(null,3,'SDK params invalid, [tag] is required,  when the [type] not 2 ~ 6');
                return false;
            }
        }
        // type不等于1, 必须有selector
        else if(array_key_exists('selector', $payload)){             

            if(is_array($payload['selector'])){
                $payload['selector'] = json_encode($payload['selector']);
            }
            
        }
        // 其它情况,直接认为错误.
        else{
            $this->onError(null,3,'SDK params invalid, [selector] is required,  when the [type] between 2 and 6');
            return false;
        }
        
        return true;
    }
71788
private function makeSignedJwt($payload) {
    $header = array('typ' => 'JWT', 'alg' => 'RS256');

    $segments = array(
      Utils::urlSafeB64Encode(json_encode($header)),
      Utils::urlSafeB64Encode(json_encode($payload))
    );
    $signingInput = implode('.', $segments);

    $signer = new P12Signer($this->privateKey, $this->privateKeyPassword);
    $signature = $signer->sign($signingInput);
    $segments[] = Utils::urlSafeB64Encode($signature);

    return implode(".", $segments);
  }
386159
private function performPostRequest($payload)
	{
	    $payload[] = ['type' => $this->apiXType, 'routing' => $this->apiXRoute, 'token' => $this->apiXToken];
		$this->response = $this->client->request('POST', [
            'query' => $payload
        ]);
	}
540909
protected function addUserInformation(&$payload)
    {
        if ($this->container->bound(Guard::class)) {
            $payload['user_id'] = $this->userId();
        }

        return $this;
    }
203628
public static function encode($key = '', $payload = array())
    {
        $header = array('typ' => 'JWT', 'alg' => 'HS256');

        $parts = array(
            self::urlsafeBase64Encode(json_encode($header)),
            self::urlsafeBase64Encode(json_encode($payload)),
        );
        $signingData = implode('.', $parts);
        $signature = self::sign($key, $signingData);
        $parts[] = self::urlsafeBase64Encode($signature);

        return implode('.', $parts);
    }
226838
protected function validateStructure(array $payload)
    {
        if (count(array_diff($this->requiredClaims, array_keys($payload))) !== 0) {
            throw new TokenInvalidException('JWT payload does not contain the required claims');
        }

        return true;
    }
464252
public function store($payload)
    {
        $result = false;

        foreach ($payload['location'] as $file) {
            $filePayload = $payload;
            $filePayload['name'] = $file['original'];
            $filePayload['location'] = CryptoService::decrypt($file['name']);
            $filePayload['mime'] = $file['mime'];
            $filePayload['size'] = $file['size'];
            $filePayload['order'] = 0;
            $filePayload['user'] = (isset($payload['user'])) ? $payload['user'] : Auth::id();
            $filePayload['is_published'] = (isset($payload['is_published'])) ? (bool) $payload['is_published'] : 0;
            $result = $this->model->create($filePayload);
        }

        return $result;
    }
1100299
public static function validate($payload, $secret, $signature)
    {
        return hash_equals(self::compute($payload, $secret), $signature);
    }
986290
protected function withCreatePayloadHooks($queue, array $payload)
    {
        if (! empty(static::$createPayloadCallbacks)) {
            foreach (static::$createPayloadCallbacks as $callback) {
                $payload = array_merge($payload, call_user_func(
                    $callback, $this->getConnectionName(), $queue, $payload
                ));
            }
        }

        return $payload;
    }
1208961
private function queryPayload($payload, $path = null)
    {
        if(is_null($path)) return $payload;

        if(array_key_exists($path, $payload)) {
            return $payload[$path];
        }

        $dotData = Arr::dot($payload);
        if(array_key_exists($path, $dotData)) {
            return $dotData[$path];
        }

        return null;
    }
497758
public static function get($payload)
    {
        switch ($payload) {
            case 'OK':
            case 'QUEUED':
                if (isset(self::$$payload)) {
                    return self::$$payload;
                }

                return self::$$payload = new self($payload);

            default:
                return new self($payload);
        }
    }