Meziantou.Framework.SensitiveData
provides the SensitiveData
class. This class represent sensitive data which should be difficult to accidentally disclose. But there's no effort to thwart intentional disclosure of these contents, such as through a debugger or memory dump utility.
using var secret = SensitiveData.Create<string>("secret");
// Reveal data
byte[] data = secret.RevealToArray();
string str = secret.RevealToString();
var buffer = new byte[10];
secret.RevealInto(buffer);