Connecting to WEP network via wpa_supplicant/dbus/python

James Rayner iphitus at iphitus.org
Tue Apr 28 07:25:44 EDT 2009


On Wed, Feb 18, 2009 at 2:19 AM, Dan Williams <dcbw at redhat.com> wrote:
>
> How is the key stored in 'profile'?  It's likely you're storing the key
> as a hex string, right?  That's *not* actually the binary key.  To get
> the actual binary key, you need to convert the key from hex string
> representation to bytes.  For every two characters of the hex key,
> convert that hex value to a byte value from 0 - 255 (ie, '1a' == 0x1a).
> Thus, of course, the binary key will be 1/2 the size of the hexadecimal
> key.
>
> Note that WPA-PSK keys can be sent as the passphrase, and the D-Bus
> interface will quote them correctly.  But since WEP has no standard
> passphrase -> key hashing mechanism, that's not really do-able for WEP.
> Furthermore, for WEP, hex keys are actually acceptable passphrases.  So
> the D-Bus interface takes the position that for WEP, since the key type
> cannot be detected based on the input material, the caller must do the
> hashing themselves, and pass the actual 5- or 13-byte WEP key to the
> supplicant.
>
> Yeah, the D-Bus interface is somewhat ugly; I admit that.  I've got
> vague, hand-wavy plans to fix it.
>

Thanks!

Still having some slight problems getting the right syntax to pass.

I have a hex key of 017CF3C0EE
I split that up, convert and I get
 key=[1, 124, 243, 192, 238].

If I pass dbus a dbus.ByteArray(key), it errors:
 "Did not receive correct message arguments"

I also tried joining them as a string 001124243192238 however this did
not associate.

The code is effectively the same as my original email, and the
arguments passed are:
  {"ssid":dbus.ByteArray("some essid"), "key_mgmt":
dbus.String("NONE"), "wep_tx_idx": dbus.Int32(1 or 0, neither work),
"wep_key0": ??? }

Thanks in advance.
James


More information about the HostAP mailing list