Assign Secure Text to Variable

Hi, is there any way to assign secure text/encrypted text to a variable? This is so that I can assign a password variable once and use it multiple times in various locations, without storing it as plain text

@DEATHFISH

We can create a variable as SecureString and that can be used to store password.


Mukesh

On assign, Value of type String cannot be converted to SecureString. How to solve this?

Hi @DEATHFISH

Try this package EncryptDecrypt.Activities package

Regards,
Kommi Jeevan.

Reference :slightly_smiling_face:


Mukesh

2 Likes

Instead of directly storing a password to variable, you should store the credentials as generic credentials in your local machine(look for credential manager > windows credentials > and add generic credentials). and pass them as variables from this location.

Use the activity get secure credentials (download package Uipath.Credentials.Activities).
Whatever network name you use in the credential store, add that same name to an excel file(config). In the target property of the activity provide the variable name that reads the network name from the excel in which you just stored.It will automatically fetch the credentials and store as output in username and password properties of the get secure credential activity.

Before entering password anywhere use thia in an assign activity: String plainStr = new System.Net.NetworkCredential(string.Empty, secureStr).Password.
This is the best option in terms of using credential from security point of view.
Let me know if you face any issues.

@DEATHFISH - pls try below -
1 - string to secureString
secureStringVariable = (new System.Net.NetworkCredential("", “stringVariable”)).SecurePassword

2 - secureString to string
stringVariable = (new System.Net.NetworkCredential("",secureStringVariable)).Password

2 Likes