diff options
author | Werner Koch <wk@gnupg.org> | 2006-11-14 11:23:21 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2006-11-14 11:23:21 +0100 |
commit | 650293c4f6fa9d1b1d6b56956b848e9880ac8c38 (patch) | |
tree | 5b134cad1a33a3bdf44c4e2c1c70510ff8f4d0a6 /sm/certdump.c | |
parent | Post release update (diff) | |
download | gnupg2-650293c4f6fa9d1b1d6b56956b848e9880ac8c38.tar.xz gnupg2-650293c4f6fa9d1b1d6b56956b848e9880ac8c38.zip |
sm/
* server.c (skip_options): Skip leading spaces.
(has_option): Honor "--".
(cmd_export): Add option --data to do an inline export. Skip all
options.
* certdump.c (gpgsm_fpr_and_name_for_status): New.
* verify.c (gpgsm_verify): Use it to print correct status messages.
doc/
* gpgsm.texi (GPGSM EXPORT): Document changes.
Diffstat (limited to 'sm/certdump.c')
-rw-r--r-- | sm/certdump.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/sm/certdump.c b/sm/certdump.c index 2f7c1fd54..032a00ad2 100644 --- a/sm/certdump.c +++ b/sm/certdump.c @@ -705,6 +705,59 @@ gpgsm_format_name (const char *name) } +/* Return fingerprint and a percent escaped name in a human readable + format suitable for status messages like GOODSIG. May return NULL + on error (out of core). */ +char * +gpgsm_fpr_and_name_for_status (ksba_cert_t cert) +{ + char *fpr, *name, *p; + char *buffer; + + fpr = gpgsm_get_fingerprint_hexstring (cert, GCRY_MD_SHA1); + if (!fpr) + return NULL; + + name = ksba_cert_get_subject (cert, 0); + if (!name) + { + xfree (fpr); + return NULL; + } + + p = gpgsm_format_name2 (name, 0); + ksba_free (name); + name = p; + if (!name) + { + xfree (fpr); + return NULL; + } + + buffer = xtrymalloc (strlen (fpr) + 1 + 3*strlen (name) + 1); + if (buffer) + { + const unsigned char *s; + + p = stpcpy (stpcpy (buffer, fpr), " "); + for (s = name; *s; s++) + { + if (*s < ' ') + { + sprintf (p, "%%%02X", *s); + p += 3; + } + else + *p++ = *s; + } + *p = 0; + } + xfree (fpr); + xfree (name); + return buffer; +} + + /* Create a key description for the CERT, this may be passed to the pinentry. The caller must free the returned string. NULL may be returned on error. */ @@ -800,3 +853,4 @@ gpgsm_format_keydesc (ksba_cert_t cert) return buffer; } + |