locked
Encrypting in SQL Server 2008 & Decrypting in C# RRS feed

  • Question

  • Hi
    I have the Symmetric Key in SQL for encoding data(column) :

    USE TestDB
    CREATE SYMMETRIC KEY MySymmetricKey
        WITH
        KEY_SOURCE = 'key',
        IDENTITY_VALUE = 'idv',
        ALGORITHM = TRIPLE_DES
        ....

    and I encode data in SQL by SymmetricKey (because its performance is good) as:

    USE TestDB
    OPEN SYMMETRIC KEY MySymmetricKey
    UPDATE TestTable
    SET EncryptSecondCol = ENCRYPTBYKEY(KEY_GUID('MySymmetricKey'),SecondCol)
    CLOSE SYMMETRIC KEY MySymmetricKey

    I need to Decrypt the encrypted column in C#, BUT:
    1- How should I set "TripleDESCryptoServiceProvider" values and parameters like Key,IV,.....?
    2- If the Decryption process can not be done for TRIPLE_DES in C#, does other algorithms such as DES | TRIPLE_DES_3KEY | RC2 | RC4 | RC4_128 support such process(Encrypting in SQL Server 2008 & Decrypting in C# )? and How ?

    Thanks
    Tuesday, September 15, 2009 7:53 AM

Answers