]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
x509: when printing the keyid of a certificate use the curve name for randomart
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Wed, 15 Apr 2015 08:48:21 +0000 (11:48 +0300)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Wed, 15 Apr 2015 08:48:21 +0000 (11:48 +0300)
lib/x509/output.c

index 297b855849d824731a0078d7a4a119b55a432459..5cef68c77b8ec405e232e6dcbdaaa3a05c3cddf2 100644 (file)
@@ -1458,7 +1458,18 @@ static void print_keyid(gnutls_buffer_st * str, gnutls_x509_crt_t cert)
        if (err < 0)
                return;
 
-       name = gnutls_pk_get_name(err);
+       if (err == GNUTLS_PK_EC) {
+               gnutls_ecc_curve_t curve;
+
+               err = gnutls_x509_crt_get_pk_ecc_raw(cert, &curve, NULL, NULL);
+               if (err < 0)
+                       return;
+
+               name = gnutls_ecc_curve_get_name(curve);
+               bits = 0;
+       } else {
+               name = gnutls_pk_get_name(err);
+       }
        if (name == NULL)
                return;