/** * {@inheritdoc} */ public function encrypt($payload, array $encryption_protected_headers, Object\JWKInterface $encryption_key) { Assertion::true($this->isEncryptionSupportEnabled(), 'The encryption support is not enabled'); $jwe = Factory\JWEFactory::createJWE($payload, $encryption_protected_headers); $jwe = $jwe->addRecipientInformation($encryption_key); $this->encrypter->encrypt($jwe); return $jwe->toCompactJSON(0); }