c# - Sql types and encrypted size -


i introducing symmetric key encription on dynamically generated sql server 2012 tables.

i expect store:

  1. varchar(x)
  2. integers
  3. date time
  4. boolean

i create key using

create symmetric key mykey     algorithm = aes_256     encryption certificate mycertificate go 

i insert data using i.e.

insert securetable(value) values (encryptbykey(@ui, convert(varbinary(max), 12345))) 

the result like:

0x0022377e67eff34daaad0f812153593d01000000c867c6f2085d3850bf1f50275945cfea90297c51d537e8c443b5f34050b325e0

how can size target columns? using varbinary(max) doesn't feel right!

i'm looking like:

  • int => varbinary(32)
  • varchar(x) => varbinary(y)
  • boolean => varbinary(10)
  • datatime => ...

as suggested @joe enos tryed encrypt several data types. empiric result:

  • integer: takes 52 bytes
  • varchar(x): takes x+45 x+65 bytes
  • float: 68 bytes
  • decimal(30,12): 68 bytes
  • datetime: 68 bytes
  • bit: 52 bytes

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -