vici: Enable transport encoding of CERT_TRUSTED_PUBKEY objects
This commit is contained in:
@@ -861,21 +861,24 @@ static void enum_x509(private_vici_query_t *this, u_int id,
|
|||||||
* Enumerate all non-X.509 certificate types
|
* Enumerate all non-X.509 certificate types
|
||||||
*/
|
*/
|
||||||
static void enum_others(private_vici_query_t *this, u_int id,
|
static void enum_others(private_vici_query_t *this, u_int id,
|
||||||
linked_list_t *certs, cert_filter_t *filter)
|
linked_list_t *certs, certificate_type_t type)
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
certificate_t *cert;
|
certificate_t *cert;
|
||||||
vici_builder_t *b;
|
vici_builder_t *b;
|
||||||
chunk_t encoding;
|
chunk_t encoding;
|
||||||
|
cred_encoding_type_t encoding_type;
|
||||||
|
|
||||||
|
encoding_type = (type == CERT_TRUSTED_PUBKEY) ? PUBKEY_SPKI_ASN1_DER :
|
||||||
|
CERT_ASN1_DER;
|
||||||
|
|
||||||
enumerator = certs->create_enumerator(certs);
|
enumerator = certs->create_enumerator(certs);
|
||||||
while (enumerator->enumerate(enumerator, &cert))
|
while (enumerator->enumerate(enumerator, &cert))
|
||||||
{
|
{
|
||||||
if (cert->get_encoding(cert, CERT_ASN1_DER, &encoding))
|
if (cert->get_encoding(cert, encoding_type, &encoding))
|
||||||
{
|
{
|
||||||
b = vici_builder_create();
|
b = vici_builder_create();
|
||||||
b->add_kv(b, "type", "%N", certificate_type_names,
|
b->add_kv(b, "type", "%N", certificate_type_names, type);
|
||||||
cert->get_type(cert));
|
|
||||||
if (has_privkey(cert))
|
if (has_privkey(cert))
|
||||||
{
|
{
|
||||||
b->add_kv(b, "has_privkey", "yes");
|
b->add_kv(b, "has_privkey", "yes");
|
||||||
@@ -940,7 +943,7 @@ static void enum_certs(private_vici_query_t *this, u_int id,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
enum_others(this, id, certs, filter);
|
enum_others(this, id, certs, type);
|
||||||
}
|
}
|
||||||
certs->destroy_offset(certs, offsetof(certificate_t, destroy));
|
certs->destroy_offset(certs, offsetof(certificate_t, destroy));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user