title: Is there a way to query stored Wi-fi network keys on Windows CE or Mobile using XML Provisioning?
body: <p>I'm wondering if anyone has experience getting a stored Wi-fi network key from a WinCE device. I can configure our Windows CE (Embedded Compact 7) device to connect to a Wifi network and can specify the AP name, security mode, network key, etc. by using the built-in <a href="http://msdn.microsoft.com/en-us/library/gg155011.aspx" rel="nofollow">XML Provisioning</a>. I can also read out all Wifi settings for the device using <a href="http://msdn.microsoft.com/en-us/library/bb737199.aspx" rel="nofollow">this method</a> (also XML Provisioning). However, all the settings are returned except for the network key. I suspect this is for security purposes.</p>
  
  <p>Is there a way to force it to reveal the network key, or perhaps some other way to programmatically access this stored data?</p>
  
  <p>Many thanks!</p>
  
  <p>Edit:</p>
  
  <p>@Nicolas-R requested an example.</p>
  
  <p>Here's setting the Wi-Fi settings on the device using XML provisioning (for WPA2-Personal authentication):</p>
  
  <pre><code>&lt;wap-provisioningdoc&gt;
      &lt;characteristic type="Wi-Fi"&gt;
          &lt;characteristic type="access-point"&gt;
              &lt;characteristic type="MyWirelessApName"&gt;
                  &lt;parm name="Hidden" value="0" /&gt;
                  &lt;parm name="Encryption" value="6" /&gt;
                  &lt;parm name="Authentication" value="7" /&gt;
                  &lt;parm name="KeyIndex" value="1" /&gt;
                  &lt;parm name="NetworkKey" value="MyNetworkPassword" /&gt;
                  &lt;parm name="KeyProvided" value="0" /&gt;
                  &lt;parm name="Use8021x" value="0" /&gt;
                  &lt;parm name="EAPType" value="0" /&gt;
              &lt;/characteristic&gt;
          &lt;/characteristic&gt;
      &lt;/characteristic&gt;
  &lt;/wap-provisioningdoc&gt;
  </code></pre>
  
  <p>And here is how to query all Wi-Fi info from the device:</p>
  
  <pre><code>&lt;wap-provisioningdoc&gt;
      &lt;characteristic type="Wi-Fi"&gt;
          &lt;characteristic-query type="access-point" recursive="true"/&gt;
      &lt;/characteristic&gt;
  &lt;/wap-provisioningdoc&gt;
  </code></pre>
  
  <p>Here's the response I get back from the device:</p>
  
  <pre><code>&lt;wap-provisioningdoc&gt;
      &lt;characteristic type="Wi-Fi"&gt;
          &lt;characteristic type="access-point" recursive="true"&gt;
              &lt;characteristic type="MyWirelessApName"&gt;&lt;parm name="DestId" value="{436EF144-B8FB-4863-A041-8F945A62C572}"/&gt;
                  &lt;parm name="AdHoc" value="0"/&gt;
                  &lt;parm name="Hidden" value="0"/&gt;
                  &lt;parm name="Authentication" value="7"/&gt;
                  &lt;parm name="Encryption" value="6"/&gt;
                  &lt;parm name="KeyProvided" value="0"/&gt;
                  &lt;parm name="NetworkKey" value=""/&gt;
                  &lt;parm name="KeyIndex" value="1"/&gt;
                  &lt;parm name="Use8021x" value="0"/&gt;
                  &lt;parm name="EAPType" value="0"/&gt;
              &lt;/characteristic&gt;
          &lt;/characteristic&gt;
      &lt;/characteristic&gt;
  &lt;/wap-provisioningdoc&gt;
  </code></pre>
  
  <p>As you can see, the NetworkKey returned is blank. I've tested this, however, to verify that the REAL network key really is stored on the WinCE device (and it is; it successfully joins the password-protected access point).</p>