SOLVED

How to decrypt a column in SQL Server that had been encrypted in C#

Copper Contributor

Hi all,

I have a requirement to decrypt a column in SQL server. Someone else has encrypted the column in C# and used the RijndaelManged class to do this. Is there a way, to decrypt the column in SQL Server? 

 

Thanks!,

 

Seyed

2 Replies
best response confirmed by Seyed1 (Copper Contributor)
Solution

@Seyed1 , you can try to find a way to implement the algorythm in plain T-SQL (I doubt it) or you use the SQL Server CLR integration with the RijndaelManaged Class.

See Overview of CLR Integration - SQL Server | Microsoft Learn

 

No matter which way you go, you have to implement it on your own.

 

Olaf

Hi Olaf,
Thank you for taking time to answer my post. It seems that the best thing to do is to decrypt the colmn using C#.NET instead of SQL Server. I don't know if a column that is encrypted in C# could be decrypted in SQL Server. I created a C#.NET Windows Form and was able to read a csv file and write the same columns to another csv file. In between the reads, I will call the method for decrypting the column. The only thing that I need is to get the password used for encrypting the column and I think, this column will be decrypted.

Thanks again,

Seyed
1 best response

Accepted Solutions
best response confirmed by Seyed1 (Copper Contributor)
Solution

@Seyed1 , you can try to find a way to implement the algorythm in plain T-SQL (I doubt it) or you use the SQL Server CLR integration with the RijndaelManaged Class.

See Overview of CLR Integration - SQL Server | Microsoft Learn

 

No matter which way you go, you have to implement it on your own.

 

Olaf

View solution in original post