开发者

encryption of database fields across entire row, including bools

开发者 https://www.devze.com 2023-02-21 05:09 出处:网络
I\'ve a database table for a website in which all of the fields are sensitive data. Each row will belong to different users (of the service, not database users). Usually, I\'d implement this by genera

I've a database table for a website in which all of the fields are sensitive data. Each row will belong to different users (of the service, not database users). Usually, I'd implement this by generating an encryption key for each row, encrypting the data in the client app, and then storing the data in binary fields. Each row would开发者_开发百科 also have the encryption key stored in it, and this key would be encrypted by the application's own encryption key.

The unencrypted table schema includes some boolean fields and integers. I'm wondering if encrypting such small values will lead to possible cracking opportunities? I'd also be interested to here if anyone has a better idea on how to do this.


The plan is currently to use MySQL, but Postgres is a possibility. The app is a web site, with connections encrypted to and from the app to the browser, and https from the app to the client.


Just a quick note about choosing the answer, since several of the answers may be correct I chose @Jack's because not only will it work, but I found it an interesting suggestion in a direction I'd not considered. I really appreciate all the input, thanks.


There are third party encryption solutions for MySQL that might do the trick. Check out Gazzang, Vormetric, or Packet General. They all claim to have transparent data encryption for MySQL.


It is perfectly possible and secure to encrypt a boolean as long as you are using a large enough salt.

Of course storage requirements go up dramatically, but that is just the price of entry here for the security you are asking for, rather than a 'problem'


I want to chime in and say that booleans can absolutely be encrypted. Statistically, (in their encrypted state) half the time they will be true and half the time they will be false. While some of the time it will match the current value and some of the time it will not, one has no way of knowing.

This assumes initialization of the cipher is good and is different for each row, but that is a requirement for any text field as well to prevent them from being open to easy cryptanalysis.


I think it is not possible to actually encrypt things like boolean, because boolean only have two possible values: true, false, people can guess the value in limited time. it might be better to encrypt the entire record.

0

精彩评论

暂无评论...
验证码 换一张
取 消