Added SILC Public Key version 2 support.
authorPekka Riikonen <priikone@silcnet.org>
Tue, 23 Jan 2007 14:53:24 +0000 (14:53 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Tue, 23 Jan 2007 14:53:24 +0000 (14:53 +0000)
apps/irssi/src/fe-common/silc/module-formats.c
apps/irssi/src/fe-common/silc/module-formats.h
apps/irssi/src/silc/core/silc-channels.c
apps/irssi/src/silc/core/silc-servers.c
lib/silcapputil/silcapputil.c

index ce7c5012cf3c5dda9a4deefc9d2bcb2e694108ea..2171d607e448498cbc977aceeef53a96d75026f6 100644 (file)
@@ -246,6 +246,7 @@ FORMAT_REC fecommon_silc_formats[] = {
 
         { "lstkey_file", "Public key file    : $0", 1, { 0 } },
         { "lstkey_alg", "Algorithm          : $0", 1, { 0 } },
+        { "lstkey_ver", "Version            : $0", 1, { 0 } },
         { "lstkey_bits", "Key length (bits)  : $0", 1, { 1 } },
         { "lstkey_rn", "Real name          : $0", 1, { 0 } },
         { "lstkey_un", "Username           : $0", 1, { 0 } },
index 2c4c064bfe21350e2236c07d8237a91a465368c7..bb5666ad0337222eb6189a05a4218699ea52c488 100644 (file)
@@ -239,6 +239,7 @@ enum {
   
   SILCTXT_LISTKEY_PUB_FILE,
   SILCTXT_LISTKEY_PUB_ALG,
+  SILCTXT_LISTKEY_PUB_VER,
   SILCTXT_LISTKEY_PUB_BITS,
   SILCTXT_LISTKEY_PUB_RN,
   SILCTXT_LISTKEY_PUB_UN,
index 7a8797460528ff2b00e4b3dbe48d886e85773d64..bcf4099d1da38a6d9050ef82fa17928cbb258c8b 100644 (file)
@@ -1090,6 +1090,10 @@ void silc_list_key(const char *pub_filename, int verbose)
     printformat_module("fe-common/silc", NULL, NULL,
                         MSGLEVEL_CRAP, SILCTXT_LISTKEY_PUB_BITS,
                         (unsigned int)key_len);
+  if (ident->version && verbose)
+    printformat_module("fe-common/silc", NULL, NULL,
+                        MSGLEVEL_CRAP, SILCTXT_LISTKEY_PUB_VER,
+                        ident->version);
   if (ident->realname && (!is_server_key || verbose))
     printformat_module("fe-common/silc", NULL, NULL,
                        MSGLEVEL_CRAP, SILCTXT_LISTKEY_PUB_RN,
index 6f58b5a0ceed6c07bba09278e4f1d47e6daa4459..455aeed30d6426813eef96d0337536714f9268f0 100644 (file)
@@ -1,7 +1,7 @@
 /*
   silc-server.c : irssi
 
-  Copyright (C) 2000 - 2006 Timo Sirainen
+  Copyright (C) 2000 - 2007 Timo Sirainen
                             Pekka Riikonen <priikone@silcnet.org>
 
   This program is free software; you can redistribute it and/or modify
@@ -461,17 +461,18 @@ static void sig_disconnected(SILC_SERVER_REC *server)
   silc_dlist_uninit(server->ftp_sessions);
 
   if (server->conn) {
+    /* Close connection */
     silc_client_close_connection(silc_client, server->conn);
-
-    /* SILC closes the handle */
-    g_io_channel_unref(net_sendbuffer_handle(server->handle));
-    net_sendbuffer_destroy(server->handle, FALSE);
-    server->handle = NULL;
   } else if (server->op) {
     /* Abort on going connecting (key exchange) */
     silc_async_abort(server->op, NULL, NULL);
     server->op = NULL;
   }
+
+  /* SILC closes the handle */
+  g_io_channel_unref(net_sendbuffer_handle(server->handle));
+  net_sendbuffer_destroy(server->handle, FALSE);
+  server->handle = NULL;
 }
 
 SERVER_REC *silc_server_init_connect(SERVER_CONNECT_REC *conn)
index 32018654de19f937f2c002935f91b0fd745f95a8..059fbce3b19641833d9b256d25158458571817cc 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2002 - 2006 Pekka Riikonen
+  Copyright (C) 2002 - 2007 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -43,7 +43,7 @@ static char *silc_create_pk_identifier(void)
   silc_snprintf(email, sizeof(email), "%s@%s", username, hostname);
 
   ident = silc_pkcs_silc_encode_identifier(username, hostname, realname,
-                                          email, NULL, NULL);
+                                          email, NULL, NULL, NULL);
   if (realname)
     silc_free(realname);
   silc_free(hostname);
@@ -192,8 +192,11 @@ New pair of keys will be created.  Please, answer to following questions.\n\
     }
   }
 
+  if (interactive)
+    printf("\nGenerating the key pair...\n");
+
   /* Generate keys */
-  if (!silc_pkcs_silc_generate_key(alg, "pkcs1-no-oid", key_len_bits,
+  if (!silc_pkcs_silc_generate_key(alg, key_len_bits,
                                   identifier, rng, &public_key,
                                   &private_key))
     return FALSE;
@@ -302,6 +305,8 @@ SilcBool silc_show_public_key(SilcPublicKey public_key)
   printf("Algorithm          : %s\n", silc_pkcs_get_name(public_key));
   if (key_len)
     printf("Key length (bits)  : %d\n", (unsigned int)key_len);
+  if (ident->version)
+    printf("Version            : %s\n", ident->version);
   if (ident->realname)
     printf("Real name          : %s\n", ident->realname);
   if (ident->username)