[PATCH 05/15] commands: keys: update output format to include keyring
Jonas Rebmann
jre at pengutronix.de
Tue Oct 14 04:02:56 PDT 2025
Also show the algorithm used.
Signed-off-by: Jonas Rebmann <jre at pengutronix.de>
---
commands/keys.c | 8 ++------
include/crypto/public_key.h | 12 ++++++++++++
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/commands/keys.c b/commands/keys.c
index 2d85e8124f..e1e87f3e9e 100644
--- a/commands/keys.c
+++ b/commands/keys.c
@@ -7,12 +7,8 @@ static int do_keys(int argc, char *argv[])
const struct public_key *key;
for_each_public_key(key) {
- printf("KEY: %*phN", key->hashlen, key->hash);
-
- if (key->key_name_hint)
- printf(" (%s)\n", key->key_name_hint);
- else
- printf("\n");
+ printf("KEY: %*phN\tTYPE: %s\tKEYRING: %s\tHINT: %s\n", key->hashlen,
+ key->hash, public_key_type_string(key->type), key->keyring, key->key_name_hint);
}
return 0;
diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h
index 44ae09e4d0..269b878a04 100644
--- a/include/crypto/public_key.h
+++ b/include/crypto/public_key.h
@@ -12,6 +12,18 @@ enum public_key_type {
PUBLIC_KEY_TYPE_ECDSA,
};
+static inline const char *public_key_type_string(enum public_key_type type)
+{
+ switch (type) {
+ case PUBLIC_KEY_TYPE_RSA:
+ return "RSA";
+ case PUBLIC_KEY_TYPE_ECDSA:
+ return "ECDSA";
+ default:
+ return "unknown";
+ }
+}
+
struct public_key {
enum public_key_type type;
struct list_head list;
--
2.51.0.297.gca2559c1d6
More information about the barebox
mailing list