From e629fa7c61a5f6cdcf2e295e33bfa15221ffb8ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Sat, 3 Feb 2007 08:46:49 +0000 Subject: [PATCH] add printing of SubjectKeyIdentifier and AuthorityKeyIdentifier git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@20153 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/hx509/print.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/lib/hx509/print.c b/lib/hx509/print.c index 10755c204..096be6fcb 100644 --- a/lib/hx509/print.c +++ b/lib/hx509/print.c @@ -238,6 +238,16 @@ check_subjectKeyIdentifier(hx509_validate_ctx ctx, if (si.length > 20) validate_print(ctx, HX509_VALIDATE_F_VALIDATE, "SKI is too long"); + + { + char *id; + hex_encode(si.data, si.length, &id); + if (id) { + printf("\tsubject key id: %s\n", id); + free(id); + } + } + free_SubjectKeyIdentifier(&si); return 0; @@ -249,8 +259,39 @@ check_authorityKeyIdentifier(hx509_validate_ctx ctx, enum critical_flag cf, const Extension *e) { + AuthorityKeyIdentifier ai; + size_t size; + int ret; + status->haveAKI = 1; check_Null(ctx, status, cf, e); + + status->haveSKI = 1; + check_Null(ctx, status, cf, e); + + ret = decode_AuthorityKeyIdentifier(e->extnValue.data, + e->extnValue.length, + &ai, &size); + if (ret) { + validate_print(ctx, HX509_VALIDATE_F_VALIDATE, + "Decoding AuthorityKeyIdentifier failed: %d", ret); + return 1; + } + if (size != e->extnValue.length) { + validate_print(ctx, HX509_VALIDATE_F_VALIDATE, + "Decoding SKI ahve extra bits on the end"); + return 1; + } + + if (ai.keyIdentifier) { + char *id; + hex_encode(ai.keyIdentifier->data, ai.keyIdentifier->length, &id); + if (id) { + printf("\tauthority key id: %s\n", id); + free(id); + } + } + return 0; }