elocryptfive | Automatically encrypt and decrypt Laravel 5 Eloquent values | Encryption library
kandi X-RAY | elocryptfive Summary
kandi X-RAY | elocryptfive Summary
Encrypted values are usually longer than plain text values. Sometimes much longer. You may find that the column widths in your database tables need to be extended to store the encrypted values. If you are encrypting long strings such as JSON blobs then the encrypted values may be longer than a VARCHAR field can support, and you may need to extend your column types to TEXT or LONGTEXT.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Execute the command
- Decrypt attribute .
- Encrypt an attribute .
- Decrypt attributes .
- Setup the keys .
- Determine if the given key should be encrypted .
- Bootstrap config .
- Decrypt attribute .
- Check if value is encrypted
- Register plugin .
elocryptfive Key Features
elocryptfive Examples and Code Snippets
Community Discussions
Trending Discussions on elocryptfive
QUESTION
I have a laravel 5.4 installation and I always used the default Laravel Authentication guard to handle user authentication and, mainly, the password restore process.
Now I had to encrypt the email in the users
table using the Elocryptfive library, so I also added email_hash
field where the hash of the mail is stored in the db in order to easily retrieve users by their email.
I can easily authenticate users using the hash:
...ANSWER
Answered 2018-May-17 at 13:39I found a way to achieve this. I will answer my own question to provide a useful solution if someone else needs some help on the topic:
In your ForgotPasswordController.php
, override the sendResetLinkEmail
function:
QUESTION
I'm using elocryptfive for encrypting some fields in database - in a nutshell it's a PHP trait that encrypts attributes marked as encryptable before they are written into database and decrypts them when showing them to user (with getAttribute
and other such methods).
Simpler version of it can be found in this laracasts discussion.
There weren't any problems when using Laravel versions earlier than 5.5. After upgrading the site to laravel 5.5 I've noticed that values that were supposed to be encrypted, were instead presented in plaintext.
I've filed issue in package github account, asking for help. In the meantime I've tried few things:
- added elocryptfive package in freshly installed laravel 5.2 and 5.4 - encryption worked correctly
- did the same in stock laravel 5.5 - the values were encrypted only after first save, and stored decrypted after every subsequent update
- I haven't found anything related in forums/laracasts yet
It seems that it could be related to some changes between 5.4 and 5.5, I've already tried comparing few classes in Eloquent
namespace but gave up.
ANSWER
Answered 2017-Sep-20 at 10:00After comparing once again the changes between 5.4 and 5.5 tags in laravel/framework package I found out the reason in getDirty
method of
src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php
trait.
In laravel 5.4 there was:
foreach ($this->attributes as ...
then in 5.5 it was changed to:
foreach ($this->getAttributes() as ...
As getAttributes
method is one of those which decrypt data, it looks that for now the most sensible solution will be to override getDirty()
either in encrypting trait or in application models using it.
The modified method would look like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install elocryptfive
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page