diff options
author | Simon Josefsson <simon@josefsson.org> | 2008-12-11 09:00:11 +0100 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2008-12-11 09:00:11 +0100 |
commit | 29dbbbbe0e7b4eff8e0c74200d8240ed0a6d6121 (patch) | |
tree | 835d62ecf47ab39d70f622efa14bef0b5257d47c /lib | |
parent | 4c74cd316f9201c11e7c61307f24bdbeeb06f770 (diff) | |
download | gnutls-29dbbbbe0e7b4eff8e0c74200d8240ed0a6d6121.tar.gz |
Print public key id for certificate requests too.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/x509/output.c | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/lib/x509/output.c b/lib/x509/output.c index a8e40c94be..e838166d82 100644 --- a/lib/x509/output.c +++ b/lib/x509/output.c @@ -1886,6 +1886,42 @@ print_crq (gnutls_string * str, gnutls_x509_crq_t cert) } } +static void +print_crq_other (gnutls_string * str, gnutls_x509_crq_t crq) +{ + int err; + size_t size = 0; + char *buffer = NULL; + + err = gnutls_x509_crq_get_key_id (crq, 0, buffer, &size); + if (err != GNUTLS_E_SHORT_MEMORY_BUFFER) + { + addf (str, "error: get_key_id: %s\n", gnutls_strerror (err)); + return; + } + + buffer = gnutls_malloc (size); + if (!buffer) + { + addf (str, "error: malloc: %s\n", gnutls_strerror (err)); + return; + } + + err = gnutls_x509_crq_get_key_id (crq, 0, buffer, &size); + if (err < 0) + { + gnutls_free (buffer); + addf (str, "error: get_key_id2: %s\n", gnutls_strerror (err)); + return; + } + + addf (str, _("\tPublic Key Id:\n\t\t")); + hexprint (str, buffer, size); + adds (str, "\n"); + + gnutls_free (buffer); +} + /** * gnutls_x509_crq_print - Pretty print PKCS 10 certificate request * @cert: The structure to be printed @@ -1911,12 +1947,15 @@ gnutls_x509_crq_print (gnutls_x509_crq_t crq, _gnutls_string_init (&str, gnutls_malloc, gnutls_realloc, gnutls_free); - _gnutls_string_append_str (&str, - _ - ("PKCS #10 Certificate Request Information:\n")); + _gnutls_string_append_str + (&str, _("PKCS #10 Certificate Request Information:\n")); print_crq (&str, crq); + _gnutls_string_append_str (&str, _("Other Information:\n")); + + print_crq_other (&str, crq); + _gnutls_string_append_data (&str, "\0", 1); out->data = str.data; out->size = strlen (str.data); |