-/* $OpenBSD: filemode.c,v 1.24 2023/03/13 15:50:40 job Exp $ */
+/* $OpenBSD: filemode.c,v 1.25 2023/03/13 18:02:58 job Exp $ */
/*
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
}
static void
-print_certification_path(const char *crl, const char *aia, const struct auth *a)
+print_signature_path(const char *crl, const char *aia, const struct auth *a)
{
if (crl != NULL)
- printf("Certification path: %s\n", crl);
+ printf("Signature path: %s\n", crl);
if (aia != NULL)
printf(" %s\n", aia);
struct tal *tal = NULL;
char *aia = NULL, *aki = NULL;
char *crl_uri = NULL;
+ time_t *expires = NULL, *notafter = NULL;
struct auth *a;
struct crl *c;
const char *errstr = NULL;
aspa = aspa_parse(&x509, file, buf, len);
if (aspa == NULL)
break;
- aspa_print(x509, aspa);
aia = aspa->aia;
aki = aspa->aki;
+ expires = &aspa->expires;
+ notafter = &aspa->notafter;
break;
case RTYPE_CER:
cert = cert_parse_pre(file, buf, len);
roa = roa_parse(&x509, file, buf, len);
if (roa == NULL)
break;
- roa_print(x509, roa);
aia = roa->aia;
aki = roa->aki;
+ expires = &roa->expires;
+ notafter = &roa->notafter;
break;
case RTYPE_RSC:
rsc = rsc_parse(&x509, file, buf, len);
}
}
+ if (expires != NULL) {
+ if (status)
+ *expires = x509_find_expires(*notafter, a, &crlt);
+
+ switch (type) {
+ case RTYPE_ASPA:
+ aspa_print(x509, aspa);
+ break;
+ case RTYPE_ROA:
+ roa_print(x509, roa);
+ break;
+ default:
+ break;
+ }
+ }
+
if (outformats & FORMAT_JSON)
printf("\t\"validation\": \"");
else
else {
printf("\n");
- if (status && aia != NULL)
- print_certification_path(crl_uri, aia, a);
+ if (status && aia != NULL) {
+ print_signature_path(crl_uri, aia, a);
+ if (expires != NULL)
+ printf("Signature path expires: %s\n",
+ time2str(*expires));
+ }
if (x509 == NULL)
goto out;
-/* $OpenBSD: print.c,v 1.32 2023/03/13 09:24:37 job Exp $ */
+/* $OpenBSD: print.c,v 1.33 2023/03/13 18:02:58 job Exp $ */
/*
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
(long long)p->signtime);
printf("\t\"valid_since\": %lld,\n", (long long)p->notbefore);
printf("\t\"valid_until\": %lld,\n", (long long)p->notafter);
+ if (p->expires)
+ printf("\t\"expires\": %lld,\n", (long long)p->expires);
} else {
printf("Subject key identifier: %s\n", pretty_key_id(p->ski));
x509_print(x);
(long long)p->signtime);
printf("\t\"valid_since\": %lld,\n", (long long)p->notbefore);
printf("\t\"valid_until\": %lld,\n", (long long)p->notafter);
+ if (p->expires)
+ printf("\t\"expires\": %lld,\n", (long long)p->expires);
printf("\t\"customer_asid\": %u,\n", p->custasid);
printf("\t\"provider_set\": [\n");
for (i = 0; i < p->providersz; i++) {