Reputation: 87
Please help me with the following task: We need to store all data in MySQL (important) encrypted (mostly int, float, double) so no one could read the raw data in the MySQL in case of hacking.
Project is built on PHP + MySQL (Yii framework)
Please advice any solution, preferably free one :)
Thanks!
Upvotes: 2
Views: 455
Reputation: 1455
You have to hard work about indexes, because encrypted data cannot be indexed so searching that row will not be easy.
I recommend Aes :
AES_ENCRYPT() and AES_DECRYPT() can be considered the most cryptographically secure encryption functions currently available in MySQL.
INSERT into user (first_name, address) VALUES (AES_ENCRYPT('Person', 'myword'),AES_ENCRYPT('Person', 'myword'));
SELECT AES_DECRYPT(first_name, 'myword'), AES_DECRYPT(address, 'myword') from user;
Aes Encrypt Explanation:
http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html#function_aes-encrypt
Aes Decrypt Explanation:
http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html#function_aes-decrypt
All Mysql Encryption and Compression Functions : http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html
This article is best about Mysql Database Security:
http://www.greensql.com/content/mysql-security-best-practices-hardening-mysql-tips
Upvotes: 2