private function encryptJWE(Object\JWEInterface &$jwe, Algorithm\ContentEncryptionAlgorithmInterface $content_encryption_algorithm, $cek, $iv, Compression\CompressionInterface $compression_method = null)
{
if (!empty($jwe->getSharedProtectedHeaders())) {
$jwe = $jwe->withEncodedSharedProtectedHeaders(Base64Url::encode(json_encode($jwe->getSharedProtectedHeaders())));
}
$tag = null;
$payload = $this->preparePayload($jwe->getPayload(), $compression_method);
$aad = null === $jwe->getAAD() ? null : Base64Url::encode($jwe->getAAD());
$ciphertext = $content_encryption_algorithm->encryptContent($payload, $cek, $iv, $aad, $jwe->getEncodedSharedProtectedHeaders(), $tag);
$jwe = $jwe->withCiphertext($ciphertext);
$jwe = $jwe->withIV($iv);
if (null !== $tag) {
$jwe = $jwe->withTag($tag);
}
}