void LinkedRecordAttributeCoder::decode(Tokend::TokenContext *tokenContext,
	const Tokend::MetaAttribute &metaAttribute,
	Tokend::Record &record)
{
    const Tokend::MetaAttribute *lma = NULL;
	LinkedRecordAdornment *lra = NULL;
    if (mCertificateMetaAttribute)
    {
        lma = mCertificateMetaAttribute;
        lra = record.getAdornment<LinkedRecordAdornment>(certificateKey());
    }

	if (!lra && mPublicKeyMetaAttribute)
    {
        lma = mPublicKeyMetaAttribute;
        lra = record.getAdornment<LinkedRecordAdornment>(publicKeyKey());
    }

    if (!lma || !lra)
		CssmError::throwMe(CSSMERR_DL_MISSING_VALUE);

    // Get the linked record's attribute and set it on record.
	const Attribute &attribute = lma->attribute(tokenContext, lra->record());
	record.attributeAtIndex(metaAttribute.attributeIndex(),
		new Attribute(attribute));
}
Пример #2
0
void BELPICKeySizeAttributeCoder::decode(Tokend::TokenContext *tokenContext,
                                      const Tokend::MetaAttribute &metaAttribute, Tokend::Record &record)
{
	uint32 keySize = dynamic_cast<BELPICKeyRecord &>(record).sizeInBits();
	record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute(keySize));
}