aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--g10/ChangeLog6
-rw-r--r--g10/keygen.c32
2 files changed, 36 insertions, 2 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index 6dd3c7df9..803e15c7e 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,9 @@
+2002-10-12 Werner Koch <[email protected]>
+
+ * keygen.c (print_status_key_created): New.
+ (do_generate_keypair): Use it to print the fingerprint.
+ (generate_subkeypair): Likewise.
+
2002-10-11 David Shaw <[email protected]>
* keyedit.c (menu_addrevoker): Properly back out if the signature
diff --git a/g10/keygen.c b/g10/keygen.c
index b45618e90..87a371702 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -2064,6 +2064,24 @@ generate_keypair( const char *fname )
release_parameter_list( para );
}
+static void
+print_status_key_created (int letter, PKT_public_key *pk)
+{
+ byte array[MAX_FINGERPRINT_LEN], *s;
+ char buf[MAX_FINGERPRINT_LEN*2+30], *p;
+ size_t i, n;
+
+ p = buf;
+ *p++ = letter;
+ *p++ = ' ';
+ fingerprint_from_pk (pk, array, &n);
+ s = array;
+ for (i=0; i < n ; i++, s++, p += 2)
+ sprintf (p, "%02X", *s);
+ *p = 0;
+ write_status_text (STATUS_KEY_CREATED, buf);
+}
+
static void
do_generate_keypair( struct para_data_s *para,
@@ -2276,7 +2294,9 @@ do_generate_keypair( struct para_data_s *para,
tty_printf(_("Key generation failed: %s\n"), g10_errstr(rc) );
}
else {
- write_status_text (STATUS_KEY_CREATED, did_sub? "B":"P");
+ PKT_public_key *pk = find_kbnode (pub_root,
+ PKT_PUBLIC_KEY)->pkt->pkt.public_key;
+ print_status_key_created (did_sub? 'B':'P', pk);
}
release_kbnode( pub_root );
release_kbnode( sec_root );
@@ -2375,8 +2395,16 @@ generate_subkeypair( KBNODE pub_keyblock, KBNODE sec_keyblock )
if( !rc )
rc = write_keybinding(sec_keyblock, pub_keyblock, sk, use);
if( !rc ) {
+ PKT_public_key *subpk = NULL;
+
+ for (node=pub_keyblock; node; node = node->next ) {
+ if (node->pkt->pkttype == PKT_PUBLIC_SUBKEY)
+ subpk = node->pkt->pkt.public_key;
+ }
+ if (!subpk)
+ BUG();
+ print_status_key_created ('S', subpk);
okay = 1;
- write_status_text (STATUS_KEY_CREATED, "S");
}
leave: