I'm trying to see whether my SecureString contains a particular text.
I could do it this way:
var sstr = new SecureString();
...
//sstr is now appended with a set of characters
if(sstr.ToString().Contains("Hello world")) {
//do something
}
This works, but the moment when I do sstr.ToString(), it seems like I've just written the content in SecureString into the memory and this totally defeats the purpose of using SecureString.
How should I check whether a SecureString contains some text?