Jose\Factory\JWEFactory::createJWEAndEncrypt PHP Метод

createJWEAndEncrypt() приватный статический Метод

private static createJWEAndEncrypt ( mixed $payload, Jose\Object\JWKInterface $recipient_key, array $shared_protected_headers = [], array $shared_headers = [], array $recipient_headers = [], string | null $aad = null ) : Jose\Object\JWEInterface
$payload mixed
$recipient_key Jose\Object\JWKInterface
$shared_protected_headers array
$shared_headers array
$recipient_headers array
$aad string | null
Результат Jose\Object\JWEInterface
    private static function createJWEAndEncrypt($payload, JWKInterface $recipient_key, array $shared_protected_headers = [], $shared_headers = [], $recipient_headers = [], $aad = null)
    {
        $complete_headers = array_merge($shared_protected_headers, $shared_headers, $recipient_headers);
        Assertion::keyExists($complete_headers, 'alg', 'No "alg" parameter set in the header');
        Assertion::keyExists($complete_headers, 'enc', 'No "enc" parameter set in the header');
        $encrypter = Encrypter::createEncrypter([$complete_headers['alg']], [$complete_headers['enc']], ['DEF', 'ZLIB', 'GZ']);
        $jwe = self::createJWE($payload, $shared_protected_headers, $shared_headers, $aad);
        $jwe = $jwe->addRecipientInformation($recipient_key, $recipient_headers);
        $encrypter->encrypt($jwe);
        return $jwe;
    }