Add an enumerator for PKCS#7 contained certificates
This commit is contained in:
@@ -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_ @}*/
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user