PowerShell can store a value securely in a file:
PS > Read-Host 'Enter password' -AsSecureString | ConvertFrom-SecureString | Out-File ~\Desktop\SerializedSecurePassword.txt
How does one deserialize the value stored in the text into a System.Security.SecureString
in a C# application?
string path = @"C:\\Users\\<user>\\Desktop\\SerializedSecurePassword.txt";
string contents = File.ReadAllText(path);
System.Security.SecureString SecurePassword = ?;