How do i Append multiple SecureString
s?
because i cant do
SecureString pepper
SecureString salt
SecureString pepperAndSalt = pepper + salt;
and if i would use
SecureString.AppendChar(Char)
i would have to convert salt into a insecure char array which is something i would like to avoid.
You can't1, by definition:
Note that SecureString has no members that inspect, compare, or convert the value of a SecureString. The absence of such members helps protect the value of the instance from accidental or malicious exposure. Use appropriate members of the System.Runtime.InteropServices.Marshal class, such as the SecureStringToBSTR method, to manipulate the value of a SecureString object.
Once you get a value in, you can't take it out.
1: Unless you're willing to start using unmanaged code by using Marshal.SecureStringToBSTR
, but that would defy the usage of SecureString
…