# WM_SetWEPKey

## C Specification

      #include <nitro/wm.h>

      WMErrCode WM_SetWEPKey(
      WMCallbackFunc  callback ,
      u16             wepmode ,
      const u16*      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

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 feature and the encryption keys. 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. This function performs that same processing as `WM_SetWEPKeyEx` when `wepkey` is set to 0. Encryption using WEP key is applied to authentication during connection and to data send and received in infrastructure mode. The `wepmode` setting on the sender and receiver must match. 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_SetWEPKeyEx`, `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 with the wepmode argument.
10/22/2004 Changed type of return value.
08/02/2004 Standardized structure names.
07/29/2004 Added Description, etc.
07/23/2004 Initial version