PHPackages                             sidus/encryption-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. sidus/encryption-bundle

ActiveSymfony-bundle[Security](/categories/security)

sidus/encryption-bundle
=======================

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

v1.0.2(6y ago)21.2k4MITPHPPHP &gt;=7.2

Since Nov 13Pushed 5y ago1 watchersCompare

[ Source](https://github.com/VincentChalnot/SidusEncryptionBundle)[ Packagist](https://packagist.org/packages/sidus/encryption-bundle)[ RSS](/packages/sidus-encryption-bundle/feed)WikiDiscussions v1.0-dev Synced 2mo ago

READMEChangelogDependencies (1)Versions (11)Used By (0)

Sidus/EncryptionBundle
======================

[](#sidusencryptionbundle)

Easy entity and file encryption for Symfony2.

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.

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

- 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.

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.

Helpers
-------

[](#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.

Installation
------------

[](#installation)

You just require the package `sidus/encryption-bundle` either directly in your composer.json or by command line :

```
$ composer require sidus/encryption-bundle ~0.1.0

```

Update your `AppKernel.php`

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

    ...
}

```

Implements the interfaces
-------------------------

[](#implements-the-interfaces)

You should implements the UserEncryptionProviderInterface on your user entity and the CryptableInterface on each entity that will contains encrypted data.

Don't forget to update the model, the encryptedCipherKey must be persisted to the database !

Configuration
-------------

[](#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.

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

```
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.

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.

Apache License
--------------

[](#apache-license)

@todo

Authors
-------

[](#authors)

The bundle was originally created by [Vincent Chalnot](https://github.com/VincentChalnot).

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 80% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~212 days

Total

8

Last Release

2347d ago

Major Versions

v0.2.3 → v1.0.02018-11-12

PHP version history (2 changes)v0.1.0PHP &gt;=5.3.3

v1.0.0PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/0d58f1d81808beea6dab7aec03b0268082fe12bf46c852f14d98d7b900ea1304?d=identicon)[VincentChalnot](/maintainers/VincentChalnot)

---

Top Contributors

[![VincentChalnot](https://avatars.githubusercontent.com/u/1535893?v=4)](https://github.com/VincentChalnot "VincentChalnot (4 commits)")[![roincent](https://avatars.githubusercontent.com/u/6852155?v=4)](https://github.com/roincent "roincent (1 commits)")

---

Tags

encryptionmcrypt

### Embed Badge

![Health badge](/badges/sidus-encryption-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/sidus-encryption-bundle/health.svg)](https://phpackages.com/packages/sidus-encryption-bundle)
```

###  Alternatives

[phpseclib/phpseclib

PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.

5.6k434.8M1.3k](/packages/phpseclib-phpseclib)[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[nzo/url-encryptor-bundle

The NzoUrlEncryptorBundle is a Symfony Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

961.0M2](/packages/nzo-url-encryptor-bundle)[chuyskywalker/phpaes

PHP AES -- Accurate &amp; Fast AES in PHP

356.1k](/packages/chuyskywalker-phpaes)[thomaswelton/laravel-mcrypt-faker

Allows installation of Laravel where the PHP Mcrypt extension is not available. Provides encryption using OpenSSL, or by disabling encryption entierly.

113.8k](/packages/thomaswelton-laravel-mcrypt-faker)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
