aboutsummaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
Diffstat (limited to 'g10')
-rw-r--r--g10/ChangeLog5
-rw-r--r--g10/g10.c6
-rw-r--r--g10/hkp.c30
-rw-r--r--g10/hkp.h1
-rw-r--r--g10/revoke.c13
5 files changed, 53 insertions, 2 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index ea1133cc1..f46837283 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,8 @@
+Sat Mar 20 11:44:21 CET 1999 Werner Koch <[email protected]>
+
+ * g10.c (main): Added command --recv-keys
+ * hkp.c (hkp_import): New.
+
Wed Mar 17 13:09:03 CET 1999 Werner Koch <[email protected]>
* trustdb.c (check_trust): add new arg add_fnc and changed all callers.
diff --git a/g10/g10.c b/g10/g10.c
index c78cb34e9..5ec1a013c 100644
--- a/g10/g10.c
+++ b/g10/g10.c
@@ -85,6 +85,7 @@ enum cmd_and_opt_values { aNull = 0,
aListSigs,
aListSecretKeys,
aSendKeys,
+ aRecvKeys,
aExport,
aExportAll,
aExportSecret,
@@ -189,6 +190,7 @@ static ARGPARSE_OPTS opts[] = {
#endif
{ aExport, "export" , 256, N_("export keys") },
{ aSendKeys, "send-keys" , 256, N_("export keys to a key server") },
+ { aRecvKeys, "recv-keys" , 256, N_("import keys from a key server") },
{ aExportAll, "export-all" , 256, "@" },
{ aExportSecret, "export-secret-keys" , 256, "@" },
{ aImport, "import", 256 , N_("import/merge keys")},
@@ -649,6 +651,7 @@ main( int argc, char **argv )
case aImport: set_cmd( &cmd, aImport); break;
case aFastImport: set_cmd( &cmd, aFastImport); break;
case aSendKeys: set_cmd( &cmd, aSendKeys); break;
+ case aRecvKeys: set_cmd( &cmd, aRecvKeys); break;
case aExport: set_cmd( &cmd, aExport); break;
case aExportAll: set_cmd( &cmd, aExportAll); break;
case aListKeys: set_cmd( &cmd, aListKeys); break;
@@ -1108,11 +1111,14 @@ main( int argc, char **argv )
case aExport:
case aExportAll:
case aSendKeys:
+ case aRecvKeys:
sl = NULL;
for( ; argc; argc--, argv++ )
add_to_strlist( &sl, *argv );
if( cmd == aSendKeys )
hkp_export( sl );
+ else if( cmd == aRecvKeys )
+ hkp_import( sl );
else
export_pubkeys( sl, (cmd == aExport) );
free_strlist(sl);
diff --git a/g10/hkp.c b/g10/hkp.c
index 7300cf0e1..cd5b177b1 100644
--- a/g10/hkp.c
+++ b/g10/hkp.c
@@ -64,7 +64,9 @@ hkp_ask_import( u32 *keyid )
opt.keyserver_name, (ulong)keyid[1] );
rc = http_open_document( &hd, request, 0 );
if( rc ) {
- log_info("can't get key from keyserver: %s\n", g10_errstr(rc) );
+ log_info("can't get key from keyserver: %s\n",
+ rc == G10ERR_NETWORK? strerror(errno)
+ : g10_errstr(rc) );
}
else {
rc = import_keys_stream( hd.fp_read , 0 );
@@ -76,6 +78,28 @@ hkp_ask_import( u32 *keyid )
}
+
+int
+hkp_import( STRLIST users )
+{
+ if( !opt.keyserver_name ) {
+ log_error("no keyserver known (use option --keyserver)\n");
+ return -1;
+ }
+
+ for( ; users; users = users->next ) {
+ u32 kid[2];
+ int type = classify_user_id( users->d, kid, NULL, NULL, NULL );
+ if( type != 10 && type != 11 ) {
+ log_info("%s: not a valid key ID\n", users->d );
+ continue;
+ }
+ hkp_ask_import( kid );
+ }
+ return 0;
+}
+
+
int
hkp_export( STRLIST users )
{
@@ -110,7 +134,9 @@ hkp_export( STRLIST users )
rc = http_open( &hd, HTTP_REQ_POST, request , 0 );
if( rc ) {
log_error("can't connect to `%s': %s\n",
- opt.keyserver_name, g10_errstr(rc) );
+ opt.keyserver_name,
+ rc == G10ERR_NETWORK? strerror(errno)
+ : g10_errstr(rc) );
iobuf_close(temp);
m_free( request );
return rc;
diff --git a/g10/hkp.h b/g10/hkp.h
index b062cfa26..6b124fc43 100644
--- a/g10/hkp.h
+++ b/g10/hkp.h
@@ -23,6 +23,7 @@
int hkp_ask_import( u32 *keyid );
+int hkp_import( STRLIST users );
int hkp_export( STRLIST users );
diff --git a/g10/revoke.c b/g10/revoke.c
index 88af788a9..6467b8482 100644
--- a/g10/revoke.c
+++ b/g10/revoke.c
@@ -62,6 +62,19 @@ gen_revoke( const char *uname )
}
+ /* FIXME: ask for the reason of revocation
+ 0x00 - No reason specified (key revocations or cert revocations)
+ Does not make sense!
+
+ 0x01 - Key is superceded (key revocations)
+ 0x02 - Key material has been compromised (key revocations)
+ 0x03 - Key is no longer used (key revocations)
+ 0x20 - User id information is no longer valid (cert revocations)
+
+ Following the revocation code is a string of octets which gives
+ information about the reason for revocation in human-readable form
+ */
+
memset( &afx, 0, sizeof afx);
memset( &zfx, 0, sizeof zfx);
init_packet( &pkt );