Hi,
I am writing an application that allows a user to connect to 802.1x
access points. I connect to the access point, and use EAPOL to get
both the broadcast and unicast keys. I try setting the keys using
OID_802_11_ADD_WEP, but I don't get a valid connection (i.e a valid
DHCP connection).
Here is some pseudocode of what I am doing:
if (!SetInfrastructureMode(Ndis802_11Infrastructure))
return FALSE;
if (!SetAuthenticationMode(Ndis802_11AuthModeOpen))
return FALSE;
if (!SetEncryptionStatus(Ndis802_11Encryption1Enabled))
return FALSE;
if(!SetSSID(strSSID))
return FALSE;
// do EAPOL code, to get WEP Keys
if (!SetWEPKey(broadcastkey, keyLength, keyIndex,bBroadCast /*= TRUE
*/))
return FALSE;
if (!SetWEPKey(unicastkey, keyLength, keyIndex,bBroadCast /*=
FALSE*/))
return FALSE;
The keys get set correctly, but I do not get a valid DHCP address. I
found some Microsoft documentation, that basically said that unicast
keys are not supported yet. Is this true? It also set that only one
key can be set. The last key set is the active one. So I have tried
only setting one of the keys, and it still does not work. Also below
is a sample of how I set the WEP key.
PNDIS_802_11_WEP pWEP;
UCHAR * pOidData = NULL;
int nLength;
nLength = keyLength + 12;
// D311 has a problem if the data is not at least 16 bytes long and
has a 4 byte boundary
if (nLength % 4)
nLength += (4 - (nLength % 4));
pOidData = new UCHAR[nLength];
memset(pOidData,0,nLength);
pWEP = (PNDIS_802_11_WEP) pOidData;
pWEP->Length = nLength; // sizeof NIDS_802_11_WEP structure, this
includes length of network key
if (bBroadcast)
pWEP->KeyIndex = keyIndex | 0x80000000; // we set bit 31 to specify
global key
else
pWEP->KeyIndex = keyIndex;
pWEP->KeyLength = keyLength;
memcpy(pWEP->KeyMaterial,pKey,keyLength);
If someone could tell me what I am missing or what I am doing wrong,
it would be greatly appreciated.
Thanks
Shane