2017 © Pedro Peláez
 

library doctrine-encrypt-bundle

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm, this fork make use of open ssl

image

combodo/doctrine-encrypt-bundle

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm, this fork make use of open ssl

  • Friday, March 17, 2017
  • by brunocombodo
  • Repository
  • 3 Watchers
  • 7 Stars
  • 12,975 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 118 Forks
  • 0 Open issues
  • 32 Versions
  • 13 % Grown

The README.md

DoctrineEncryptBundle version 3.0

Bundle allows to create doctrine entities with fields that will be protected with help of some encryption algorithm in database and it will be clearly for developer, because bundle is uses doctrine life cycle events, (*1)

This is an fork from the original bundle created by vmelnik-ukrain (Many thanks to him) which can be found here: vmelnik-ukraine/DoctrineEncryptBundle this is again a fork from the bundle nepda/doctrine-encrypt from Marcel van Nuil., (*2)

goal of this fork

My main goal is to improve the Encryptor : multiple existed but they where base on mcrypt and had flaws. I replaced them with an openssl alternative, found partly from this fork (again!) : https://github.com/nepda/doctrine-encrypt/blob/master/src/DoctrineEncrypt/Encryptors/OpenSslEncryptor.php If the author accept to merge my change, I will probably close this fork., (*3)

I also borrowed the "SensitiveValue" and "Mask" class from the great payum library in order to prevent the secret key to be printed (for more information, see payum doc)., (*4)

I added a twig extension in case of the need to decode the data only on display. (need additional work to be fully satisfying, like optionally do ont decode in the entity), (*5)

The encryptor also throw verbose errors and handle a simple integrity check (the length of the data is stored with the data in a json string, and is verified on the decrypt side)., (*6)

scope of this fork

The rest of this file anf of the doc will probably remain the forked content. Exept for the namespaces and the authors list that I changed (the search & replace way)., (*7)

What does it do exactly

It gives you the opportunity to add the @Encrypt annotation above each string property, (*8)


/** * @var string * @ORM\Column(name="host", type="string", length=255) * @Encrypted */ private $host; /** @var string store the decryptedVersion of $host */ private $hostDecrypted; /** * Set host * * You MUST assign null to the decryped var * * * @param string $host * * @return ItopUser */ public function setHost($host) { $this->host = $host; $this->hostDecrypted = null;//mandatory if you want your host to be encoded again! return $this; } /** * Get host * * You MUST return the decryped var if it is set * * @return string */ public function getHost() { if (!empty($this->hostDecrypted)) { return $this->hostDecrypted; } return $this->host; } /** * INTERNAL * Set hostDecrypted * * @param string $host * * @return ItopUser */ public function setHostDecrypted($hostDecrypted) { $this->hostDecrypted = $hostDecrypted; return $this; } /** * INTERNAL * Get hostDecrypted * * @return string */ public function getHostDecrypted() { return $this->hostDecrypted; }

The bundle uses doctrine his life cycle events to encrypt the data when inserted into the database and decrypt the data when loaded into your entity manager. It is only able to encrypt string values at the moment, numbers and other fields will be added later on in development. You NEED to add the *Decrypt field, it MUST not be persisted, the gettter/setter MUST exists and have standard names, the getter/setter of the encrypted propterties must follow the pattern above, (*9)

this verstion 3.0 drop support from many functionnalities of the 2.0 :

many unused features was removed for the sake of performance and readability : - EmbeddedAnnotation are no more supported (I don't ever know what it is so... if you'r curious, google for Doctrine\ORM\Mapping\Embedded) - the annotation only mode is no more tested, use it knowing the risk ;), (*10)

an almost total rework of the event listener has been done, it now use a cache for most of the time consuming operations and listen to many less events. It do no more need an update on each flush., (*11)

Advantages and disadvantaged of an encrypted database

Advantages

  • Information is stored safely
  • Not worrying about saving backups at other locations
  • Unreadable for employees managing the database

Disadvantages

  • Can't use ORDER BY on encrypted data
  • In SELECT WHERE statements the where values also have to be encrypted
  • When you lose your key you lose your data (Make a backup of the key on a safe location)

Documentation

This bundle is responsible for encryption/decryption of the data in your database. All encryption/decryption work on the PHP's server side., (*12)

The following documents are available:, (*13)

License

This bundle is under the MIT license. See the complete license in the bundle, (*14)

Versions

I'm using Semantic Versioning like described here, (*15)

The Versions

17/03 2017

dev-master

9999999-dev

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm, this fork make use of open ssl

  Sources   Download

MIT

The Requires

 

by Victor Melnik
by Bruno DA SILVA

bundle doctrine symfony encrypt aes256 decrypt openssl

17/03 2017

3.0.4

3.0.4.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm, this fork make use of open ssl

  Sources   Download

MIT

The Requires

 

by Victor Melnik
by Bruno DA SILVA

bundle doctrine symfony encrypt aes256 decrypt openssl

17/03 2017

3.0.2

3.0.2.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm, this fork make use of open ssl

  Sources   Download

MIT

The Requires

 

by Victor Melnik
by Bruno DA SILVA

bundle doctrine symfony encrypt aes256 decrypt openssl

17/03 2017

3.0.3

3.0.3.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm, this fork make use of open ssl

  Sources   Download

MIT

The Requires

 

by Victor Melnik
by Bruno DA SILVA

bundle doctrine symfony encrypt aes256 decrypt openssl

17/03 2017

3.0.1

3.0.1.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm, this fork make use of open ssl

  Sources   Download

MIT

The Requires

 

by Victor Melnik
by Bruno DA SILVA

bundle doctrine symfony encrypt aes256 decrypt openssl

17/03 2017

3.0

3.0.0.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm, this fork make use of open ssl

  Sources   Download

MIT

The Requires

 

by Victor Melnik
by Bruno DA SILVA

bundle doctrine symfony encrypt aes256 decrypt openssl

06/02 2017

v2.6.5.3

2.6.5.3

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm, this fork make use of open ssl

  Sources   Download

MIT

The Requires

 

by Victor Melnik
by Bruno DA SILVA

bundle doctrine symfony encrypt aes256 decrypt openssl

03/02 2017

v2.6.5.2

2.6.5.2

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm, this fork make use of open ssl

  Sources   Download

MIT

The Requires

 

by Victor Melnik
by Bruno DA SILVA

bundle doctrine symfony encrypt aes256 decrypt openssl

03/02 2017

v2.6.5.1

2.6.5.1

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm, this fork make use of open ssl

  Sources   Download

MIT

The Requires

 

by Victor Melnik
by Bruno DA SILVA

bundle doctrine symfony encrypt aes256 decrypt openssl

03/02 2017

v2.6.5

2.6.5.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm, this fork make use of open ssl

  Sources   Download

MIT

The Requires

 

by Victor Melnik
by Bruno DA SILVA

bundle doctrine symfony encrypt aes256 decrypt openssl

03/02 2017

v2.6.4

2.6.4.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm, this fork make use of open ssl

  Sources   Download

MIT

The Requires

 

by Victor Melnik
by Bruno DA SILVA

bundle doctrine symfony encrypt aes256 decrypt openssl

03/02 2017

v2.6.3

2.6.3.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm, this fork make use of open ssl

  Sources   Download

MIT

The Requires

 

by Victor Melnik
by Bruno DA SILVA

bundle doctrine symfony encrypt aes256 decrypt openssl

02/02 2017

v2.6.2

2.6.2.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm, this fork make use of open ssl

  Sources   Download

MIT

The Requires

 

by Victor Melnik
by Bruno DA SILVA

bundle doctrine symfony encrypt aes256 decrypt openssl

02/02 2017

v2.6.1

2.6.1.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm, this fork make use of open ssl

  Sources   Download

MIT

The Requires

 

by Victor Melnik
by Bruno DA SILVA

bundle doctrine symfony encrypt aes256 decrypt openssl

02/02 2017

v2.6

2.6.0.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm, this fork make use of open ssl

  Sources   Download

MIT

The Requires

 

by Victor Melnik
by Bruno DA SILVA

bundle doctrine symfony encrypt aes256 decrypt openssl

30/09 2016

2.5.4

2.5.4.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm

  Sources   Download

MIT

The Requires

 

by Marcel van Nuil

doctrine symfony encrypt aes256 decrypt rijndael

20/09 2016

2.5.3

2.5.3.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm

  Sources   Download

MIT

The Requires

 

by Marcel van Nuil

doctrine symfony encrypt aes256 decrypt rijndael

04/04 2016

2.5.2

2.5.2.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm

  Sources   Download

MIT

The Requires

 

by Marcel van Nuil

doctrine symfony encrypt aes256 decrypt rijndael

08/02 2016

v2.5.1

2.5.1.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm

  Sources   Download

MIT

The Requires

 

by Marcel van Nuil

doctrine symfony encrypt aes256 decrypt rijndael

08/02 2016

v2.5

2.5.0.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm

  Sources   Download

MIT

The Requires

 

by Marcel van Nuil

doctrine symfony encrypt aes256 decrypt rijndael

18/01 2016

v2.4.5

2.4.5.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm

  Sources   Download

MIT

The Requires

 

by Marcel van Nuil

doctrine symfony encrypt aes256 decrypt rijndael

02/09 2015

v2.4.4

2.4.4.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm

  Sources   Download

MIT

The Requires

 

by Marcel van Nuil

doctrine symfony encrypt aes256 decrypt rijndael

03/08 2015

2.4.3

2.4.3.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm

  Sources   Download

MIT

The Requires

 

by Marcel van Nuil

doctrine symfony encrypt aes256 decrypt rijndael

23/06 2015

v2.4.2

2.4.2.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm

  Sources   Download

MIT

The Requires

 

by Marcel van Nuil

doctrine symfony encrypt aes256 decrypt rijndael

24/04 2015

2.4.1

2.4.1.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm

  Sources   Download

MIT

The Requires

 

by Marcel van Nuil

doctrine symfony encrypt aes256 decrypt rijndael

16/04 2015

2.4

2.4.0.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm

  Sources   Download

MIT

The Requires

 

by Marcel van Nuil

doctrine symfony encrypt aes256 decrypt

08/04 2015

v2.2

2.2.0.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm

  Sources   Download

MIT

The Requires

 

by Marcel van Nuil

doctrine symfony encrypt aes256 decrypt

12/03 2015

2.1.1

2.1.1.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm

  Sources   Download

MIT

The Requires

 

by Victor Melnik
by Marcel van Nuil

doctrine symfony encrypt aes256 decrypt

11/03 2015

v2.1

2.1.0.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm

  Sources   Download

MIT

The Requires

 

by Victor Melnik
by Marcel van Nuil

doctrine symfony encrypt aes256 decrypt

05/01 2013

2.0.1

2.0.1.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm

  Sources   Download

MIT

The Requires

 

by Victor Melnik

doctrine encrypt aes256 decrypt

17/11 2012

2.0.0

2.0.0.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm

  Sources   Download

MIT

The Requires

 

by Victor Melnik

doctrine encrypt aes256 decrypt

14/11 2012

1.0.0

1.0.0.0

Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm

  Sources   Download

MIT

The Requires

 

by Victor Melnik

doctrine encrypt aes256 decrypt