aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2003-11-01 01:13:16 +0000
committerDavid Shaw <[email protected]>2003-11-01 01:13:16 +0000
commit5c37fd90bf81b401b6ce5a79bed4fe1cd0d8796d (patch)
tree93ab76510a0035290246290db88149f9b021a997
parent* configure.ac: Locate libbz2 for bzip2 compression support. (diff)
downloadgnupg-5c37fd90bf81b401b6ce5a79bed4fe1cd0d8796d.tar.gz
gnupg-5c37fd90bf81b401b6ce5a79bed4fe1cd0d8796d.zip
* trustdb.h, trustdb.c (register_trusted_keyid): New. Adds a keyid to the
list of ultimately trusted keys. * keygen.c (do_generate_keypair): Use it here so that the ultimate ownertrust happens before the trustdb (might be) rebuilt. Also fix an error where the newly generated pk is thought to be a subkey by the trustdb. * g10.c (main): Fix --export-all do actually do something different than --export. * pkclist.c (build_pk_list): Show all recipients rather than showing each recipient as they are added. * mainproc.c (proc_symkey_enc, proc_encrypted): Keep a count of the number of passphrases that can decrypt a symmetric or mixed symmetric/pk message and include it in the list of keys shown to the user.
-rw-r--r--g10/ChangeLog21
-rw-r--r--g10/g10.c10
-rw-r--r--g10/keygen.c12
-rw-r--r--g10/mainproc.c13
-rw-r--r--g10/pkclist.c53
-rw-r--r--g10/trustdb.c26
-rw-r--r--g10/trustdb.h1
7 files changed, 93 insertions, 43 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index b7ffc151f..4c9f29f6e 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,24 @@
+2003-10-31 David Shaw <[email protected]>
+
+ * trustdb.h, trustdb.c (register_trusted_keyid): New. Adds a
+ keyid to the list of ultimately trusted keys.
+
+ * keygen.c (do_generate_keypair): Use it here so that the ultimate
+ ownertrust happens before the trustdb (might be) rebuilt. Also
+ fix an error where the newly generated pk is thought to be a
+ subkey by the trustdb.
+
+ * g10.c (main): Fix --export-all do actually do something
+ different than --export.
+
+ * pkclist.c (build_pk_list): Show all recipients rather than
+ showing each recipient as they are added.
+
+ * mainproc.c (proc_symkey_enc, proc_encrypted): Keep a count of
+ the number of passphrases that can decrypt a symmetric or mixed
+ symmetric/pk message and include it in the list of keys shown to
+ the user.
+
2003-10-30 David Shaw <[email protected]>
* misc.c (compress_algo_to_string, string_to_compress_algo,
diff --git a/g10/g10.c b/g10/g10.c
index 28ebc8ddb..d0ef9e5af 100644
--- a/g10/g10.c
+++ b/g10/g10.c
@@ -1,5 +1,6 @@
/* g10.c - The GnuPG utility (main for gpg)
- * Copyright (C) 1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002,
+ * 2003 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -1399,7 +1400,10 @@ main( int argc, char **argv )
case aSearchKeys: set_cmd( &cmd, aSearchKeys); break;
case aRefreshKeys: set_cmd( &cmd, aRefreshKeys); break;
case aExport: set_cmd( &cmd, aExport); break;
- case aExportAll: set_cmd( &cmd, aExportAll); break;
+ case aExportAll:
+ opt.export_options|=EXPORT_INCLUDE_NON_RFC;
+ set_cmd(&cmd,aExport);
+ break;
case aListKeys: set_cmd( &cmd, aListKeys); break;
case aListSigs: set_cmd( &cmd, aListSigs); break;
case aExportSecret: set_cmd( &cmd, aExportSecret); break;
@@ -2708,7 +2712,6 @@ main( int argc, char **argv )
break;
case aExport:
- case aExportAll:
case aSendKeys:
case aRecvKeys:
sl = NULL;
@@ -2736,7 +2739,6 @@ main( int argc, char **argv )
sl = NULL;
for( ; argc; argc--, argv++ )
append_to_strlist2( &sl, *argv, utf8_strings );
-
rc=keyserver_search( sl );
if(rc)
log_error(_("keyserver search failed: %s\n"),g10_errstr(rc));
diff --git a/g10/keygen.c b/g10/keygen.c
index b57206f88..51354af4c 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -2489,14 +2489,16 @@ do_generate_keypair( struct para_data_s *para,
&& !(get_parameter_uint( para,pKEYUSAGE) & PUBKEY_USAGE_ENC);
PKT_public_key *pk = find_kbnode (pub_root,
PKT_PUBLIC_KEY)->pkt->pkt.public_key;
-
- update_ownertrust (pk,
- ((get_ownertrust (pk) & ~TRUST_MASK)
- | TRUST_ULTIMATE ));
+
+ keyid_from_pk(pk,pk->main_keyid);
+ register_trusted_keyid(pk->main_keyid);
+
+ update_ownertrust (pk,
+ ((get_ownertrust (pk) & ~TRUST_MASK)
+ | TRUST_ULTIMATE ));
if (!opt.batch) {
tty_printf(_("public and secret key created and signed.\n") );
- tty_printf(_("key marked as ultimately trusted.\n") );
tty_printf("\n");
list_keyblock(pub_root,0,1,NULL);
}
diff --git a/g10/mainproc.c b/g10/mainproc.c
index aefaad6c3..6fb459608 100644
--- a/g10/mainproc.c
+++ b/g10/mainproc.c
@@ -50,7 +50,6 @@ struct kidlist_item {
};
-
/****************
* Structure to hold the context
*/
@@ -72,6 +71,7 @@ struct mainproc_context {
IOBUF iobuf; /* used to get the filename etc. */
int trustletter; /* temp usage in list_node */
ulong local_id; /* ditto */
+ ulong symkeys;
struct kidlist_item *pkenc_list; /* list of encryption packets */
struct {
int op;
@@ -327,7 +327,9 @@ proc_symkey_enc( CTX c, PACKET *pkt )
c->dek->algo_info_printed = 1;
}
}
+
leave:
+ c->symkeys++;
free_packet(pkt);
}
@@ -477,10 +479,15 @@ proc_encrypted( CTX c, PACKET *pkt )
{
int result = 0;
- if (!opt.quiet) {
+ if (!opt.quiet)
+ {
+ if(c->symkeys>1)
+ log_info(_("encrypted with %lu passphrases\n"),c->symkeys);
+ else if(c->symkeys==1)
+ log_info(_("encrypted with 1 passphrase\n"));
print_pkenc_list ( c->pkenc_list, 1 );
print_pkenc_list ( c->pkenc_list, 0 );
- }
+ }
write_status( STATUS_BEGIN_DECRYPTION );
diff --git a/g10/pkclist.c b/g10/pkclist.c
index b11cda529..5f28f5fcd 100644
--- a/g10/pkclist.c
+++ b/g10/pkclist.c
@@ -895,12 +895,41 @@ build_pk_list( STRLIST rcpts, PK_LIST *ret_pk_list, unsigned use )
else if(backlog) {
answer=pop_strlist(&backlog);
}
- else {
+ else
+ {
+ PK_LIST iter;
+
+ tty_printf("\n");
+ tty_printf(_("Current recipients:\n"));
+ for(iter=pk_list;iter;iter=iter->next)
+ {
+ u32 keyid[2];
+
+ keyid_from_pk(iter->pk,keyid);
+ tty_printf("%4u%c/%08lX %s \"",
+ nbits_from_pk(iter->pk),
+ pubkey_letter(iter->pk->pubkey_algo),
+ (ulong)keyid[1],
+ datestr_from_pk(iter->pk));
+
+ if(iter->pk->user_id)
+ tty_print_utf8_string(iter->pk->user_id->name,
+ iter->pk->user_id->len);
+ else
+ {
+ size_t n;
+ char *p = get_user_id( keyid, &n );
+ tty_print_utf8_string( p, n );
+ m_free(p);
+ }
+ tty_printf("\"\n");
+ }
+
answer = cpr_get_utf8("pklist.user_id.enter",
_("\nEnter the user ID. End with an empty line: "));
trim_spaces(answer);
cpr_kill_prompt();
- }
+ }
if( !answer || !*answer ) {
m_free(answer);
break;
@@ -947,26 +976,6 @@ build_pk_list( STRLIST rcpts, PK_LIST *ret_pk_list, unsigned use )
}
else {
PK_LIST r;
- u32 keyid[2];
-
- keyid_from_pk( pk, keyid);
- tty_printf("Added %4u%c/%08lX %s \"",
- nbits_from_pk( pk ),
- pubkey_letter( pk->pubkey_algo ),
- (ulong)keyid[1],
- datestr_from_pk( pk ) );
- if(pk->user_id)
- tty_print_utf8_string(pk->user_id->name,
- pk->user_id->len);
- else
- {
- size_t n;
- char *p = get_user_id( keyid, &n );
- tty_print_utf8_string( p, n );
- m_free(p);
- }
- tty_printf("\"\n");
-
r = m_alloc( sizeof *r );
r->pk = pk; pk = NULL;
r->next = pk_list;
diff --git a/g10/trustdb.c b/g10/trustdb.c
index 743d9c771..be8835807 100644
--- a/g10/trustdb.c
+++ b/g10/trustdb.c
@@ -205,23 +205,31 @@ release_key_array ( struct key_array *keys )
* FIXME: Should be replaced by a function to add those keys to the trustdb.
*/
void
-register_trusted_key( const char *string )
+register_trusted_keyid(u32 *keyid)
{
- KEYDB_SEARCH_DESC desc;
struct key_item *k;
- if (classify_user_id (string, &desc) != KEYDB_SEARCH_MODE_LONG_KID ) {
- log_error(_("`%s' is not a valid long keyID\n"), string );
- return;
- }
-
k = new_key_item ();
- k->kid[0] = desc.u.kid[0];
- k->kid[1] = desc.u.kid[1];
+ k->kid[0] = keyid[0];
+ k->kid[1] = keyid[1];
k->next = user_utk_list;
user_utk_list = k;
}
+void
+register_trusted_key( const char *string )
+{
+ KEYDB_SEARCH_DESC desc;
+
+ if (classify_user_id (string, &desc) != KEYDB_SEARCH_MODE_LONG_KID )
+ {
+ log_error(_("`%s' is not a valid long keyID\n"), string );
+ return;
+ }
+
+ register_trusted_keyid(desc.u.kid);
+}
+
/*
* Helper to add a key to the global list of ultimately trusted keys.
* Retruns: true = inserted, false = already in in list.
diff --git a/g10/trustdb.h b/g10/trustdb.h
index bd7344bc9..ad192758e 100644
--- a/g10/trustdb.h
+++ b/g10/trustdb.h
@@ -39,6 +39,7 @@
#define TRUST_FLAG_PENDING_CHECK 256 /* a check-trustdb is pending */
/*-- trustdb.c --*/
+void register_trusted_keyid(u32 *keyid);
void register_trusted_key( const char *string );
void check_trustdb (void);
void update_trustdb (void);