![]() Converting UnSecure String to Secure String SecureString secureString = new SecureString() SecureString sec_strPassword = new SecureString() Ĭonsole.WriteLine( " Secure String Example.") Ĭonsole.WriteLine( " Password : " + strPassword.ToString()) I will be writing a simple method to assign a string text to the secure string and check whether the data remains confidential. Let's create a sample console application, and add a class Misc. The example below demonstrates how to use SecureString to secure a user's password for use as a credential to start a new process. Your application can render the instance immutable and prevent further modification by invoking the MakeReadOnly method. The value of an instance of SecureString is automatically encrypted when the instance is initialized or when the value is modified. However, the value of a SecureStringobject is automatically encrypted, can be modified until your application marks it as read-only, and can be deleted from computer memory by either your application or the. To come over such a scenario, MS has introduced an additional object SecureString which is very similar to a String object and stores a text value. There is a risk of information being revealed after it is used because your application cannot delete data from computer memory. ![]() Once after using it if we don't need it anymore, it cannot be programmatically scheduled for garbage collection that is, the instance is read-only after it is created and it is not possible to predict when the instance will be deleted from the memory.Īs a result, it is risky to store sensitive information such as a password, credit card number, or personal data within a string object. We all are aware that the System.String class is immutable. ![]() The text is encrypted for privacy when being used, and deleted from computer memory when no longer needed. SecureString represents text that should be kept confidential. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |