I am introducing Symmetric Key encription on some dynamically generated Sql Server 2012 tables.
I expect to store:
I create the key using
CREATE SYMMETRIC KEY MyKey
WITH ALGORITHM = AES_256
ENCRYPTION BY CERTIFICATE MyCertificate
GO
I insert data using i.e.
insert into SecureTable(value) values (EncryptByKey(@ui, CONVERT(varbinary(max), 12345)))
The result is something like:
0x0022377E67EFF34DAAAD0F812153593D01000000C867C6F2085D3850BF1F50275945CFEA90297C51D537E8C443B5F34050B325E0
How can I effectively size the target columns? Using Always VARBINARY(MAX)
doesn't feel right!
I'm looking for something like:
As suggested by @Joe Enos I tryed to encrypt several data types. This is the empiric result: