Hello everybody,
i would like save encrypted data in a mysql database. is there any way to activate this in a yii data model? That i can use $model->save() to save the data or must i do this with query builder?
Thanks for inspirations…
Hello everybody,
i would like save encrypted data in a mysql database. is there any way to activate this in a yii data model? That i can use $model->save() to save the data or must i do this with query builder?
Thanks for inspirations…
Hi.
You can do it in many ways:
Hi BartQ76,
you meen something like
INSERT INTO your_table (username,email) VALUES ('$username', AES_ENCRYPT('$email','".SALT."'));
But then i can’t use $model->save(), right? Then i must create a mysql statement with the query builder function, right?
No. I rather think of https://www.mysql.com/products/enterprise/tde.html
Data is encrypted automatically, in real time, prior to writing to storage and decrypted when read from storage.
We don’t use the mysql enterprise edition. So i must find another way. Thank you for your suggestion.
Hello, i think what youre looking for probably have something to do with Yii’s security class. Try and check out
Yii::$app->security->(the functions on the class here);
depending on your usage of what youre trying to encrypt, most of the encryption is here.