1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-05-19 09:02:22 +02:00

* mainproc.c (proc_pubkey_enc, print_pkenc_list, list_node):

--keyid-format conversion.
This commit is contained in:
David Shaw 2004-03-18 02:56:41 +00:00
parent f0e0c301b2
commit ba3f9044d3
2 changed files with 51 additions and 49 deletions

View File

@ -1,3 +1,8 @@
2004-03-17 David Shaw <dshaw@jabberwocky.com>
* mainproc.c (proc_pubkey_enc, print_pkenc_list, list_node):
--keyid-format conversion.
2004-03-16 David Shaw <dshaw@jabberwocky.com> 2004-03-16 David Shaw <dshaw@jabberwocky.com>
* getkey.c (skip_unusable, merge_selfsigs_main, * getkey.c (skip_unusable, merge_selfsigs_main,

View File

@ -363,7 +363,7 @@ proc_pubkey_enc( CTX c, PACKET *pkt )
/* Hmmm: why do I have this algo check here - anyway there is /* Hmmm: why do I have this algo check here - anyway there is
* function to check it. */ * function to check it. */
if( opt.verbose ) if( opt.verbose )
log_info(_("public key is %08lX\n"), (ulong)enc->keyid[1] ); log_info(_("public key is %s\n"), keystr(enc->keyid) );
if( is_status_enabled() ) { if( is_status_enabled() ) {
char buf[50]; char buf[50];
@ -448,22 +448,23 @@ print_pkenc_list( struct kidlist_item *list, int failed )
if( !algstr ) if( !algstr )
algstr = "[?]"; algstr = "[?]";
pk->pubkey_algo = list->pubkey_algo; pk->pubkey_algo = list->pubkey_algo;
if( !get_pubkey( pk, list->kid ) ) { if( !get_pubkey( pk, list->kid ) )
{
size_t n; size_t n;
char *p; char *p;
log_info( _("encrypted with %u-bit %s key, ID %08lX, created %s\n"), log_info( _("encrypted with %u-bit %s key, ID %s, created %s\n"),
nbits_from_pk( pk ), algstr, (ulong)list->kid[1], nbits_from_pk( pk ), algstr, keystr_from_pk(pk),
strtimestamp(pk->timestamp) ); strtimestamp(pk->timestamp) );
fputs(" \"", log_stream() ); fputs(" \"", log_stream() );
p = get_user_id( list->kid, &n ); p = get_user_id( list->kid, &n );
print_utf8_string2 ( log_stream(), p, n, '"' ); print_utf8_string2 ( log_stream(), p, n, '"' );
m_free(p); m_free(p);
fputs("\"\n", log_stream() ); fputs("\"\n", log_stream() );
} }
else { else
log_info(_("encrypted with %s key, ID %08lX\n"), log_info(_("encrypted with %s key, ID %s\n"),
algstr, (ulong) list->kid[1] ); algstr,keystr(list->kid));
}
free_public_key( pk ); free_public_key( pk );
if( list->reason == G10ERR_NO_SECKEY ) { if( list->reason == G10ERR_NO_SECKEY ) {
@ -839,40 +840,38 @@ list_node( CTX c, KBNODE node )
|| node->pkt->pkttype == PKT_PUBLIC_SUBKEY ) { || node->pkt->pkttype == PKT_PUBLIC_SUBKEY ) {
PKT_public_key *pk = node->pkt->pkt.public_key; PKT_public_key *pk = node->pkt->pkt.public_key;
if( opt.with_colons ) { if( opt.with_colons )
{
u32 keyid[2]; u32 keyid[2];
keyid_from_pk( pk, keyid ); keyid_from_pk( pk, keyid );
if( mainkey ) if( mainkey )
c->trustletter = opt.fast_list_mode? c->trustletter = opt.fast_list_mode?
0 : get_validity_info( pk, NULL ); 0 : get_validity_info( pk, NULL );
printf("%s:", mainkey? "pub":"sub" ); printf("%s:", mainkey? "pub":"sub" );
if( c->trustletter ) if( c->trustletter )
putchar( c->trustletter ); putchar( c->trustletter );
printf(":%u:%d:%08lX%08lX:%s:%s::", printf(":%u:%d:%08lX%08lX:%s:%s::",
nbits_from_pk( pk ), nbits_from_pk( pk ),
pk->pubkey_algo, pk->pubkey_algo,
(ulong)keyid[0],(ulong)keyid[1], (ulong)keyid[0],(ulong)keyid[1],
colon_datestr_from_pk( pk ), colon_datestr_from_pk( pk ),
colon_strtime (pk->expiredate) ); colon_strtime (pk->expiredate) );
if( mainkey && !opt.fast_list_mode ) if( mainkey && !opt.fast_list_mode )
putchar( get_ownertrust_info (pk) ); putchar( get_ownertrust_info (pk) );
putchar(':'); putchar(':');
if( node->next && node->next->pkt->pkttype == PKT_RING_TRUST) { if( node->next && node->next->pkt->pkttype == PKT_RING_TRUST) {
putchar('\n'); any=1; putchar('\n'); any=1;
if( opt.fingerprint ) if( opt.fingerprint )
print_fingerprint( pk, NULL, 0 ); print_fingerprint( pk, NULL, 0 );
printf("rtv:1:%u:\n", printf("rtv:1:%u:\n",
node->next->pkt->pkt.ring_trust->trustval ); node->next->pkt->pkt.ring_trust->trustval );
} }
} }
else else
printf("%s %4u%c/%08lX %s%s", printf("%s %4u%c/%s %s%s",
mainkey? "pub":"sub", mainkey? "pub":"sub", nbits_from_pk( pk ),
nbits_from_pk( pk ), pubkey_letter( pk->pubkey_algo ), keystr_from_pk( pk ),
pubkey_letter( pk->pubkey_algo ), datestr_from_pk( pk ), mainkey?" ":"");
(ulong)keyid_from_pk( pk, NULL ),
datestr_from_pk( pk ),
mainkey?" ":"");
if( mainkey ) { if( mainkey ) {
/* and now list all userids with their signatures */ /* and now list all userids with their signatures */
@ -935,25 +934,23 @@ list_node( CTX c, KBNODE node )
|| node->pkt->pkttype == PKT_SECRET_SUBKEY ) { || node->pkt->pkttype == PKT_SECRET_SUBKEY ) {
PKT_secret_key *sk = node->pkt->pkt.secret_key; PKT_secret_key *sk = node->pkt->pkt.secret_key;
if( opt.with_colons ) { if( opt.with_colons )
{
u32 keyid[2]; u32 keyid[2];
keyid_from_sk( sk, keyid ); keyid_from_sk( sk, keyid );
printf("%s::%u:%d:%08lX%08lX:%s:%s:::", printf("%s::%u:%d:%08lX%08lX:%s:%s:::",
mainkey? "sec":"ssb", mainkey? "sec":"ssb",
nbits_from_sk( sk ), nbits_from_sk( sk ),
sk->pubkey_algo, sk->pubkey_algo,
(ulong)keyid[0],(ulong)keyid[1], (ulong)keyid[0],(ulong)keyid[1],
colon_datestr_from_sk( sk ), colon_datestr_from_sk( sk ),
colon_strtime (sk->expiredate) colon_strtime (sk->expiredate)
/* fixme: add LID */ ); /* fixme: add LID */ );
} }
else else
printf("%s %4u%c/%08lX %s ", printf("%s %4u%c/%s %s ", mainkey? "sec":"ssb",
mainkey? "sec":"ssb", nbits_from_sk( sk ), pubkey_letter( sk->pubkey_algo ),
nbits_from_sk( sk ), keystr_from_sk( sk ), datestr_from_sk( sk ));
pubkey_letter( sk->pubkey_algo ),
(ulong)keyid_from_sk( sk, NULL ),
datestr_from_sk( sk ) );
if( mainkey ) { if( mainkey ) {
/* and now list all userids with their signatures */ /* and now list all userids with their signatures */
for( node = node->next; node; node = node->next ) { for( node = node->next; node; node = node->next ) {
@ -1055,8 +1052,8 @@ list_node( CTX c, KBNODE node )
printf(":"); printf(":");
} }
else else
printf("%c %08lX %s ", printf("%c %s %s ",
sigrc, (ulong)sig->keyid[1], datestr_from_sig(sig)); sigrc, keystr(sig->keyid), datestr_from_sig(sig));
if( sigrc == '%' ) if( sigrc == '%' )
printf("[%s] ", g10_errstr(rc2) ); printf("[%s] ", g10_errstr(rc2) );
else if( sigrc == '?' ) else if( sigrc == '?' )