问题原文
原帖链接 · TJ Shah · CC BY-SA 3.0
I know I can encrypt particular fields of a database, but I'm interested in encrypting every field of the database. I want to make sure no one who gains access to a mysql shell but who does not have access to a decryption key cannot read anything out of the database at all.
I also want to make sure that if someone got root access to the machine, but didn't have a decryption key, they couldn't read the data.
How should I do this? Does it make sense to do? I'm concerned if someone has access to the mysql database they inevitably will have access to the key, so this makes no sense. Am I missing something?
社区高分解答
原帖链接 · GioMac · CC BY-SA 3.0
Minimal, field-level AES and DES encryption is available: https://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html#function_encrypt
Noone can read data without specifying key for every query (or without adding it to the triggers/procedures).
example:
INSERT:
INSERT INTO users (username, password) VALUES ('root', AES_ENCRYPT('somepassword', 'key12346123'));
and SELECT:
SELECT AES_DECRYPT(password, 'key12346123') FROM users WHERE username = 'root';
Also, this requires SSL connection to the database.
And on lower level - you can encrypt filesystem too.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
