-/* $OpenBSD: extern.h,v 1.223 2024/06/08 13:29:54 tb Exp $ */
+/* $OpenBSD: extern.h,v 1.224 2024/06/08 13:30:35 tb Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
/* printers */
char *nid2str(int);
+const char *purpose2str(enum cert_purpose);
char *time2str(time_t);
void x509_print(const X509 *);
void tal_print(const struct tal *);
-/* $OpenBSD: print.c,v 1.54 2024/06/06 05:57:36 tb Exp $ */
+/* $OpenBSD: print.c,v 1.55 2024/06/08 13:30:35 tb Exp $ */
/*
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
return buf;
}
+const char *
+purpose2str(enum cert_purpose purpose)
+{
+ switch (purpose) {
+ case CERT_PURPOSE_INVALID:
+ return "invalid cert";
+ case CERT_PURPOSE_TA:
+ return "TA cert";
+ case CERT_PURPOSE_CA:
+ return "CA cert";
+ case CERT_PURPOSE_EE:
+ return "EE cert";
+ case CERT_PURPOSE_BGPSEC_ROUTER:
+ return "BGPsec Router cert";
+ default:
+ return "unknown certificate purpose";
+ }
+}
+
char *
time2str(time_t t)
{