Saqib Ullah

BootStrapper Know How

  Home  |   Contact  |   Syndication    |   Login
  93 Posts | 1 Stories | 341 Comments | 15 Trackbacks

News



Article Categories

Archives

Post Categories

Blogging websites

Favourite Blogs

Private Links

Sites

There is a new class, System.Security.SecureString . To understand the purpose of this class, think about eg. a password. You probably never want anyone to see the password, but if you store it in a simple System.String instance there are some security risks. For example, how do you get rid of the value when you've finished with the string? You can set the reference to the string to null , but the value itself is still in the managed heap. Indeed there may be several copies of it lurking around if the garbage collector has moved it during previous collections. Bluntly, the heap was never designed to guard against someone going through it with a memory dump tool. SecureString solves this kind of issue. Assigning a value to secure string is pretty simple and just like assigning a value to a string, eg: System.Security.SecureString pword = new System.Security.SecureString(); pword = "admin"; pword.Clear(); The value is stored in an encrypted form, and SecureString also has a Clear() method that completely wipes out the data. Extracting the value from a secure string is possible but complicated - and not often done.
posted on Wednesday, November 29, 2006 11:52 PM

Feedback

# re: Password with System.Security.SecureString Class in .Net 2.0 9/13/2008 5:48 PM Mp3 Film Program Download
Thanks 1

# re: Password with System.Security.SecureString Class in .Net 2.0 10/7/2008 8:08 PM duggal
how to assign value. you have poseted wrong info.
pword = "admin"; never works.

# re: Password with System.Security.SecureString Class in .Net 2.0 1/7/2009 12:11 PM Cassidy
You can assign a value to a SecureString as follows:

SecureString secureString = new secureString();
string myPassword = "secret";

foreach (char c in myPassword)
secureString.AppendChar(c);

secureString.MakeReadOnly();


# re: Password with System.Security.SecureString Class in .Net 2.0 8/26/2009 5:34 PM test
Thats not secure if string myPass = "secret" is used, then I can see it in .exe binary!

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: