all groups > vb.net > february 2007 >
You're in the

vb.net

group:

How to set value of SecureString?


How to set value of SecureString? Dean Slindee
2/28/2007 9:26:09 PM
vb.net:
How do you set the value of a Security.SecureString?

Dim strSecure As New Security.SecureString

strSecure = CType("Friday", Security.SecureString)

RE: How to set value of SecureString? dotNetDave
3/6/2007 4:21:15 PM
It's not very easy. Here is some code:

Public Shared Function LoadSecureString(ByVal input As String) As
System.Security.SecureString
LoadSecureString = Nothing

If Not String.IsNullOrEmpty(input) Then
LoadSecureString = New System.Security.SecureString
For Each character As Char In input.ToCharArray
LoadSecureString.AppendChar(character)
Next
LoadSecureString.MakeReadOnly()
End If

End Function

======================================
David McCarter [Microsoft VB.NET MVP]
www.vsdntips.com
VSDN Tips & Tricks .NET Coding Standards available at:
www.cafepress.com/vsdntips.20412485


[quoted text, click to view]
AddThis Social Bookmark Button