# WM_SetWEPKeyEx

## C Specification

      #include <nitro/wm.h>

      WMErrCode WM_SetWEPKeyEx(
              WMCallbackFunc  callback ,
              u16             wepmode ,
              u16             wepkeyid ,
              const u8*       wepkey
      );

## Arguments

`callback` | Designates the callback function to call when the asynchronous process completes. This callback is called from within the interrupt handler.

wepmode

Designates the operations mode of the encryption communications feature. Use a value from 0-3, as shown below.

- 0 : No encryption features
- 1 : RC4 ( 40-bit) encryption mode
- 2 : RC4 ( 104-bit) encryption mode
- 3 : RC4 (128-bit) encryption mode

wepkeyid | Designates a value from 0-3 that indicates which of the 4 WEP keys will be used.

wepkey

Designates a pointer to the encryption key data (80 bytes).
The key data is made up of four data items, each of which are 20 bytes. Of each 20 bytes,

- In 40-bit mode, 5 bytes
- In 104-bit mode, 13 bytes
- 16 bytes in 128-bit mode

are used.
Notice that this data entity will be forcibly cached.

## Return Values

Returns the results of the `WMErrCode` enumerated type process.

## Description

Configures the encryption features and the encryption key. Detailed configurations can be made with `WM_SetWEPKey`. It is executable when WM is in an IDLE state. If the return value of the function was `WM_ERRCODE_OPERATING`, the callback is generated after the encryption feature configuration process has completed. WEP key encryption is applied to the authentication process when connecting and to the sending and receiving of data in infrastructure mode. `wepmode` must be configured in the same way as its communications partner. wepkeyid is used in the selection of the encryption data string when sending data. Conversely, the WEP key of the ID designated by the send side is used in decryption when data is received. Since it can be confirmed that the keys are identical by encrypting the child device and decrypting the parent device in shared key authentication, designation of an ID on the parent device has no real meaning. Also, the IDs of the WEP keys designated by the access point must be identical when encrypting receive data in infrastructure mode. Be aware that when connecting the parent device that performed the WEP encryption configuration as a child device via this function, once the WEP configurations have been performed with this function, the `authMode` of the `WM_StartConnectEx` function must be designated as shared key authentication (`WM_AUTHMODE_SHARED_KEY`).

## See Also

`WM_SetWEPKey, WM_StartConnectEx`

## Revision History

06/08/2005 Added statement about callback being called from the interrupt handler.
03/07/2005 Added to Description.
03/02/2005 Added statement about range that can be specified for the wepmode argument.
02/14/2005 Initial version

CONFIDENTIAL