How to get Hex Key of KeyMaterial Item when utilize function WLanConnect ot set profile?

I can use wlanconnect function connect to a unsecure network, but can't connect to secure network, becauseI can't set the key(WEP/TKIP).
The keyMaterial (sharedKey) element contains a network key or passphrase. This field is encrypted locally by the AutoConfig service.
So i still can't set the key in the profile, because I don't find the way to encrypted the key .
If anybody have any ideas or documents ,please let me to know.
Thanks for your help.

[638 byte] By [steveLi] at [2008-2-15]
# 1
There is a program in www.code-easy.com will get and save your keymaterial for you.
Vince at 2008-2-8 > top of Msdn Tech,Windows Networking Development,Windows XP Wireless SDK...