定制 dterranova/crypto-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dterranova/crypto-bundle

Composer 安装命令:

composer require dterranova/crypto-bundle

包简介

dterranovaCryptoBundle

README 文档

README

This bundle provide file encryption with AES-256 Cipher The amount of memory used is independant of the file you encrypt.

Workflow

Encryption

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

Decryption

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

Installation

  • Add to your composer file
{
    "require": {
        ...
        "dterranova/crypto-bundle": "dev-master"
    }
    ...
}
  • Update your vendors php composer.phar update

  • Add to your AppKernel

    // app/AppKernel.php
    public function registerBundles()
    {
        return array(
            // ...
            new dterranova\Bundle\CryptoBundle\dterranovaCryptoBundle(),
            // ...
        );
    }
  • Add to your app/config/config.yml
# app/config/config.yml
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 

Usage

  • Encrypt a file
$cryto = $this->get("dterranova_crypto.crypto_adapter");
$crypto->encryptFile(ABSOLUTE_FILE_PATH, KEY);
  • Decrypt a file
$cryto = $this->get("dterranova_crypto.crypto_adapter");
$crypto->decryptFile(ABSOLUTE_FILE_PATH, KEY, true);  // The same absolute file path

统计信息

  • 总下载量: 305
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2012-12-16