How to convert a String to Security String Using Visual Basic


#1

HI guys, I need to convert a String to Security String Using Visual Basic. Some Ideas???
Best Rewards


#2

Hi @Jonga2018

You can use “Invoke code” activity to coding like that below:


Dim chars As String  = [_your target string_]
Dim teststring As System.Security.SecureString = _
    New System.Security.SecureString()

For Each ch As Char In chars
    teststring.AppendChar(ch)
Next
[_output securestring_]=teststring.Copy  

just a sample ,maybe can work with you.


#3

Another way is with the NetworkCredential type:

(new System.Net.NetworkCredential("", “myString”)).SecurePassword

image

And to convert from SecureString to String, you can use:

(new System.Net.NetworkCredential("", mySecureString,)).Password


#4

thanks guys for the answers the both of the answers solve my problem.
Best Rewards.