3 ms·
How does SecureString actually work? Presumably it's possible to coerce one into a "normal" string, and I'm sure that someone will end up doing this in the code
by saagarjha 8y ago
How does SecureString actually work? Presumably it's possible to coerce one into a "normal" string, and I'm sure that someone will end up doing this in the codebase because it's more convenient to work with.
- gwbas1c 8y agoThe point of SecureString is to ensure that sensitive information gets removed from RAM in a timely manner. It's just a wrapper around some native memory that gets zeroed when the SecureString object is disposed. Otherwise, when you use standard C# strings, you don't know when the garbage collector will collect them. (Granted, you could do similar things with pinning a char[] to a char* and zeroing it before you end the pin, but who wants to jump through those hoops?)
- saagarjha 8y agoBut what I want to pass a SecureString to someone? Doesn't a copy have to take place in that case?