this is the scenario I’m trying to figure out.
I have a table named users having the following columns,
id
user_name
email --encrypted
phone --encrypted
password --encrypted
created_at
updated_at
What I want to achieve is this, suppose if I ran DQL command that is SELECT so it should automatically decrypt the data in those columns like
SELECT email FROM users; // this should give the decrypted email value
SELECT * FROM users; // this should give the decrypted email, phone and password value
What I want to achieve is this, suppose if I ran DML command that is insert, update so it should automatically encrypt the data and then insert or update in those columns like
INSERT INTO users (user_name,email,phone,password) VALUES ('test','[email protected]','1234123412','password'); // this should encrypt email, password, phone before inserting automatically.
I could do this from Server side scripting only, but the thing is the application is already created and changing the whole code for the column names will be a very time consuming task.
Any help is appreciated.