Using securestring

My project requires that i get credentials from the orchestrator.

I have no problem getting the credentials, with password stored as a securestring.

I am required to enter the password in a command prompt window. Anyway to do that without converting the securestring to string first?

edit: Apologies. I asked the wrong question. I need to enter the securestring password into a config file(text file). I am currently using the read text activity which passes the contents to a string. I then write back to the file using string.replace(“password”,securestring)

Type Securetext requires a Uielement so i dont think Type SecureText would work.

@tzj
use TypeSecuretext activity.

1 Like

Apologies. I asked the wrong question. I need to enter the securestring password into a config file(text file). I am currently using the read text activity which passes the contents to a string. I then write back to the file using string.replace(“password”,securestring)

Type Securetext requires a Uielement so i dont think Type SecureText would work.

1 Like

@tzj

as of my knowledge it may not be possible to decode password in UiPath.

string = new System.Net.NetworkCredential(string.Empty, securePassword).Password

will convert a secure string back to string.

but that would defeat the purpose of a secure string. I am hoping theres a way to use it in a string.Replace(“password”,secureString) method.

@tzj You can use “assign” activity with “System.Runtime.InteropServices.Marshal.PtrToStringUni(System.Runtime.InteropServices.Marshal.SecureStringToGlobalAllocUnicode(pass))” as value and convert your password(coming from Orchestrator as secure string) to string. Please see the attached screenshot for reference.

4 Likes