public function decryptContent($data, $cek, $iv, $aad, $encoded_protected_header, $tag)
{
$calculated_aad = $encoded_protected_header;
if (null !== $aad) {
$calculated_aad .= '.' . $aad;
}
if (version_compare(PHP_VERSION, '7.1.0') >= 0) {
return openssl_decrypt($data, $this->getMode($cek), $cek, OPENSSL_RAW_DATA, $iv, $tag, $calculated_aad);
} elseif (class_exists('\\Crypto\\Cipher')) {
$cipher = Cipher::aes(Cipher::MODE_GCM, $this->getKeySize());
$cipher->setTag($tag);
$cipher->setAAD($calculated_aad);
$plaintext = $cipher->decrypt($data, $cek, $iv);
return $plaintext;
}
return GCM::decrypt($cek, $iv, $data, $calculated_aad, $tag);
}