How would I get a byte[] equivalent of a SecureString (which I get from a PasswordBox)?
My objective is to write these bytes using a CryptoStream to a file, and the Write method of that class takes a byte[] input, so I want to convert the SecureString to the byte[] so I can use in with a CryptoStream.
EDIT: I don't want to use string as it defeats the point of having a SecureString
I modified from the original answer to handle unicode