24 ms·
That's why modern languages need something like a typedef! At least C# has a concept of a SecureString for things like passwords.
by gwbas1c 8y ago
That's why modern languages need something like a typedef!
At least C# has a concept of a SecureString for things like passwords.
- saagarjha 8y agoHow 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?
- koyote 8y agoFWIW SecureString should not be used: https://github.com/dotnet/platform-compat/blob/master/docs/DE0001.md https://github.com/dotnet/platform-compat/blob/master/docs/D...
- gwbas1c 8y ago> The general approach of dealing with credentials is to avoid them and instead rely on other means to authenticate, such as certificates or Windows authentication. Sure... I bet you eat right and get plenty of exercise, right? Anyway, that link appears to be best practices when writing cross-platform code.