Add an enumerator for PKCS#7 contained certificates

This commit is contained in:
Martin Willi 2012-11-27 17:35:30 +01:00
parent 9afbe59953
commit 9e967d7dda
4 changed files with 17 additions and 0 deletions

View File

@ -48,6 +48,13 @@ struct pkcs7_t {
*/
bool (*get_attribute)(pkcs7_t *this, int oid, enumerator_t *enumerator,
chunk_t *value);
/**
* Create an enumerator over attached certificates.
*
* @return enumerator over certificate_t
*/
enumerator_t* (*create_cert_enumerator)(pkcs7_t *this);
};
#endif /** PKCS7_H_ @}*/

View File

@ -99,6 +99,7 @@ static private_pkcs7_data_t* create_empty()
.destroy = _destroy,
},
.get_attribute = (void*)return_false,
.create_cert_enumerator = (void*)enumerator_create_empty,
},
);

View File

@ -380,6 +380,7 @@ static private_pkcs7_enveloped_data_t* create_empty()
.get_encoding = _get_encoding,
.destroy = _destroy,
},
.create_cert_enumerator = (void*)enumerator_create_empty,
.get_attribute = (void*)return_false,
},
);

View File

@ -330,6 +330,13 @@ METHOD(pkcs7_t, get_attribute, bool,
return FALSE;
}
METHOD(pkcs7_t, create_cert_enumerator, enumerator_t*,
private_pkcs7_signed_data_t *this)
{
return this->creds->set.create_cert_enumerator(&this->creds->set,
CERT_ANY, KEY_ANY, NULL, FALSE);
}
METHOD(container_t, get_data, bool,
private_pkcs7_signed_data_t *this, chunk_t *data)
{
@ -375,6 +382,7 @@ static private_pkcs7_signed_data_t* create_empty()
.destroy = _destroy,
},
.get_attribute = _get_attribute,
.create_cert_enumerator = _create_cert_enumerator,
},
.creds = mem_cred_create(),
.signerinfos = linked_list_create(),