I want to encrypt a few columns containing personal information is my database (mysql). I want that to be internal to mysql and not in php, so I can still query it if needed (even if decrypting on the fly makes it slower), so I was planning to use AESENCRYPT and AESDECRYPT.
Nothing crazy so far, taht's fairly standard, my question is how to make my models manage that ? I'd like the models to automatically build queries (select + insert + update) managing the encryption for me.
For example: instead of executing:
SELECT myEncryptedColumn FROM myTable; --> SELECT AES_DECRYPT(myEncryptedColumn, "myKey") FROM myTable ; INSERT INTO myTable (myEncryptedColumn) VALUES (value); --> INSERT INTO myTable (myEncryptedColumn) VALUES (AES_ENCRYPT(value, "myKey"));
Is there anything in phalcon for that, or do I have to overwrite all the models methods myself ? Cheers