g10: Let card-edit/key-attr show message when change.
authorNIIBE Yutaka <gniibe@fsij.org>
Thu, 5 Apr 2018 01:37:23 +0000 (10:37 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Thu, 5 Apr 2018 01:37:23 +0000 (10:37 +0900)
* g10/card-util.c (ask_card_rsa_keysize): Don't show message here.
(ask_card_keyattr): Show message when change, also for ECC.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
g10/card-util.c

index e33a417..896ead0 100644 (file)
@@ -1389,12 +1389,7 @@ ask_card_rsa_keysize (unsigned int nbits)
                       "RSA", min_nbits, max_nbits);
         }
       else
-        {
-          tty_printf (_("The card will now be re-configured"
-                        " to generate a key of %u bits\n"), req_nbits);
-          show_keysize_warning ();
-          return req_nbits;
-        }
+        return req_nbits;
     }
 }
 
@@ -1501,8 +1496,19 @@ ask_card_keyattr (int keyno, const struct key_attr *current)
     }
 
  leave:
-  if (!key_attr)
-    tty_printf (_("No change."));
+  if (key_attr)
+    {
+      if (key_attr->algo == PUBKEY_ALGO_RSA)
+        tty_printf (_("The card will now be re-configured"
+                      " to generate a key of %u bits\n"), key_attr->nbits);
+      else if (key_attr->algo == PUBKEY_ALGO_ECDH
+               || key_attr->algo == PUBKEY_ALGO_ECDSA
+               || key_attr->algo == PUBKEY_ALGO_EDDSA)
+        tty_printf (_("The card will now be re-configured"
+                      " to generate a key of type: %s\n"), key_attr->curve),
+
+      show_keysize_warning ();
+    }
 
   return key_attr;
 }