dev-master
9999999-dev https://github.com/davidterranova/dterranovaCryptoBundledterranovaCryptoBundle
MIT
The Requires
- php >=5.3.0
- symfony/framework-bundle >=2.0
file encryption memory constant
dterranovaCryptoBundle
This bundle provide file encryption with AES-256 Cipher The amount of memory used is independant of the file you encrypt., (*1)
The original file is read by the chunk_file_size
and the encryption is done on this amount of data
A folder is created in the temp_folder
with the name of the original encrypted file
Each encrypted part are written in this folder, (*2)
By passing the original file name to the decryptFile
method, the cryptoBundle use the corresponding folder with encrypted parts of the file to rebuild the original file, (*3)
``` json { "require": { ... "dterranova/crypto-bundle": "dev-master" } ... }, (*4)
- Update your vendors `php composer.phar update` - Add to your AppKernel ``` php // app/AppKernel.php public function registerBundles() { return array( // ... new dterranova\Bundle\CryptoBundle\dterranovaCryptoBundle(), // ... ); }
app/config/config.yml
``` yml, (*5)
dterranova_crypto: temp_folder: "%kernel.root_dir%/../web/YOUR_TEMP_FOLDER" chunk_file_size: 2 # The size (in Mb) of chunked files, more it is big more it will consume memory, (*6)
## Usage - Encrypt a file ``` php $cryto = $this->get("dterranova_crypto.crypto_adapter"); $crypto->encryptFile(ABSOLUTE_FILE_PATH, KEY);
php
$cryto = $this->get("dterranova_crypto.crypto_adapter");
$crypto->decryptFile(ABSOLUTE_FILE_PATH, KEY, true); // The same absolute file path
dterranovaCryptoBundle
MIT
file encryption memory constant