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;
}