Target endpoint does not accept the `SecureString` data type

I’m working with a Credential asset where the password is stored in a variable of type System.Security.SecureString.

Later in the workflow, I need to include this password in the body of an HTTP request, but the target endpoint does not accept the SecureString data type.

How can I convert a SecureString to a regular String in a VB.NET project?

hi, @Balachandrasekhar_C

convert it to String before using it in the request body.

Dim plainPassword As String =
    New System.Net.NetworkCredential(String.Empty, securePassword).Password

Where securePassword is of type System.Security.SecureString.

1 Like

convert from SecureString to String, use below expression

(new System.Net.NetworkCredential(“”, VarSecureString)).Password

To do vice-versa use this.

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

4 Likes

Hi @Balachandrasekhar_C

SecureString cannot be directly used in HTTP requests.Convert it using System.Net.NetworkCredential(“”, securePwd).Password and pass the resulting string to the request body.

Example plainPassword = New System.Net.NetworkCredential(String.Empty, securePassword).Password

Cheers

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.