diff options
Diffstat (limited to 'g10')
-rw-r--r-- | g10/Makefile.am | 4 | ||||
-rw-r--r-- | g10/Makefile.in | 10 | ||||
-rw-r--r-- | g10/OPTIONS | 6 | ||||
-rw-r--r-- | g10/export.c | 47 | ||||
-rw-r--r-- | g10/g10.c | 167 | ||||
-rw-r--r-- | g10/getkey.c | 102 | ||||
-rw-r--r-- | g10/main.h | 2 | ||||
-rw-r--r-- | g10/options.h | 2 | ||||
-rw-r--r-- | g10/pkclist.c | 21 |
9 files changed, 260 insertions, 101 deletions
diff --git a/g10/Makefile.am b/g10/Makefile.am index 5c22b4b7e..ec432e049 100644 --- a/g10/Makefile.am +++ b/g10/Makefile.am @@ -41,11 +41,13 @@ g10_SOURCES = g10.c \ seskey.c \ sign.c \ import.c \ + export.c \ comment.c \ sig-check.c -LDADD = -L ../cipher -L ../mpi -L ../util -lcipher -lmpi -lutil +LDADD = -L ../cipher -L ../mpi -L ../util -L ../intl \ + -lcipher -lmpi -lutil -lintl $(PROGRAMS): ../cipher/libcipher.a ../mpi/libmpi.a ../util/libutil.a diff --git a/g10/Makefile.in b/g10/Makefile.in index 1212499da..ec99a5bc2 100644 --- a/g10/Makefile.in +++ b/g10/Makefile.in @@ -79,10 +79,12 @@ g10_SOURCES = g10.c \ seskey.c \ sign.c \ import.c \ + export.c \ comment.c \ sig-check.c -LDADD = -L ../cipher -L ../mpi -L ../util -lcipher -lmpi -lutil +LDADD = -L ../cipher -L ../mpi -L ../util -L ../intl \ + -lcipher -lmpi -lutil -lintl mkinstalldirs = $(top_srcdir)/scripts/mkinstalldirs CONFIG_HEADER = ../config.h PROGRAMS = $(bin_PROGRAMS) @@ -104,7 +106,7 @@ g10_OBJECTS = g10.o build-packet.o compress.o encode.o encr-data.o \ free-packet.o getkey.o pkclist.o skclist.o ringedit.o kbnode.o keygen.o \ mainproc.o armor.o mdfilter.o textfilter.o cipher.o elg.o rsa.o \ openfile.o keyid.o trustdb.o parse-packet.o passphrase.o plaintext.o \ -pubkey-enc.o seckey-cert.o seskey.o sign.o import.o comment.o \ +pubkey-enc.o seckey-cert.o seskey.o sign.o import.o export.o comment.o \ sig-check.o EXTRA_g10_SOURCES = g10_LDADD = $(LDADD) @@ -124,8 +126,8 @@ DEP_FILES = $(srcdir)/.deps/armor.P $(srcdir)/.deps/build-packet.P \ $(srcdir)/.deps/cipher.P $(srcdir)/.deps/comment.P \ $(srcdir)/.deps/compress.P $(srcdir)/.deps/elg.P \ $(srcdir)/.deps/encode.P $(srcdir)/.deps/encr-data.P \ -$(srcdir)/.deps/free-packet.P $(srcdir)/.deps/g10.P \ -$(srcdir)/.deps/getkey.P $(srcdir)/.deps/import.P \ +$(srcdir)/.deps/export.P $(srcdir)/.deps/free-packet.P \ +$(srcdir)/.deps/g10.P $(srcdir)/.deps/getkey.P $(srcdir)/.deps/import.P \ $(srcdir)/.deps/kbnode.P $(srcdir)/.deps/keygen.P \ $(srcdir)/.deps/keyid.P $(srcdir)/.deps/mainproc.P \ $(srcdir)/.deps/mdfilter.P $(srcdir)/.deps/openfile.P \ diff --git a/g10/OPTIONS b/g10/OPTIONS index 684abd2d9..ed91fcf50 100644 --- a/g10/OPTIONS +++ b/g10/OPTIONS @@ -42,6 +42,12 @@ encrypt # (Can be combined with a "sign") # encrypt data +export <names> +# Either export all keys from all keyrings (default keyrings and +# those registered via option "keyring"), or if at least one name is +# given, those of the givename. The new keyring is written to stdout +# or to the file given with option "output" + fingerprint # show the fingerprints, diff --git a/g10/export.c b/g10/export.c new file mode 100644 index 000000000..d45c1285f --- /dev/null +++ b/g10/export.c @@ -0,0 +1,47 @@ +/* export.c + * Copyright (c) 1998 by Werner Koch (dd9jn) + * + * This file is part of G10. + * + * G10 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * G10 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include <config.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <assert.h> + +#include "options.h" +#include "packet.h" +#include "errors.h" +#include "keydb.h" +#include "memory.h" +#include "util.h" + + +/**************** + * Make a new keyring from all internal keyrings (if no user is given) + * or for all selected users. + */ +int +export_pubkeys( STRLIST users ) +{ + log_fatal("Not yet implemented"); + return 0; +} + + @@ -37,12 +37,14 @@ #include "filter.h" #include "trustdb.h" #include "ttyio.h" +#include "i18n.h" + enum cmd_values { aNull = 0, aSym, aStore, aEncr, aPrimegen, aKeygen, aSign, aSignEncr, aPrintMDs, aSignKey, aClearsig, aListPackets, aEditSig, aKMode, aKModeC, aChangePass, aImport, aListTrustDB, - aListTrustPath, + aListTrustPath, aExport, aTest }; @@ -67,24 +69,31 @@ strusage( int level ) break; case 2: case 12: p = - "Syntax: g10 [options] [files]\n" - "sign, check, encrypt or decrypt\n" - "default operation depends on the input data\n"; break; + _("Syntax: g10 [options] [files]\n" + "sign, check, encrypt or decrypt\n" + "default operation depends on the input data\n"); break; case 26: - p = "Please report bugs to <[email protected]>.\n"; + p = _("Please report bugs to <[email protected]>.\n"); break; - case 30: p = "" - #ifndef HAVE_ZLIB_H + #if !defined(HAVE_ZLIB_H) && defined(HAVE_RSA_CIPHER) + case 30: p = _( " NOTE: This version is compiled without ZLIB support;\n" " you are not able to process compresssed data!\n" - #endif - #ifdef HAVE_RSA_CIPHER "WARNING: This version has RSA support! Your are not allowed to\n" - " use it inside the Unites States before Sep 30, 2000!\n" + " use it inside the Unites States before Sep 30, 2000!\n" ); + #elif !defined(HAVE_ZLIB_H) + case 30: p = _( + " NOTE: This version is compiled without ZLIB support;\n" + " you are not able to process compresssed data!\n"); + #elif defined(HAVE_RSA_CIPHER) + case 30: p = _( + "WARNING: This version has RSA support! Your are not allowed to\n" + " use it inside the Unites States before Sep 30, 2000!\n" ); + #else + case 30: p = ""; #endif - ; break; default: p = default_strusage(level); } @@ -92,9 +101,19 @@ strusage( int level ) } static void +i18n_init(void) +{ + #ifdef HAVE_LIBINTL + setlocale( LC_MESSAGES, "" ); + bindtextdomain( PACKAGE, G10_LOCALEDIR ); + textdomain( PACKAGE ); + #endif +} + +static void wrong_args( const char *text) { - fputs("Usage: g10 [options] ",stderr); + fputs(_("Usage: g10 [options] "),stderr); fputs(text,stderr); putc('\n',stderr); exit(2); @@ -130,7 +149,7 @@ set_cmd( enum cmd_values *ret_cmd, enum cmd_values new_cmd ) else if( cmd == aKMode && new_cmd == aSym ) cmd = aKModeC; else { - log_error("conflicting commands\n"); + log_error(_("conflicting commands\n")); exit(2); } @@ -142,57 +161,58 @@ int main( int argc, char **argv ) { static ARGPARSE_OPTS opts[] = { - { 'a', "armor", 0, "create ascii armored output"}, - { 'v', "verbose", 0, "verbose" }, - { 'z', NULL, 1, "set compress level (0 disables)" }, - { 'n', "dry-run", 0, "don't make any changes" }, - { 'c', "symmetric", 0, "do only a symmetric encryption" }, - { 'o', "output", 2, "use as output file" }, - { 500, "batch", 0, "batch mode: never ask" }, - { 501, "yes", 0, "assume yes on most questions"}, - { 502, "no", 0, "assume no on most questions"}, - { 503, "gen-key", 0, "generate a new key pair" }, - { 504, "add-key", 0, "add key to the public keyring" }, - { 505, "delete-key",0, "remove key from public keyring" }, - { 506, "sign-key" ,0, "make a signature on a key in the keyring" }, - { 507, "store", 0, "store only" }, - { 508, "check-key" ,0, "check signatures on a key in the keyring" }, - { 509, "keyring" ,2, "add this keyring to the list of keyrings" }, - { 's', "sign", 0, "make a signature"}, - { 't', "textmode", 0, "use canonical text mode"}, - { 'b', "detach-sign", 0, "make a detached signature"}, - { 'e', "encrypt", 0, "encrypt data" }, - { 'd', "decrypt", 0, "decrypt data (default)" }, - { 'u', "local-user",2, "use this user-id to sign or decrypt" }, - { 'r', "remote-user", 2, "use this user-id for encryption" }, - { 'k', NULL , 0, "list keys" }, - { 510, "debug" ,4|16, "set debugging flags" }, - { 511, "debug-all" ,0, "enable full debugging"}, - { 512, "cache-all" ,0, "hold everything in memory"}, + { 'a', "armor", 0, N_("create ascii armored output")}, + { 'v', "verbose", 0, N_("verbose") }, + { 'z', NULL, 1, N_("set compress level (0 disables)") }, + { 'n', "dry-run", 0, N_("don't make any changes") }, + { 'c', "symmetric", 0, N_("do only a symmetric encryption")}, + { 'o', "output", 2, N_("use as output file")}, + { 500, "batch", 0, N_("batch mode: never ask")}, + { 501, "yes", 0, N_("assume yes on most questions")}, + { 502, "no", 0, N_("assume no on most questions")}, + { 503, "gen-key", 0, N_("generate a new key pair")}, + { 504, "add-key", 0, N_("add key to the public keyring")}, + { 505, "delete-key",0, N_("remove key from public keyring")}, + { 506, "sign-key" ,0, N_("make a signature on a key in the keyring")}, + { 507, "store", 0, N_("store only")}, + { 508, "check-key" ,0, N_("check signatures on a key in the keyring")}, + { 509, "keyring" ,2, N_("add this keyring to the list of keyrings")}, + { 's', "sign", 0, N_("make a signature")}, + { 't', "textmode", 0, N_("use canonical text mode")}, + { 'b', "detach-sign", 0, N_("make a detached signature")}, + { 'e', "encrypt", 0, N_("encrypt data")}, + { 'd', "decrypt", 0, N_("decrypt data (default)")}, + { 'u', "local-user",2, N_("use this user-id to sign or decrypt")}, + { 'r', "remote-user", 2, N_("use this user-id for encryption")}, + { 'k', NULL , 0, N_("list keys")}, + { 510, "debug" ,4|16, N_("set debugging flags")}, + { 511, "debug-all" ,0, N_("enable full debugging")}, + /* { 512 unused */ { 513, "gen-prime" , 0, "\r" }, { 514, "test" , 0, "\r" }, - { 515, "fingerprint", 0, "show the fingerprints"}, - { 516, "print-mds" , 0, "print all message digests"}, - { 517, "secret-keyring" ,2, "add this secret keyring to the list" }, - { 518, "options" , 2, "read options from file" }, + { 515, "fingerprint", 0, N_("show the fingerprints")}, + { 516, "print-mds" , 0, N_("print all message digests")}, + { 517, "secret-keyring" ,2, N_("add this secret keyring to the list")}, + { 518, "options" , 2, N_("read options from file")}, { 519, "no-armor", 0, "\r"}, { 520, "no-default-keyring", 0, "\r" }, - { 521, "list-packets",0,"list only the sequence of packets"}, + { 521, "list-packets",0,N_("list only the sequence of packets")}, { 522, "no-greeting", 0, "\r" }, { 523, "passphrase-fd",1, "\r" }, - { 524, "edit-sig" ,0, "edit a key signature" }, - { 525, "change-passphrase", 0, "change the passphrase of your secret keyring"}, + { 524, "edit-sig" ,0, N_("edit a key signature")}, + { 525, "change-passphrase", 0, N_("change the passphrase of your secret keyring")}, { 526, "no-verbose", 0, "\r"}, - { 527, "cipher-algo", 2 , "select default cipher algorithm" }, - { 528, "pubkey-algo", 2 , "select default puplic key algorithm" }, - { 529, "digest-algo", 2 , "select default message digest algorithm" }, - { 530, "import", 0 , "put public keys into the trustdb" }, + { 527, "cipher-algo", 2 , N_("select default cipher algorithm")}, + { 528, "pubkey-algo", 2 , N_("select default puplic key algorithm")}, + { 529, "digest-algo", 2 , N_("select default message digest algorithm")}, + { 530, "import", 0 , N_("put public keys into the trustdb")}, { 531, "list-trustdb",0 , "\r"}, { 532, "quick-random", 0, "\r"}, { 533, "list-trust-path",0, "\r"}, - { 534, "no-comment", 0, "do not write comment packets"}, - { 535, "completes_needed", 1, "(default is 1)"}, - { 536, "marginals_needed", 1, "(default is 3)"}, + { 534, "no-comment", 0, N_("do not write comment packets")}, + { 535, "completes-needed", 1, N_("(default is 1)")}, + { 536, "marginals-needed", 1, N_("(default is 3)")}, + { 537, "export", 0, N_("export all or the given keys") }, {0} }; ARGPARSE_ARGS pargs; @@ -217,6 +237,7 @@ main( int argc, char **argv ) enum cmd_values cmd = 0; + i18n_init(); opt.compress = -1; /* defaults to standard compress level */ opt.def_cipher_algo = CIPHER_ALGO_BLOWFISH; opt.def_pubkey_algo = PUBKEY_ALGO_ELGAMAL; @@ -256,15 +277,15 @@ main( int argc, char **argv ) if( !configfp ) { if( default_config ) { if( parse_verbose > 1 ) - log_info("note: no default option file '%s'\n", configname ); + log_info(_("note: no default option file '%s'\n"), configname ); } else - log_fatal("option file '%s': %s\n", + log_fatal(_("option file '%s': %s\n"), configname, strerror(errno) ); m_free(configname); configname = NULL; } if( parse_verbose > 1 ) - log_info("reading options from '%s'\n", configname ); + log_info(_("reading options from '%s'\n"), configname ); default_config = 0; } @@ -306,7 +327,7 @@ main( int argc, char **argv ) case 509: add_keyring(pargs.r.ret_str); nrings++; break; case 510: opt.debug |= pargs.r.ret_ulong; break; case 511: opt.debug = ~0; break; - case 512: opt.cache_all = 1; break; + /* case 512: */ case 513: set_cmd( &cmd, aPrimegen); break; case 514: set_cmd( &cmd, aTest); break; case 515: opt.fingerprint = 1; break; @@ -344,6 +365,7 @@ main( int argc, char **argv ) case 534: opt.no_comment=1; break; case 535: opt.completes_needed = pargs.r.ret_int; break; case 536: opt.marginals_needed = pargs.r.ret_int; break; + case 537: set_cmd( &cmd, aExport); break; default : errors++; pargs.err = configfp? 1:2; break; } } @@ -355,23 +377,23 @@ main( int argc, char **argv ) } m_free( configname ); configname = NULL; if( !opt.def_cipher_algo || check_cipher_algo(opt.def_cipher_algo) ) { - log_error("selected cipher algorithm is invalid\n"); + log_error(_("selected cipher algorithm is invalid\n")); errors++; } if( !opt.def_pubkey_algo || check_pubkey_algo(opt.def_pubkey_algo) ) { - log_error("selected pubkey algorithm is invalid\n"); + log_error(_("selected pubkey algorithm is invalid\n")); errors++; } if( !opt.def_digest_algo || check_digest_algo(opt.def_digest_algo) ) { - log_error("selected digest algorithm is invalid\n"); + log_error(_("selected digest algorithm is invalid\n")); errors++; } if( opt.completes_needed < 1 ) { - log_error("completes_needed must be greater than 0\n"); + log_error(_("completes-needed must be greater than 0\n")); errors++; } if( opt.marginals_needed < 2 ) { - log_error("marginals_needed must be greater than 1\n"); + log_error(_("marginals-needed must be greater than 1\n")); errors++; } if( errors ) @@ -435,7 +457,7 @@ main( int argc, char **argv ) default: rc = init_trustdb(1); break; } if( rc ) - log_error("failed to initialize the TrustDB: %s\n", g10_errstr(rc)); + log_error(_("failed to initialize the TrustDB: %s\n"), g10_errstr(rc)); switch( cmd ) { @@ -527,7 +549,7 @@ main( int argc, char **argv ) while( (s=get_keyring(seq++)) ) { if( !(a = iobuf_open(s)) ) { - log_error("can't open '%s'\n", s); + log_error(_("can't open '%s'\n"), s); continue; } if( seq > 1 ) @@ -544,7 +566,7 @@ main( int argc, char **argv ) } else if( argc == 1) { /* list the given keyring */ if( !(a = iobuf_open(fname)) ) - log_fatal("can't open '%s'\n", fname_print); + log_fatal(_("can't open '%s'\n"), fname_print); proc_packets( a ); iobuf_close(a); } @@ -603,6 +625,15 @@ main( int argc, char **argv ) } break; + case aExport: + sl = NULL; + for( ; argc; argc--, argv++ ) + add_to_strlist( &sl, *argv ); + export_pubkeys( sl ); + free_strlist(sl); + break; + + case aListTrustDB: if( !argc ) list_trustdb(NULL); @@ -614,7 +645,7 @@ main( int argc, char **argv ) case aListTrustPath: if( argc != 2 ) - wrong_args("--list-trust-path <maxdepth> <username>"); + wrong_args("--list-trust-path [-- -]<maxdepth> <username>"); list_trust_path( atoi(*argv), argv[1] ); break; @@ -624,7 +655,7 @@ main( int argc, char **argv ) if( argc > 1 ) usage(1); if( !(a = iobuf_open(fname)) ) - log_fatal("can't open '%s'\n", fname_print); + log_fatal(_("can't open '%s'\n"), fname_print); if( !opt.no_armor ) { /* push the armor filter, so it can peek at the input data */ memset( &afx, 0, sizeof afx); diff --git a/g10/getkey.c b/g10/getkey.c index b1cb64a29..eea9b6beb 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -23,6 +23,7 @@ #include <stdlib.h> #include <string.h> #include <assert.h> +#include <ctype.h> #include "util.h" #include "packet.h" #include "memory.h" @@ -215,15 +216,6 @@ get_pubkey( PKT_public_cert *pkc, u32 *keyid ) STRLIST sl; - if( opt.cache_all && !pkc_cache ) { - log_info("reading all entries ...\n"); - for(sl = keyrings; sl; sl = sl->next ) - if( !scan_keyring( NULL, NULL, NULL, sl->d ) ) - goto leave; - log_info("cached %d entries\n", pkc_cache_entries); - } - - /* lets see wether we checked the keyid already */ for( kl = unknown_keyids; kl; kl = kl->next ) if( kl->keyid[0] == keyid[0] && kl->keyid[1] == keyid[1] ) @@ -273,6 +265,19 @@ get_pubkey( PKT_public_cert *pkc, u32 *keyid ) * first pubkey certificate which has the given name in a user_id. * if pkc has the pubkey algo set, the function will only return * a pubkey with that algo. + * + * - If the username starts with 8,9,16 or 17 hex-digits (the first one + * must be in the range 0..9), this is considered a keyid; depending + * on the length a short or complete one. + * - If the username starts with 32,33,40 or 41 hex-digits (the first one + * must be in the range 0..9), this is considered a fingerprint. + * (Not yet implemented) + * - If the username starts with a left angle, we assume it is a complete + * email address and look only at this part. + * - If the userid start with an '=' an exact compare is done; this may + * also follow the keyid in which case both parts are matched. + * (Not yet implemented) + * */ int get_pubkey_byname( PKT_public_cert *pkc, const char *name ) @@ -280,6 +285,58 @@ get_pubkey_byname( PKT_public_cert *pkc, const char *name ) int internal = 0; int rc = 0; STRLIST sl; + const char *s; + u32 keyid[2] = {0}; /* init to avoid compiler warning */ + int use_keyid=0; + + /* check what kind of name it is */ + for(s = name; *s && isspace(*s); s++ ) + ; + if( isdigit( *s ) ) { /* a keyid */ + int i; + char buf[9]; + + for(i=0; isxdigit(s[i]); i++ ) + ; + if( s[i] && !isspace(s[i]) ) /* not terminated by EOS or blank*/ + rc = G10ERR_INV_USER_ID; + else if( i == 8 || (i == 9 && *s == '0') ) { /* short keyid */ + if( i==9 ) + s++; + keyid[1] = strtoul( s, NULL, 16 ); + use_keyid++; + } + else if( i == 16 || (i == 17 && *s == '0') ) { /* complete keyid */ + if( i==17 ) + s++; + mem2str(buf, s, 9 ); + keyid[0] = strtoul( buf, NULL, 16 ); + keyid[1] = strtoul( s+8, NULL, 16 ); + return get_pubkey( pkc, keyid ); + } + else + rc = G10ERR_INV_USER_ID; + } + else if( *s == '<' ) { /* an email address */ + /* for now handled like a substring */ + /* a keyserver might use this for quicker access */ + } + else if( *s == '=' ) { /* exact search */ + rc = G10ERR_INV_USER_ID; /* nox yet implemented */ + } + else if( *s == '#' ) { /* use local id */ + rc = G10ERR_INV_USER_ID; /* nox yet implemented */ + } + else if( *s == '*' ) { /* substring search */ + name++; + } + else if( !*s ) /* empty string */ + rc = G10ERR_INV_USER_ID; + + if( rc ) + goto leave; + + if( !pkc ) { pkc = m_alloc_clear( sizeof *pkc ); @@ -288,9 +345,14 @@ get_pubkey_byname( PKT_public_cert *pkc, const char *name ) /* 2. Try to get it from the keyrings */ for(sl = keyrings; sl; sl = sl->next ) - if( !scan_keyring( pkc, NULL, name, sl->d ) ) - goto leave; - + if( use_keyid ) { + if( !scan_keyring( pkc, keyid, name, sl->d ) ) + goto leave; + } + else { + if( !scan_keyring( pkc, NULL, name, sl->d ) ) + goto leave; + } /* 3. Try to get it from a key server */ /* 4. not found: store it for future reference */ @@ -363,6 +425,9 @@ get_seckey_byname( PKT_secret_cert *skc, const char *name, int unprotect ) /**************** * scan the keyring and look for either the keyid or the name. + * If both, keyid and name are given, look for keyid but use only + * the low word of it (name is only used as a flag to indicate this mode + * of operation). */ static int scan_keyring( PKT_public_cert *pkc, u32 *keyid, @@ -375,11 +440,11 @@ scan_keyring( PKT_public_cert *pkc, u32 *keyid, int save_mode; u32 akeyid[2]; PKT_public_cert *last_pk = NULL; + int shortkeyid; - assert( !keyid || !name ); - - if( opt.cache_all && (name || keyid) ) - return G10ERR_NO_PUBKEY; + shortkeyid = keyid && name; + if( shortkeyid ) + name = NULL; /* not used anymore */ if( !(a = iobuf_open( filename ) ) ) { log_debug("scan_keyring: can't open '%s'\n", filename ); @@ -388,6 +453,8 @@ scan_keyring( PKT_public_cert *pkc, u32 *keyid, if( !DBG_CACHE ) ; + else if( shortkeyid ) + log_debug("scan_keyring %s for %08lx\n", filename, keyid[1] ); else if( name ) log_debug("scan_keyring %s for '%s'\n", filename, name ); else if( keyid ) @@ -410,7 +477,8 @@ scan_keyring( PKT_public_cert *pkc, u32 *keyid, case PUBKEY_ALGO_ELGAMAL: case PUBKEY_ALGO_RSA: keyid_from_pkc( pkt.pkt.public_cert, akeyid ); - if( akeyid[0] == keyid[0] && akeyid[1] == keyid[1] ) { + if( (shortkeyid || akeyid[0] == keyid[0]) + && akeyid[1] == keyid[1] ) { copy_public_cert( pkc, pkt.pkt.public_cert ); found++; } diff --git a/g10/main.h b/g10/main.h index 273e7a823..5a76173a1 100644 --- a/g10/main.h +++ b/g10/main.h @@ -79,6 +79,8 @@ void g10_rsa_sign( PKT_secret_cert *skc, PKT_signature *sig, MD_HANDLE md ); /*-- import.c --*/ int import_pubkeys( const char *filename ); +/*-- export.c --*/ +int export_pubkeys( STRLIST users ); #endif /*G10_MAIN_H*/ diff --git a/g10/options.h b/g10/options.h index ed0cc6579..89388f14e 100644 --- a/g10/options.h +++ b/g10/options.h @@ -31,7 +31,7 @@ struct { int answer_yes; /* answer yes on most questions */ int answer_no; /* answer no on most questions */ int check_sigs; /* check key signatures */ - int cache_all; + int reserved1; int fingerprint; /* list fingerprints */ int list_sigs; /* list signatures */ int no_armor; diff --git a/g10/pkclist.c b/g10/pkclist.c index 5381ac301..411435f60 100644 --- a/g10/pkclist.c +++ b/g10/pkclist.c @@ -33,6 +33,7 @@ #include "util.h" #include "trustdb.h" #include "ttyio.h" +#include "i18n.h" /**************** * Returns true if a ownertrust has changed. @@ -61,14 +62,14 @@ query_ownertrust( ulong lid ) return 0; } - tty_printf("No ownertrust defined for %lu:\n" - "%4u%c/%08lX %s \"", lid, + tty_printf(_("No ownertrust defined for %lu:\n" + "%4u%c/%08lX %s \""), lid, nbits_from_pkc( pkc ), pubkey_letter( pkc->pubkey_algo ), (ulong)keyid[1], datestr_from_pkc( pkc ) ); p = get_user_id( keyid, &n ); tty_print_string( p, n ), m_free(p); - tty_printf("\"\n\n" + tty_printf(_("\"\n\n" "Please decide in how far do you trust this user to\n" "correctly sign other users keys (looking at his passport,\n" "checking the fingerprints from different sources ...)?\n\n" @@ -76,19 +77,19 @@ query_ownertrust( ulong lid ) " 2 = I do NOT trust\n" " 3 = I trust marginally\n" " 4 = I trust fully\n" -" s = please show me more informations\n\n" ); +" s = please show me more informations\n\n") ); for(;;) { - p = tty_get("Your decision? "); + p = tty_get(_("Your decision? ")); trim_spaces(p); tty_kill_prompt(); if( *p && p[1] ) ; else if( *p == '?' ) { - tty_printf( + tty_printf(_( "It's up to you to assign a value here; this value will never be exported\n" "to any 3rd party. We need it to implement the web-of-trust; it has nothing\n" -"to do with the (implicitly created) web-of-certificates.\n"); +"to do with the (implicitly created) web-of-certificates.\n")); } else if( !p[1] && (*p >= '1' && *p <= '4') ) { unsigned trust; @@ -104,7 +105,7 @@ query_ownertrust( ulong lid ) break; } else if( *p == 's' || *p == 'S' ) { - tty_printf("You will see a list of signators etc. here\n"); + tty_printf(_("You will see a list of signators etc. here\n")); } m_free(p); p = NULL; } @@ -128,8 +129,8 @@ add_ownertrust( PKT_public_cert *pkc ) int any=0; tty_printf( -"Could not find a valid trust path to the key. Lets see, wether we\n" -"can assign some missing owner trust values.\n\n"); +_("Could not find a valid trust path to the key. Lets see, wether we\n" + "can assign some missing owner trust values.\n\n")); rc = query_trust_record( pkc ); if( rc ) { |