Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Can I encrypt ntext and nvarchar(max) columns ? Expand / Collapse
Author
Message
Posted Tuesday, June 17, 2008 4:38 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, August 19, 2014 2:12 AM
Points: 193, Visits: 552
Hello, I just want to know :

can I encrypt ntext and nvarchar(max) columns in SQL 2005, using AES 128 ?
Post #518107
Posted Tuesday, June 17, 2008 11:00 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, September 15, 2014 5:20 PM
Points: 1,276, Visits: 1,134
The symmetric key encryption functions max out at 8,000 bytes returned. With SQL Server metadata and AES block size this means you can encrypt slightly less bytes than that in one shot. About 7,950+ bytes or so. You can encrypt in groups of 7,950 bytes and append all of the groups together. Then you'll also need a routine to decrypt the blocks and append the results of decryption together to reassemble your source document.
Post #518744
Posted Wednesday, June 18, 2008 12:08 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, August 19, 2014 2:12 AM
Points: 193, Visits: 552
Thanks,

but are there any Web sites or documents which tell me how to append the encrypted data chunk together ?
Post #518765
Posted Wednesday, June 18, 2008 8:31 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, September 15, 2014 5:20 PM
Points: 1,276, Visits: 1,134
The encryption and decryption functions return a varbinary(8000). Just use the + append operator and a WHILE loop. There are a few blogs worth checking out, especially the first one - it has an LOB encryption/decryption example:

http://blogs.msdn.com/yukondoit/archive/2005/11/24/496521.aspx
http://blogs.msdn.com/raulga/
http://blogs.msdn.com/sqlsecurity/
Post #519105
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse