2017 © Pedro Peláez
 

symfony-bundle encryption-bundle

The EncryptionBundle allows you to store encrypted files and data in Doctrine's entity in a very simple way

image

sidus/encryption-bundle

The EncryptionBundle allows you to store encrypted files and data in Doctrine's entity in a very simple way

  • Tuesday, December 5, 2017
  • by VincentChalnot
  • Repository
  • 1 Watchers
  • 2 Stars
  • 291 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 12 % Grown

The README.md

Sidus/EncryptionBundle

Easy entity and file encryption for Symfony2., (*1)

We wanted to be able to store encrypted data in our Symfony2 applications and we realized that there were no simple way to do it., (*2)

In our solution, a malicious user will have a really hard time to steal data from our server., (*3)

  • The data will not be compromised by an SQL Injection or by a remote include attack.
  • If no end users are connected, no one can decrypt the data, not even the root user.
  • Only users from the same organization can share data between each other.

The idea is to store the cipher key inside the database in the user table but encrypted with the user's plaintext password. This way each user from the same organization can share the same cipher key to encrypt and decrypt data but each user can only decrypt it's own encrypted key at login time., (*4)

The main weakness of this system is that the cipher key is stored temporarly in PHP's session, however, the only way to overcome this problem would be to use a pretty complex asymmetric encryption system between the client and the server which could only be done properly using a rich client., (*5)

Helpers

This bundle comes with an EncryptionManager class which can be used in standalone to encrypt and decrypt data and files. There's also a DecryptFileResponse which allows you to directly stream an encrypted file to the client while deciphering it., (*6)

Installation

You just require the package sidus/encryption-bundle either directly in your composer.json or by command line :, (*7)

$ composer require sidus/encryption-bundle ~0.1.0

Update your AppKernel.php, (*8)

public function registerBundles()
{
    $bundles = array(
        ...
        new Sidus\EncryptionBundle\SidusEncryptionBundle(),
    );

    ...
}

Implements the interfaces

You should implements the UserEncryptionProviderInterface on your user entity and the CryptableInterface on each entity that will contains encrypted data., (*9)

Don't forget to update the model, the encryptedCipherKey must be persisted to the database !, (*10)

Configuration

If you need to share encrypted data between users you need to generate each encrypted cipher key with the same cipher key which can prove to be tricky, especially if users already have accounts and passwords., (*11)

If each user encrypts it's own data however, you can just use the automatic encryption key generation in your config.yml:, (*12)

sidus_encryption:
    encryption_key:
        auto_generate: false

This will tell the system to automatically generate a new encryption key if the user doesn't have any., (*13)

In case of password recovery, the user won't be able to retrieve any of the encrypted data because he would be the only one able to decrypt the cipher key., (*14)

Apache License

@todo, (*15)

Authors

The bundle was originally created by Vincent Chalnot., (*16)

The Versions

05/12 2017

dev-master

9999999-dev

The EncryptionBundle allows you to store encrypted files and data in Doctrine's entity in a very simple way

  Sources   Download

MIT

The Requires

 

encryption mcrypt

05/12 2017

v0.2.3

0.2.3.0

The EncryptionBundle allows you to store encrypted files and data in Doctrine's entity in a very simple way

  Sources   Download

MIT

The Requires

 

encryption mcrypt

27/07 2017

v0.2.2

0.2.2.0

The EncryptionBundle allows you to store encrypted files and data in Doctrine's entity in a very simple way

  Sources   Download

MIT

The Requires

 

encryption mcrypt

06/03 2017

v0.2.1

0.2.1.0

The EncryptionBundle allows you to store encrypted files and data in Doctrine's entity in a very simple way

  Sources   Download

MIT

The Requires

 

encryption mcrypt

03/03 2017

v0.2.0

0.2.0.0

The EncryptionBundle allows you to store encrypted files and data in Doctrine's entity in a very simple way

  Sources   Download

MIT

The Requires

 

encryption mcrypt

13/11 2015

v0.1.0

0.1.0.0

The EncryptionBundle allows you to store encrypted files and data in Doctrine's entity in a very simple way

  Sources   Download

MIT

The Requires

 

encryption mcrypt