From 6839256773ec5501f297eaf86466c3641da5d3a0 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Thu, 8 Oct 2020 09:32:57 +0200 Subject: [PATCH] vici: Support all defined key types References #3586. --- src/libcharon/plugins/vici/README.md | 2 +- src/libcharon/plugins/vici/vici_cred.c | 18 +----------------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/libcharon/plugins/vici/README.md b/src/libcharon/plugins/vici/README.md index f2c120821..cf2e7482e 100644 --- a/src/libcharon/plugins/vici/README.md +++ b/src/libcharon/plugins/vici/README.md @@ -483,7 +483,7 @@ Load a certificate into the daemon. Load a private key into the daemon. { - type = + type = data = } => { success = diff --git a/src/libcharon/plugins/vici/vici_cred.c b/src/libcharon/plugins/vici/vici_cred.c index 17f3ff0cd..6310fdcb8 100644 --- a/src/libcharon/plugins/vici/vici_cred.c +++ b/src/libcharon/plugins/vici/vici_cred.c @@ -226,23 +226,7 @@ CALLBACK(load_key, vici_message_t*, { return create_reply("key type missing"); } - if (strcaseeq(str, "any")) - { - type = KEY_ANY; - } - else if (strcaseeq(str, "rsa")) - { - type = KEY_RSA; - } - else if (strcaseeq(str, "ecdsa")) - { - type = KEY_ECDSA; - } - else if (strcaseeq(str, "bliss")) - { - type = KEY_BLISS; - } - else + if (!enum_from_name(key_type_names, str, &type)) { return create_reply("invalid key type: %s", str); }