c# - How to convert SecureString to System.String? -


All reservations about unsetting your secure string by creating a system. on one side How can this be done?

How can I convert a simple system. Security. Secure string to system.String?

I am convinced that many of you are familiar with strings safely so that nobody should convert any securasting to a simple .NET string because it removes all security protections. I know but now my program does everything with normal string, and I am trying to increase its security and although I am going to use an API that gives me a safe string I am trying to use not to increase my safety

I know about Marshall. The securitational tabret, but I do not know how to take that bill and make a system. Take it out.

For those people who can ask what I want to do, well, I'm taking a password from the user and logging it to a web site to create an HTML form I am submitting as POST. Therefore ... it should really be done with managed, unencrypted buffers. If I can gain access to unmanaged, unencrypted buffers, I think I can write a byte-by-write stream on the network stream and hope that the password is completely protected. I am hoping for at least one answer from these circumstances.

Use the class:

  string syntax string (secure string value) {IntPtr valuePtr = IntPtr.Zero; Try {valuePtr = Marshal.SecureStringToGlobalAllocUnicode (value); Return martial.printstringuny (valuePtr); } Finally {Marshal.ZeroFreeGlobalAllocUnicode (valuePtr); }}  

If you want to avoid creating a managed string object, you can access raw data by using:

  void HandleSecureString ( SecureString value) {IntPtr ValuePtr = IntPtr.Zero; Try {valuePtr = Marshal.SecureStringToGlobalAllocUnicode (value); For (int i = 0; i  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -