* Implements container_t.
*/
container_t container;
+
+ /**
+ * Get an authenticated PKCS#9 attribute from PKCS#7 signerInfo.
+ *
+ * To select the signerInfo structure to get the attribute from, pass
+ * the enumerator position from container_t.create_signature_enumerator().
+ *
+ * @param oid OID from the attribute to get
+ * @param enumerator enumerator to select signerInfo
+ * @param value chunk receiving attribute value, internal data
+ * @return TRUE if attribute found
+ */
+ bool (*get_attribute)(pkcs7_t *this, int oid, enumerator_t *enumerator,
+ chunk_t *value);
};
#endif /** PKCS7_H_ @}*/
enumerator_t *inner;
/** currently enumerated auth_cfg */
auth_cfg_t *auth;
+ /** currently enumerating signerinfo */
+ signerinfo_t *info;
/** reference to container */
private_pkcs7_signed_data_t *this;
} signature_enumerator_t;
continue;
}
*out = this->auth;
+ this->info = info;
return TRUE;
}
+ this->info = NULL;
return FALSE;
}
return &enumerator->public;
}
+METHOD(pkcs7_t, get_attribute, bool,
+ private_pkcs7_signed_data_t *this, int oid, enumerator_t *enumerator, chunk_t *value)
+{
+ signature_enumerator_t *e;
+ chunk_t chunk;
+
+ e = (signature_enumerator_t*)enumerator;
+ if (e->info)
+ {
+ chunk = e->info->attributes->get_attribute(e->info->attributes, oid);
+ if (chunk.len)
+ {
+ *value = chunk;
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
METHOD(container_t, get_data, bool,
private_pkcs7_signed_data_t *this, chunk_t *data)
{
.get_encoding = _get_encoding,
.destroy = _destroy,
},
+ .get_attribute = _get_attribute,
},
.creds = mem_cred_create(),
.signerinfos = linked_list_create(),