diff options
Diffstat (limited to 'sm/keylist.c')
-rw-r--r-- | sm/keylist.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/sm/keylist.c b/sm/keylist.c index 2d51aa74d..19e7a76c8 100644 --- a/sm/keylist.c +++ b/sm/keylist.c @@ -247,7 +247,7 @@ print_key_data (ksba_cert_t cert, estream_t fp) } static void -print_capabilities (ksba_cert_t cert, estream_t fp) +print_capabilities (ksba_cert_t cert, int algo, estream_t fp) { gpg_error_t err; unsigned int use; @@ -299,7 +299,7 @@ print_capabilities (ksba_cert_t cert, estream_t fp) /* We need to returned the faked key usage to frontends so that they * can select the right key. Note that we don't do this for the * human readable keyUsage. */ - if ((opt.compat_flags & COMPAT_ALLOW_KA_TO_ENCR) + if ((algo == GCRY_PK_ECC || (opt.compat_flags & COMPAT_ALLOW_KA_TO_ENCR)) && (use & KSBA_KEYUSAGE_KEY_AGREEMENT)) is_encr = 1; @@ -408,6 +408,7 @@ list_cert_colon (ctrl_t ctrl, ksba_cert_t cert, unsigned int validity, gpg_error_t valerr; int algo; unsigned int nbits; + char *curve = NULL; const char *chain_id; char *chain_id_buffer = NULL; int is_root = 0; @@ -499,7 +500,7 @@ list_cert_colon (ctrl_t ctrl, ksba_cert_t cert, unsigned int validity, if (*truststring) es_fputs (truststring, fp); - algo = gpgsm_get_key_algo_info (cert, &nbits); + algo = gpgsm_get_key_algo_info2 (cert, &nbits, &curve); es_fprintf (fp, ":%u:%d:%s:", nbits, algo, fpr+24); ksba_cert_get_validity (cert, 0, t); @@ -538,7 +539,7 @@ list_cert_colon (ctrl_t ctrl, ksba_cert_t cert, unsigned int validity, /* Field 11, signature class - not used */ es_putc (':', fp); /* Field 12, capabilities: */ - print_capabilities (cert, fp); + print_capabilities (cert, algo, fp); es_putc (':', fp); /* Field 13, not used: */ es_putc (':', fp); @@ -563,6 +564,8 @@ list_cert_colon (ctrl_t ctrl, ksba_cert_t cert, unsigned int validity, } es_putc (':', fp); /* End of field 15. */ es_putc (':', fp); /* End of field 16. */ + if (curve) + es_fputs (curve, fp); es_putc (':', fp); /* End of field 17. */ print_compliance_flags (cert, algo, nbits, fp); es_putc (':', fp); /* End of field 18. */ @@ -626,6 +629,7 @@ list_cert_colon (ctrl_t ctrl, ksba_cert_t cert, unsigned int validity, xfree (p); } xfree (kludge_uid); + xfree (curve); } @@ -829,12 +833,11 @@ list_cert_raw (ctrl_t ctrl, KEYDB_HANDLE hd, es_fprintf (fp, " hashAlgo: %s%s%s%s\n", oid, s?" (":"",s?s:"",s?")":""); { - const char *algoname; - unsigned int nbits; + char *algostr; - algoname = gcry_pk_algo_name (gpgsm_get_key_algo_info (cert, &nbits)); - es_fprintf (fp, " keyType: %u bit %s\n", - nbits, algoname? algoname:"?"); + algostr = gpgsm_pubkey_algo_string (cert, NULL); + es_fprintf (fp, " keyType: %s\n", algostr? algostr : "[error]"); + xfree (algostr); } /* subjectKeyIdentifier */ @@ -1192,15 +1195,13 @@ list_cert_std (ctrl_t ctrl, ksba_cert_t cert, estream_t fp, int have_secret, { - const char *algoname; - unsigned int nbits; + char *algostr; - algoname = gcry_pk_algo_name (gpgsm_get_key_algo_info (cert, &nbits)); - es_fprintf (fp, " key type: %u bit %s\n", - nbits, algoname? algoname:"?"); + algostr = gpgsm_pubkey_algo_string (cert, NULL); + es_fprintf (fp, " key type: %s\n", algostr? algostr : "[error]"); + xfree (algostr); } - err = ksba_cert_get_key_usage (cert, &kusage); if (gpg_err_code (err) != GPG_ERR_NO_DATA) { |