I have following problem. I would like to provide to my STP encrypted data and decrypt them inside it. To decrypt the data I'd like to use DecryptByKey. Encryption should be made on the Win32/.NET client.
Unfortunately I cannot find the way to make the data understable between the both worlds. First how to assign the same key on the both side? Do I get the same key from
Code Snippet
create symmetric key MyKey with
algorithm=triple_des,
key_source='abrakadabra'
encryption by password='aaa'
and from
Code Snippet
string Key = "abrakadabra";
byte[] bKey = Encoding.ASCII.GetBytes(Key);
byte[] salt = new byte[8];
RNGCryptoServiceProvider rnd = new RNGCryptoServiceProvider();
rnd.GetBytes(salt);
PasswordDeriveBytes pdb = new PasswordDeriveBytes(bKey, salt);
TripleDESCryptoServiceProvider prov = new TripleDESCryptoServiceProvider();
prov.GenerateIV();
prov.Key = pdb.CryptDeriveKey("TripleDES", "SHA1", 168, prov.IV);
?
I have read somewhere that create symmetric key calls CryptDeriveKey, but I'm not sure.
The next point is the format of the output data. I have noted, that the output from EncryptByKey is 16 bytes longer (after stripping key guid and fixed 0x01000000) than the one from Win32/.NET application. I assume, that it can lie in the inserting of IV as the first block, but should not IV be only 64 bit long in the DES family of algorithms?
Neverthless I have not magaged to perform encrypted communication such way between SQL Server 2005 and client application. Is it possible at all?
The short answer: this scenario is not supported in SQL Server 2005 (for more details I recommend taking a look to this other thread: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1529101&SiteID=1).
But I want to let you know that we are listening to your feedback regarding cross-application encryption, and that we really appreciate your questions and comments on it.
Thanks a lot for your feedback and comments,
-Raul Garcia
SDE/T
SQL Server Engine
No comments:
Post a Comment