With the .NET 2.0 Framework, Microsoft introduced a class called SecureString. Its purpose is to help programmers protect sensitive data by encrypting strings that are in memory. In addition to that, the byte array it uses to store the data is zeroed out when disposed. The garbage collector also does not move your string around on the heap, so there won't be any artifact copies floating around.
There are other methods employed by the SecureString class to thwart off would-be-hackers, but this article isn't about that. This article is about making secure strings easier to work with. How that is accomplished is as follows:
With this you will be able to take a regular string and convert it to a SecureString and vice versa. Although using a SecureString is not the end-all-panacea for hiding and encrypting data in your programs, it does make things a little easier than other heavy handed encryption schemes. And using these methods above makes it even easier to use.
Security
Programming