I wnat to create a C# class to decrypt a byte array encrypted using T-SQL's EncryptByPassPhrase. (Yes, I know I could decrypt within SQL Server, but what I need is to be able to encrypt/decrypt within both the database tier and in the middle tier equivalently.)
I understand that SQL Server's EncryptByPassPhrase and DecryptByPassPhrase use the TripleDES symmetric key algorithm. It's not clear to me, though, what the IV should to simulate SQL Server's cryptology. I can encrypt/decrypt using the TripleDESCryptoServiceProvider class, but I can't find the correct implementation of key and IV to replicate what SQL Server is doing.
Has anyone done something similar? Thanks!
(1) Use C# to generate a key/iv pair: TripleDESCryptoServiceProvider cp = new TripleDESCryptoServiceProvider();
(2) Once we have that, use code like this to encode
(3) Then to decode: