Encrypting array type fields
cadavre opened this issue ยท 7 comments
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! :)
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.
Ok, will wait with unencrypted data for now. Ping please when it's done. ๐
If you could give some clues, I can make a PR.
Any news?
Any update on this? We're really looking forward to have this implemented.
If you're not planning to implement, can you just point out the process to do it? I'll fork and PR.
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.