add printing of SubjectKeyIdentifier and AuthorityKeyIdentifier

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@20153 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2007-02-03 08:46:49 +00:00
parent 0b410c51d9
commit e629fa7c61

View File

@@ -238,6 +238,16 @@ check_subjectKeyIdentifier(hx509_validate_ctx ctx,
if (si.length > 20) if (si.length > 20)
validate_print(ctx, HX509_VALIDATE_F_VALIDATE, validate_print(ctx, HX509_VALIDATE_F_VALIDATE,
"SKI is too long"); "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); free_SubjectKeyIdentifier(&si);
return 0; return 0;
@@ -249,8 +259,39 @@ check_authorityKeyIdentifier(hx509_validate_ctx ctx,
enum critical_flag cf, enum critical_flag cf,
const Extension *e) const Extension *e)
{ {
AuthorityKeyIdentifier ai;
size_t size;
int ret;
status->haveAKI = 1; status->haveAKI = 1;
check_Null(ctx, status, cf, e); 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; return 0;
} }