QPDF::getKeyForObject(
    PointerHolder<EncryptionParameters> encp,
    int objid, int generation, bool use_aes)
{
    if (! encp->encrypted)
    {
	throw std::logic_error(
	    "request for encryption key in non-encrypted PDF");
    }

    if (! ((objid == encp->cached_key_objid) &&
	   (generation == encp->cached_key_generation)))
    {
	encp->cached_object_encryption_key =
	    compute_data_key(encp->encryption_key, objid, generation,
                             use_aes, encp->encryption_V,
                             encp->encryption_R);
	encp->cached_key_objid = objid;
	encp->cached_key_generation = generation;
    }

    return encp->cached_object_encryption_key;
}
QPDF::getKeyForObject(
    PointerHolder<EncryptionParameters> encp,
    int objid, int generation, bool use_aes)
{
    if (! encp->encrypted)
    {
	throw std::logic_error(
	    "request for encryption key in non-encrypted PDF");
    }

    if (! ((objid == encp->cached_key_objid) &&
	   (generation == encp->cached_key_generation)))
    {
	encp->cached_object_encryption_key =
	    compute_data_key(encp->encryption_key, objid, generation,
                             use_aes, encp->encryption_V,
                             encp->encryption_R);
	encp->cached_key_objid = objid;
	encp->cached_key_generation = generation;
    }

    return encp->cached_object_encryption_key;
}