Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two way DB encryption secure even from the Admin

I have an interesting encryption problem at hand. I do not know if it can be solved but here goes:

A database is to contain sensitive user information. As such, the user information must be encrypted (two way encryption). The user has a login / password and these may be used in the two way encryption. Now, the encryption is to be designed in such a way that even the administrator viewing the database tables should not be able to make sense of the user information.

However, the design has to take care of the cases where the user may forget her password. If the password is used for encryption, forgetting the password means the information is lost - not wanted. If the user password itself is stored in the database using a two way algorithm (instead of a one way hash) with a key hardcoded in the script, the administrator can discover the hardcoded key by looking at the script (the administrator of course has access to the script).

Does anybody know a way out of this?

PS: This is a real problem. My company is an absolute security fanatic (ISO 27001 and all) and I have been entrusted to design a system with the above mentioned functionality. By the way, I am using a PHP script and MySQL.

EDIT: Perhaps it was not clear earlier, the user needs to see / edit this user information on a day-to-day basis.

like image 705
KJ Saxena Avatar asked Jul 28 '09 07:07

KJ Saxena


1 Answers

What you want is a recovery agent. Encrypt all data twice: once with the user key, once with the recovery agent (public) key; atleast the latter one needs to be asymmetric. Keep the recovery agent key in a pyhsical safe, with a formal access protocol (e.g. four eyes principle). Usually, the administrator cannot access the encrypted data, but if the user loses the key, and recovery is authorized, then the recovery key is obtained.

There are also ways to encrypt the recovery agent's key so that m-out-of-n people have to agree to use it.

Edit: One implementation strategy is to encrypt everything twice. Alternatively, for each data set that needs to be recoverable independently, create a fresh symmetric key, and encrypt only that key twice; the original data get encrypted only with the session key. That approach can extend to multiple independent readers; it requires asymmetric keys per reader (so that you can encrypt the session key with the public keys of all readers - one being the recovery agent).

I copied the terminology from Microsoft's Encrypting File System, which has that scheme implemented.

like image 75
Martin v. Löwis Avatar answered Sep 30 '22 14:09

Martin v. Löwis