dimanche 1 avril 2018

Querying Encrypted Model Data in Laravel

A requirement of an application I am making is that all user data (emails, addresses, date of birth, etc...) be encrypted. So, I use a trait like the one found here. This, however, brings up an issue when querying the data like below.

$user = User::where(“email”, “=“, $email);

Since I am searching encrypted data, the above query will not work as intended.

A rather naive solution I thought of is to decrypt the entire dataset before querying like so

$data = User::all();
$cnt = count($data)
for($i=0; $i<$cnt; $i++){// decrypt record i}

But this is very impractical and expensive. Is there a better solution to this problem?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2uHxpIe
via IFTTT

Aucun commentaire:

Enregistrer un commentaire