Is there any way to replicate the functionality of "Save credentials" button in the "802.1x settings" menu using Windows API? Or some other way to permanently save the PEAP credentials for the wireless profile.
I've tried the WlanSetProfileEapXmlUserData function to set MsChapV2:Username and MsChapV2:Password. It caches the credentials but does not save them permanently.
UPD: Managed to locate the userdata stored in HKLM\SOFTWARE\Microsoft\Wlansvc\UserData\Profiles\{GUID} but it is encrypted. I guess CryptProtectData is used to encrypt it. If only I knew what kind of salt is used.
HKLM\SOFTWARE\Microsoft\Wlansvc\UserData\Profiles\{GUID}\MSMUserData contains the data related to PEAP credentials.
It is encrypted with CryptProtectData. Decryption gave us a binary blob which is luckily easy to understand. It contains username and possibly logon domain in plain text. Password info is encrypted again with CryptProtectData function and placed towards the end of the blob.
Encryption is done without LOCAL_MACHINE flag so only Local System user can generate new credentials data. After you place it into the registry key, Windows thinks that you have a saved set of credentials and will never ask for them even in case of failed authentication.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With