PowerShell可以将值安全地存储在文件中:
PS > Read-Host 'Enter password' -AsSecureString | ConvertFrom-SecureString | Out-File ~\Desktop\SerializedSecurePassword.txt
如何将文本中存储的值反序列化为C#应用程序中的System.Security.SecureString
?
string path = @"C:\\Users\\<user>\\Desktop\\SerializedSecurePassword.txt";
string contents = File.ReadAllText(path);
System.Security.SecureString SecurePassword = ?;