[PATCH v2 06/17] commands: keys: update output format to include keyring
Jonas Rebmann
jre at pengutronix.de
Tue Oct 28 11:03:11 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 616d44c25a..83c3ed533d 100644
--- a/commands/keys.c
+++ b/commands/keys.c
@@ -8,12 +8,8 @@ static int do_keys(int argc, char *argv[])
int id;
for_each_public_key(key, id) {
- 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 4954fab089..0fd8e1e304 100644
--- a/include/crypto/public_key.h
+++ b/include/crypto/public_key.h
@@ -13,6 +13,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;
const char *key_name_hint;
--
2.51.2.535.g419c72cb8a
More information about the barebox
mailing list