mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
gpg: Allow creating keys using an existing ECC key.
* common/sexputil.c (get_pk_algo_from_canon_sexp): Remove arg R_ALGO. Change to return the algo id. Reimplement using get_pk_algo_from_key. * g10/keygen.c (check_keygrip): Adjust for change. * sm/certreqgen-ui.c (check_keygrip): Ditto. -- GnuPG-bug-id: 2976 Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
19f8d53191
commit
2bbdeb8ee8
4 changed files with 34 additions and 83 deletions
|
@ -95,7 +95,7 @@ check_keygrip (ctrl_t ctrl, const char *hexgrip)
|
|||
gpg_error_t err;
|
||||
ksba_sexp_t public;
|
||||
size_t publiclen;
|
||||
const char *algostr;
|
||||
int algo;
|
||||
|
||||
if (hexgrip[0] == '&')
|
||||
hexgrip++;
|
||||
|
@ -105,21 +105,17 @@ 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, &algostr);
|
||||
algo = get_pk_algo_from_canon_sexp (public, publiclen);
|
||||
xfree (public);
|
||||
|
||||
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;
|
||||
switch (algo)
|
||||
{
|
||||
case GCRY_PK_RSA: return "RSA";
|
||||
case GCRY_PK_DSA: return "DSA";
|
||||
case GCRY_PK_ELG: return "ELG";
|
||||
case GCRY_PK_EDDSA: return "ECDSA";
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue