WlanSetProfile - How to setup a WPA2-ESS wifi profile - 小众知识

WlanSetProfile - How to setup a WPA2-ESS wifi profile

2013年01月27日 14:18:05 苏内容
  标签: Wifi
阅读:7328

Hi All,

I'm trying to setup a profile that connects to a protected network with the following details:

            Network Authentication : WPA2

            Data Encryption : AES

            EAP type : Protected EAP (PEAP) without certificate validation

            Authentication Method : Secured Password (EAP-MSCHAP v2)

 

I’ve created a profile like:

 

<?xml version="1.0"?>

<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">

    <name>Network </name>

    <SSIDConfig>

        <SSID>

            <name>Network</name>

        </SSID>

    </SSIDConfig>

    <connectionType>ESS</connectionType>

    <connectionMode>auto</connectionMode>

    <MSM>

        <security>

            <authEncryption>

                <authentication>WPA2</authentication>

                <encryption>AES</encryption>

                <useOneX>true</useOneX>

            </authEncryption>

            <OneX xmlns="http://www.microsoft.com/networking/OneX/v1">

                <EAPConfig>

                    <EapHostConfig xmlns="http://www.microsoft.com/provisioning/EapHostConfig"

                                   xmlns:eapCommon="http://www.microsoft.com/provisioning/EapCommon"

                                   xmlns:baseEap="http://www.microsoft.com/provisioning/BaseEapMethodConfig">

                        <EapMethod>

                            <eapCommon:Type>25</eapCommon:Type>

                            <eapCommon:AuthorId>0</eapCommon:AuthorId>

                       </EapMethod>

                       <Configxmlns:baseEap="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1"

                               xmlns:msPeap="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV1"

                               xmlns:msChapV2="http://www.microsoft.com/provisioning/MsChapV2ConnectionPropertiesV1">

                           <baseEap:Eap>

                               <baseEap:Type>25</baseEap:Type>

                               <msPeap:EapType>

                                   <msPeapTongue TiederverValidation>

                                       <msPeapBig SmileisableUserPromptForServerValidation>false</msPeapBig SmileisableUserPromptForServerValidation>

                                       <msPeap:TrustedRootCA />

                                   </msPeapTongue TiederverValidation>

                                   <msPeap:FastReconnect>true</msPeap:FastReconnect>

                                   <msPeap:InnerEapOptional>0</msPeap:InnerEapOptional>

                                   <baseEap:Eap>

                                       <baseEap:Type>26</baseEap:Type>

                                       <msChapV2:EapType>

                                           <msChapV2:UseWinLogonCredentials>false</msChapV2:UseWinLogonCredentials>

                                       </msChapV2:EapType>

                                   </baseEap:Eap>

                                   <msPeap:EnableQuarantineChecks>false</msPeap:EnableQuarantineChecks>

                                   <msPeap:RequireCryptoBinding>false</msPeap:RequireCryptoBinding>

                                   <msPeapStick out tongueeapExtensions />

                               </msPeap:EapType>

                           </baseEap:Eap>

                       </Config>

                   </EapHostConfig>

                </EAPConfig>

            </OneX>

        </security>

    </MSM>

</WLANProfile>

 

 

This should pop-up a dialog box asking for a username, password and a domain name, but it’s not. The call to WLanSetProfile returns an error code 1206 – The profile is invalid according to the schema.

 

Can anyone tell me what I’m doing wrong? I’m using windows XP SP2 with the Wireless Lan API for windows and Microsoft core xml services 6.0.

 

Many thanks




I’ve also tried to using WlanSetProfileEapXmlUserData but get an error code back 1168.

 

WlanSetProfileEapXmlUserData(hClientHandle, &ppInterfaceList->InterfaceInfo[0].InterfaceGuid, L"Network",0, wsProfileXml, NULL);

 

Where wsProfileXml is:

 

<?xml version="1.0"?>

<EapHostUserCredentials

            xmlns="http://www.microsoft.com/provisioning/EapHostUserCredentials"

            xmlns:eapCommon="http://www.microsoft.com/provisioning/EapCommon"

            xmlns:baseEap="http://www.microsoft.com/provisioning/BaseEapMethodUserCredentials">

  <EapMethod>

    <eapCommon:Type>25</eapCommon:Type>

    <eapCommon:AuthorId>0</eapCommon:AuthorId>

  </EapMethod>

  <Credentials xmlns:eapUser="http://www.microsoft.com/provisioning/EapUserPropertiesV1"

            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

            xmlns:baseEap="http://www.microsoft.com/provisioning/BaseEapUserPropertiesV1"

            xmlns:MsPeap="http://www.microsoft.com/provisioning/MsPeapUserPropertiesV1"

            xmlns:MsChapV2="http://www.microsoft.com/provisioning/MsChapV2UserPropertiesV1">

    <baseEap:Eap>

      <baseEap:Type>25</baseEap:Type>

      <MsPeap:EapType>

         <MsPeap:RoutingIdentity>ICBS2008_test</MsPeap:RoutingIdentity>

         <baseEap:Eap>

            <baseEap:Type>26</baseEap:Type>

            <MsChapV2:EapType>

               <MsChapV2:Username>USERNAME</MsChapV2:Username>

               <MsChapV2Stick out tongueassword>PASSWORD</MsChapV2Stick out tongueassword>

               <MsChapV2:LogonDomain/>

            </MsChapV2:EapType>

         </baseEap:Eap>

      </MsPeap:EapType>

    </baseEap:Eap>

  </Credentials>

</EapHostUserCredentials>

 

Any ideas what could I be doing wrong?

 

Thanks


扩展阅读