Question:

We are trying to use some of the new WLAN APIs to get wireless network and password settings so that they can automatically connect to the network that the user is already connected to. We are getting XML based profile with keyMaterial using the WlanGetProfile API. But interestingly, in the profile we are getting keyMaterial encrypted for Windows XP SP3. As per MSDN, the key material is never encrypted for Windows XP SP3.

I wanted to know if there any undocumented reason behind this behaviour of the WlanGetProfile API on Windows XP SP3?

Answer:

In Windows XP, the passphrase (8-63 characters) for a WPAPSK/WPA2PSK network is converted to a network key (64 hexadecimal digits). Both passphrase and network key can be used to connect to a network. The calculation from passphrase to network key is specified in RFC 2898.

I think you expected the passphrase to be displayed and thought the 64 digit network key was the encrypted passphrase. You can verify this by looking at the keyType element ("networkKey" or "passPhrase") in the profile.

Mahatab-ur-Rashid