mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-10 13:04:23 +01:00
* keygen.c (print_status_key_created): New.
(do_generate_keypair): Use it to print the fingerprint. (generate_subkeypair): Likewise.
This commit is contained in:
parent
833fbf4a29
commit
da36b610ef
@ -1,3 +1,9 @@
|
||||
2002-10-12 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* keygen.c (print_status_key_created): New.
|
||||
(do_generate_keypair): Use it to print the fingerprint.
|
||||
(generate_subkeypair): Likewise.
|
||||
|
||||
2002-10-11 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* keyedit.c (menu_addrevoker): Properly back out if the signature
|
||||
|
32
g10/keygen.c
32
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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user