40-Bit Keys
- From: j bootlab org
- To: networkmanager-list gnome org
- Subject: 40-Bit Keys
- Date: Mon, 01 Nov 2004 20:31:41 +0100
hi,
with the latest version of the debian packages
+ installing orinoco-0.15rc2 i managed to get one
step further: the applet now lists the wireless networks.
my problem now is that i have a 40-Bit Key.
attached patch enables 40-Bit Passphrase,
nm_wireless_40bit_key_from_passphrase is not working,
does someone know how to compute the 40bit key?
thanks for your work,
j
Index: info-daemon/NetworkManagerInfoPassphraseDialog.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/info-daemon/NetworkManagerInfoPassphraseDialog.c,v
retrieving revision 1.7
diff -u -r1.7 NetworkManagerInfoPassphraseDialog.c
--- info-daemon/NetworkManagerInfoPassphraseDialog.c 27 Oct 2004 19:02:07 -0000 1.7
+++ info-daemon/NetworkManagerInfoPassphraseDialog.c 1 Nov 2004 19:25:33 -0000
@@ -41,7 +41,8 @@
enum NMIPassphraseDialogKeyTypes
{
KEY_TYPE_128_BIT_PASSPHRASE = 0,
- KEY_TYPE_128_BIT_RAW_HEX_KEY = 1
+ KEY_TYPE_128_BIT_RAW_HEX_KEY = 1,
+ KEY_TYPE_40_BIT_PASSPHRASE = 2
};
@@ -102,6 +103,9 @@
case KEY_TYPE_128_BIT_RAW_HEX_KEY:
gtk_label_set_label (entry_label, _("Key:"));
break;
+ case KEY_TYPE_40_BIT_PASSPHRASE:
+ gtk_label_set_label (entry_label, _("Passphrase:"));
+ break;
default:
break;
}
@@ -143,6 +147,9 @@
case KEY_TYPE_128_BIT_RAW_HEX_KEY:
key_type_return = NM_ENC_TYPE_128_BIT_HEX_KEY;
break;
+ case KEY_TYPE_40_BIT_PASSPHRASE:
+ key_type_return = NM_ENC_TYPE_40_BIT_PASSPHRASE;
+ break;
default:
key_type_return = NM_ENC_TYPE_UNKNOWN;
break;
Index: info-daemon/passphrase.glade
===================================================================
RCS file: /cvs/gnome/NetworkManager/info-daemon/passphrase.glade,v
retrieving revision 1.7
diff -u -r1.7 passphrase.glade
--- info-daemon/passphrase.glade 8 Oct 2004 05:22:17 -0000 1.7
+++ info-daemon/passphrase.glade 1 Nov 2004 19:25:33 -0000
@@ -148,7 +148,8 @@
<widget class="GtkComboBox" id="key_type_combo">
<property name="visible">True</property>
<property name="items" translatable="yes">128-bit Passphrase
-128-bit Raw Hex Key</property>
+128-bit Raw Hex Key
+40-bit Passphrase</property>
</widget>
<packing>
<property name="padding">0</property>
Index: panel-applet/essid.glade
===================================================================
RCS file: /cvs/gnome/NetworkManager/panel-applet/essid.glade,v
retrieving revision 1.3
diff -u -r1.3 essid.glade
--- panel-applet/essid.glade 29 Oct 2004 16:37:43 -0000 1.3
+++ panel-applet/essid.glade 1 Nov 2004 19:25:35 -0000
@@ -313,7 +313,8 @@
<widget class="GtkComboBox" id="key_type_combo">
<property name="visible">True</property>
<property name="items" translatable="yes">128-bit Passphrase
-128-bit Raw Hex Key</property>
+128-bit Raw Hex Key
+40-bit Passphrase</property>
</widget>
<packing>
<property name="left_attach">1</property>
Index: src/NetworkManagerAP.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/src/NetworkManagerAP.c,v
retrieving revision 1.17
diff -u -r1.17 NetworkManagerAP.c
--- src/NetworkManagerAP.c 27 Oct 2004 19:02:07 -0000 1.17
+++ src/NetworkManagerAP.c 1 Nov 2004 19:25:35 -0000
@@ -226,6 +226,9 @@
case (NM_ENC_TYPE_128_BIT_HEX_KEY):
case (NM_ENC_TYPE_40_BIT_PASSPHRASE):
+ if (source_key)
+ hashed = nm_wireless_40bit_key_from_passphrase (source_key);
+ break;
case (NM_ENC_TYPE_40_BIT_HEX_KEY):
case (NM_ENC_TYPE_UNKNOWN):
if (source_key)
Index: src/NetworkManagerWireless.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/src/NetworkManagerWireless.c,v
retrieving revision 1.16
diff -u -r1.16 NetworkManagerWireless.c
--- src/NetworkManagerWireless.c 13 Sep 2004 17:43:16 -0000 1.16
+++ src/NetworkManagerWireless.c 1 Nov 2004 19:25:35 -0000
@@ -65,6 +65,42 @@
/*
+ * nm_wireless_40bit_key_from_passphrase
+ *
+ * From a passphrase, generate a standard 40-bit WEP key using
+ * MD5 algorithm.
+ *
+ */
+char *nm_wireless_40bit_key_from_passphrase (char *passphrase)
+{
+ char md5_data[41];
+ unsigned char digest[16];
+ int passphrase_len;
+ int i;
+
+ g_return_val_if_fail (passphrase != NULL, NULL);
+
+ passphrase_len = strlen (passphrase);
+ if (passphrase_len < 1)
+ return (NULL);
+
+ /* Get at least 20 bits */
+ for (i = 0; i < 20; i++)
+ md5_data [i] = passphrase [i % passphrase_len];
+
+ /* Null terminate md5 data-to-hash and hash it */
+ md5_data[40] = 0;
+#ifdef HAVE_GCRYPT
+ gcry_md_hash_buffer (GCRY_MD_MD5, digest, md5_data, 40);
+#else
+ gnome_keyring_md5_string (md5_data, digest);
+#endif
+
+ return (nm_wireless_md5_digest_to_ascii (digest));
+}
+
+
+/*
* nm_wireless_128bit_key_from_passphrase
*
* From a passphrase, generate a standard 128-bit WEP key using
Index: src/NetworkManagerWireless.h
===================================================================
RCS file: /cvs/gnome/NetworkManager/src/NetworkManagerWireless.h,v
retrieving revision 1.7
diff -u -r1.7 NetworkManagerWireless.h
--- src/NetworkManagerWireless.h 13 Sep 2004 17:43:16 -0000 1.7
+++ src/NetworkManagerWireless.h 1 Nov 2004 19:25:35 -0000
@@ -27,6 +27,7 @@
#include "NetworkManagerDevice.h"
#include "NetworkManagerAPList.h"
+char * nm_wireless_40bit_key_from_passphrase (char *passphrase);
char * nm_wireless_128bit_key_from_passphrase (char *passphrase);
gboolean nm_wireless_scan_monitor (gpointer user_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]