list subjectAltNames
This commit is contained in:
@@ -29,6 +29,8 @@
|
|||||||
#include <asn1/asn1_parser.h>
|
#include <asn1/asn1_parser.h>
|
||||||
#include <asn1/oid.h>
|
#include <asn1/oid.h>
|
||||||
#include <crypto/hashers/hasher.h>
|
#include <crypto/hashers/hasher.h>
|
||||||
|
#include <utils/enumerator.h>
|
||||||
|
#include <utils/identification.h>
|
||||||
|
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
@@ -1478,6 +1480,12 @@ void list_x509cert_chain(const char *caption, x509cert_t* cert,
|
|||||||
|
|
||||||
if (flags == X509_NONE || (flags & x509->get_flags(x509)))
|
if (flags == X509_NONE || (flags & x509->get_flags(x509)))
|
||||||
{
|
{
|
||||||
|
enumerator_t *enumerator;
|
||||||
|
char buf[BUF_LEN];
|
||||||
|
char *pos = buf;
|
||||||
|
int len = BUF_LEN;
|
||||||
|
bool first_altName = TRUE;
|
||||||
|
identification_t *id;
|
||||||
time_t notBefore, notAfter;
|
time_t notBefore, notAfter;
|
||||||
public_key_t *key;
|
public_key_t *key;
|
||||||
chunk_t serial, keyid, subjkey, authkey;
|
chunk_t serial, keyid, subjkey, authkey;
|
||||||
@@ -1493,6 +1501,30 @@ void list_x509cert_chain(const char *caption, x509cert_t* cert,
|
|||||||
first = FALSE;
|
first = FALSE;
|
||||||
}
|
}
|
||||||
whack_log(RC_COMMENT, " ");
|
whack_log(RC_COMMENT, " ");
|
||||||
|
|
||||||
|
enumerator = x509->create_subjectAltName_enumerator(x509);
|
||||||
|
while (enumerator->enumerate(enumerator, &id))
|
||||||
|
{
|
||||||
|
int written;
|
||||||
|
|
||||||
|
if (first_altName)
|
||||||
|
{
|
||||||
|
written = snprintf(pos, len, "%Y", id);
|
||||||
|
first_altName = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
written = snprintf(pos, len, ", %Y", id);
|
||||||
|
}
|
||||||
|
pos += written;
|
||||||
|
len -= written;
|
||||||
|
}
|
||||||
|
enumerator->destroy(enumerator);
|
||||||
|
if (!first_altName)
|
||||||
|
{
|
||||||
|
whack_log(RC_COMMENT, " altNames: %s", buf);
|
||||||
|
}
|
||||||
|
|
||||||
whack_log(RC_COMMENT, " subject: \"%Y\"",
|
whack_log(RC_COMMENT, " subject: \"%Y\"",
|
||||||
certificate->get_subject(certificate));
|
certificate->get_subject(certificate));
|
||||||
whack_log(RC_COMMENT, " issuer: \"%Y\"",
|
whack_log(RC_COMMENT, " issuer: \"%Y\"",
|
||||||
|
|||||||
Reference in New Issue
Block a user