Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encrypting array type fields #12

Open
cadavre opened this issue Apr 14, 2016 · 7 comments
Open

Encrypting array type fields #12

cadavre opened this issue Apr 14, 2016 · 7 comments
Assignees

Comments

@cadavre
Copy link

cadavre commented Apr 14, 2016

class File
{

    /**
     * @var array
     *
     * @Encrypted()
     * @ORM\Column(name="content", type="array")
     */
    private $content;

    // ...

Encryption is made before serialization was performed over content of the array.
With this, I get error:
Ambta/DoctrineEncryptBundle/Subscribers/DoctrineEncryptSubscriber.php at line 286

283.                                }
284.                            } else {
285.                                if(!is_null($getInformation) and !empty($getInformation)) {
286.                                    if(substr($entity->$getter(), -5) != "<ENC>") {
287.                                        $this->encryptCounter++;
288.                                        $currentPropValue = $this->encryptor->encrypt($entity->$getter());
289.                                        $entity->$setter($currentPropValue);

Deeper trace with above example and two serializable objects in above array:
at substr (array(object(FileContent), object(FileContent)), '-5')

As far as I can see – encryption code is iterating over entity before the serialization was done – so all this goes through array instead of string (serialized).

Any quick fix to do or bug fix from you?

Final word: thank you so much for such a great lib! :)

@ambta
Copy link
Owner

ambta commented Apr 14, 2016

We currently do not support arrays yet, but it is quit easy to add this support.
We will add this in the next version, that will come within 4 weeks.

@cadavre
Copy link
Author

cadavre commented Apr 14, 2016

Ok, will wait with unencrypted data for now. Ping please when it's done. 👍

@cadavre
Copy link
Author

cadavre commented Apr 22, 2016

If you could give some clues, I can make a PR.

@cadavre
Copy link
Author

cadavre commented May 5, 2016

Any news?

@pbudzon
Copy link

pbudzon commented Jun 16, 2016

Any update on this? We're really looking forward to have this implemented.

@cadavre
Copy link
Author

cadavre commented Jul 28, 2016

If you're not planning to implement, can you just point out the process to do it? I'll fork and PR.

@PH-Lars
Copy link
Collaborator

PH-Lars commented Aug 1, 2016

Hello Cadavre,

We would love to work on this feature but we have been, and still are, overloaded with work at the moment. We just did not find the time to work on this feature yet.

If you have time, feel free to fork and send in a pull request. If not, I'm afraid you have to wait untill we can afford to work on this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants