Good day. There was a task to decrypt the wi-fi password saved in the system. Example content file (C: \ ProgramData \ Microsoft \ Wlansvc \ Profiles \ Interfaces):
<keyMaterial>01000000D08C9DDF0115D1118C7A00C04FC297EB01000000B5DC49CF346C5441ACC9412051EEA53100000000020000000000106600000001000020000000B0BCA6C2C90D3F05AE7F43835F1CB0E8B9ECBCF351138A83B9E94228181CAC9E000000000E8000000002000020000000630621CC8DE9EBBFBE1089010AE6ABF4C531E277F18DC576E4EBDEB43C0D238110000000778F49BCC7B5CC0D032ECFAD9CD5419E4000000054FCFB5D2A46A1BD944F1A42B27C6B1A0CD19E5101DA4B4307DEBD5ECE980E3AEB62E1959060720459C2A854BA9100C9E912AC076A49D13B0B935942FDF4BF11</keyMaterial> The essence of the problem - does not work, throws an exception: CryptUnprotectData failed.
Call:
string entropy = null; string description; string Pass = @"01000000D08C9DDF0115D1118C7A00C04FC297EB01000000B5DC49CF346C5441ACC9412051EEA53100000000020000000000106600000001000020000000B0BCA6C2C90D3F05AE7F43835F1CB0E8B9ECBCF351138A83B9E94228181CAC9E000000000E8000000002000020000000630621CC8DE9EBBFBE1089010AE6ABF4C531E277F18DC576E4EBDEB43C0D238110000000778F49BCC7B5CC0D032ECFAD9CD5419E4000000054FCFB5D2A46A1BD944F1A42B27C6B1A0CD19E5101DA4B4307DEBD5ECE980E3AEB62E1959060720459C2A854BA9100C9E912AC076A49D13B0B935942FDF4BF11"; byte[] Key = null; // Call DPAPI to decrypt data. string decrypted = DPAPI.Decrypt(Pass, entropy, out description); richTextBox1.Text = decrypted; Auxiliary class: http://dumpz.org/1173308/
CryptUnprotectDatafrom under the Local System account. Do you do that - VladDLogonUserfunction. But here, you may have to experiment further. - VladD