aboutsummaryrefslogtreecommitdiffstats
path: root/sm/certreqgen-ui.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sm/certreqgen-ui.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/sm/certreqgen-ui.c b/sm/certreqgen-ui.c
index 1035404cd..368dc5567 100644
--- a/sm/certreqgen-ui.c
+++ b/sm/certreqgen-ui.c
@@ -95,7 +95,7 @@ check_keygrip (ctrl_t ctrl, const char *hexgrip)
gpg_error_t err;
ksba_sexp_t public;
size_t publiclen;
- int algo;
+ const char *algostr;
if (hexgrip[0] == '&')
hexgrip++;
@@ -105,17 +105,21 @@ check_keygrip (ctrl_t ctrl, const char *hexgrip)
return NULL;
publiclen = gcry_sexp_canon_len (public, 0, NULL, NULL);
- get_pk_algo_from_canon_sexp (public, publiclen, &algo);
+ get_pk_algo_from_canon_sexp (public, publiclen, &algostr);
xfree (public);
- switch (algo)
- {
- case GCRY_PK_RSA: return "RSA";
- case GCRY_PK_DSA: return "DSA";
- case GCRY_PK_ELG: return "ELG";
- case GCRY_PK_ECDSA: return "ECDSA";
- default: return NULL;
- }
+ if (!algostr)
+ return NULL;
+ else if (!strcmp (algostr, "rsa"))
+ return "RSA";
+ else if (!strcmp (algostr, "dsa"))
+ return "DSA";
+ else if (!strcmp (algostr, "elg"))
+ return "ELG";
+ else if (!strcmp (algostr, "ecdsa"))
+ return "ECDSA";
+ else
+ return NULL;
}