An alternative to encrypting or decrypting column values of a datatable?

I need help from this wonderful community.

Situation: I am working on an automation project where some of the columns in the input datatable flowing from one workflow to the another must be encrypted.

I currently use a for loop to iterate through the datatable column and use UiPath.Cryptography pack activity to encrypt each cell value for the given column in the datatable.

This approach works well when the datatable has around 50 to 100 rows, unfortunately the datatable in production will be a minimum of 5000 rows. Using the current approach might not be suitable as I don’t want the dispatcher to take a long time to encrypt and decrypt column values. I have waited for over 10 minutes for 3 columns values to be encrypted (little over 9000 cells to encrypt).
Minimal version of the current Approach in .XAML: EncryptColumValuesCurrentApproach.xaml (10.3 KB)

However, is there a better alternative method to encrypt / decrypt column values in a datatable? For example, Linq method? I am looking to improve the performance and so I am open to any ideas, which can outperform the current approach.

Example: DT with columns ColumnA, ColumnB, ColumnC
ColumnA,ColumnB,ColumnC
TestA1,TestB1,TestC1
TestA2,TestB2,TestC2
TestA3,TestB3,TestC3

Wish: An encrypt / decrypt approach which performs faster than UiPath.Cryptography pack in a for loop

Expected outcome: (lets say I want to encrypt Columns “ColumnA” and “ColumnB” in DT using the AES algorithm)
ColumnA,ColumnB,ColumnC
dpfOvRN2kt2yZ1GDEfP2eA+Kdwt0D9SEXn4pB17q6pqvAsLmNE1tQw==,ynVuivnU8DtIrqNbRIm14oJxVfAtS5yZam7MVa111OEZ0PpWYf8Qww==,TestC1
zKkgXApZEhLmkb1sBTz7eylxKkpcWXakhWBve9N+CS2FUck4cODQYg==,r3zev69xZQCVpjLzkwuu4mXQgq/FA9Fyuh6sIZp09sfLrM9cxG9bDA==,TestC2
PvRH5StneKbRFX7BDw3xHd72OHEOvsIZEHHSfqxYdwNpzHOEL2k6IQ==,CKzyp3m0nSOCcJoMlMotwxDAZfMSrgTYF64WVIlalzoxnDqzpYpyiw==,TestC3

Thank you for your time and reply :pray:t4:

Hello @jeevith!

It seems that you have trouble getting an answer to your question in the first 24 hours.
Let us give you a few hints and helpful links.

First, make sure you browsed through our Forum FAQ Beginner’s Guide. It will teach you what should be included in your topic.

You can check out some of our resources directly, see below:

  1. Always search first. It is the best way to quickly find your answer. Check out the image icon for that.
    Clicking the options button will let you set more specific topic search filters, i.e. only the ones with a solution.

  2. Topic that contains most common solutions with example project files can be found here.

  3. Read our official documentation where you can find a lot of information and instructions about each of our products:

  4. Watch the videos on our official YouTube channel for more visual tutorials.

  5. Meet us and our users on our Community Slack and ask your question there.

Hopefully this will let you easily find the solution/information you need. Once you have it, we would be happy if you could share your findings here and mark it as a solution. This will help other users find it in the future.

Thank you for helping us build our UiPath Community!

Cheers from your friendly
Forum_Staff

Hi @jeevith,
It’s quite interesting idea. Sorry if I don’t get it fully but as I understand you are encrypting all cells separately right? What If you will try to encrypt all things together?

Hi @Pablito,

That is correct. I do encrypt / decrypt for each X value for the given Y columns.

You suggest: what if I can encrypt the entire DataTable object? You got me thinking there :bulb:
I can covert the entire Datatable into a Json String and since it is a string, I can encrypt the entire string using Cryptography Pack encrypt or decrypt activity using AES algorithm.

For decrypt I could do the opposite using Deserializing Json acitivity.

The only negative will be that, I will be encrypting every column, but this approach needs to be given a try and check if it improves the encrypt decrypt operations for large Datatables.

Thanks for the idea sparring !

1 Like

Hi Jeevith,

Were you able to make any progress on this idea? Would you mind sharing your experience ? I am looking for something similar where I need to encrypt every single value in DB while inserting and decrypt it when required in processing.

Hi @Sachin_Tayade,

Apologies for a delayed answer, but as I mentioned in the post above
Serializing → Encrypting —> Decrypting → Deserialize will work quite fast for large datatables as well. I have tested this on a Datatable with 8200 rows and two columns and it takes 3 seconds to achieve what I was looking for.

Here is a solution I have come up with for a dispatcher which needs to send encrypted data to queue and performer to decrypt and Deserialize the string to a Datatable:

The .xaml and sample .xlsx file:
EncryptColumnsImprovedApproach.zip (23.9 KB)

Your case
According to me, you will have to still use the old approach I posted (the question I first asked has an .xaml file which you can use) It will be a slow execution, but given your request of converting every single value in the Database to an encrypted value the method I propose as an improvement will not work for you. This is because I convert the read table to a string and then encrypt that string.

I suggest you try both approaches and then decide which one suits your case better.

Hope this helps!

1 Like

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