Wednesday, March 21, 2012

Encrypting non text data

I want to encrypt some audio files before inserting them in a SQL server database. I want to use the built in sql server encryption. I found that the encrypt by key function accepts only text (nchar,nvarchar,etc).
I was thinking or reading the audio file's bytes and change them to a string and then insert them in the database. I just wanted to take opinions here. Is there a better way to do this?
thanks in advance

Actually, the encryption functions are really designed for binary data, but we accept text variables directly for usability reasons.

Unfortunately you will hit a different problem because of a design limitation on our current implementation: the output cannot be greater than 8k, therefore the plaintext has to be < 8K.

I wrote an article describing the data length limitations and a TSQL-based workaround (http://blogs.msdn.com/yukondoit/archive/2005/11/24/496521.aspx), but the workaround proposed in this article has some limitations itself. I would also suggest considering using a CLR module to encrypt/decrypt large BLOBs.

I hope this information will be useful. We appreciate your feedback on this area.

Thanks a lot,

-Raul Garcia

SDE/T

SQL Server Engine

No comments:

Post a Comment