diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-11-22 16:35:58 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-11-22 16:46:56 +0100 |
commit | 482545959002b56eb4f4d9915b58bd2e00e96dd0 (patch) | |
tree | 71799a255be66c19bade5bc090fa1d68862bb98a /src | |
parent | 8c4a4a74c84f937c6eaf0a8aab27f7417487a6f0 (diff) | |
download | gnutls-482545959002b56eb4f4d9915b58bd2e00e96dd0.tar.gz |
Print a key's or certificate's key ID with SHA256 in addition to SHA1
Diffstat (limited to 'src')
-rw-r--r-- | src/certtool-common.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/certtool-common.c b/src/certtool-common.c index 3c02c05a0e..04af0e9429 100644 --- a/src/certtool-common.c +++ b/src/certtool-common.c @@ -1,5 +1,6 @@ /* - * Copyright (C) 2003-2012 Free Software Foundation, Inc. + * Copyright (C) 2003-2016 Free Software Foundation, Inc. + * Copyright (C) 2015-2016 Red Hat, Inc. * * This file is part of GnuTLS. * @@ -1183,16 +1184,25 @@ static void privkey_info_int(FILE *outfile, common_info_st * cinfo, } size = lbuffer_size; - if ((ret = - gnutls_x509_privkey_get_key_id(key, GNUTLS_KEYID_USE_SHA1, lbuffer, &size)) < 0) { + ret = + gnutls_x509_privkey_get_key_id(key, GNUTLS_KEYID_USE_SHA256, lbuffer, &size); + if (ret < 0) { fprintf(stderr, "Error in key id calculation: %s\n", gnutls_strerror(ret)); } else { gnutls_datum_t art; - fprintf(outfile, "Public Key ID: %s\n", + fprintf(outfile, "Public Key ID:\n\tsha256:%s\n", raw_to_string(lbuffer, size)); + size = lbuffer_size; + ret = + gnutls_x509_privkey_get_key_id(key, GNUTLS_KEYID_USE_SHA1, lbuffer, &size); + if (ret >= 0) { + fprintf(outfile, "\tsha1:%s\n", + raw_to_string(lbuffer, size)); + } + ret = gnutls_random_art(GNUTLS_RANDOM_ART_OPENSSH, cprint, bits, lbuffer, size, &art); |