2017 © Pedro Peláez
 

symfony-bundle kit-crypt-bundle

Symfony Crypt Bundle

image

kitlabs/kit-crypt-bundle

Symfony Crypt Bundle

  • Friday, September 29, 2017
  • by kitlabs
  • Repository
  • 2 Watchers
  • 4 Stars
  • 29 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 12 % Grown

The README.md

KitCryptBundle

Symfony Crypt Bundle(use openssl), (*1)

Installation

### Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*2)

$ composer require kitlabs/kit-crypt-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*3)

### Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project: ``` php <?php // app/AppKernel.php, (*4)

// ... class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ..., (*5)

        new Kit\CryptBundle\KitCryptBundle(),
    );

    // ...
}

// ...

}, (*6)

### Setp 3: config 
``` yaml
# app/config/config.yml
kit_crypt:
    clients:
        default:
            method: 'aes-256-cbc'
            secret_key: 'Kit@Crypt!Bundle'
            secret_iv: '12345!@#$%^67890' #16 bit
            option: 0 # 0默认值;OPENSSL_RAW_DATA = 1,采用PKCS7填充;OPENSSL_ZERO_PADDING = 2,采用0填充; OPENSSL_NO_PADDING = 3,不填充
        data_api:# client name,可以是多个
            method: 'des-cbc'
            secret_key: 'Kit@Crypt!Bundle'
            secret_iv: 'q1w2e3r4'
            option: 1

PS:params, (*7)

  • method list openssl cipher methods
  • secret_iv iv encrypt method AES-256-CBC expects 16 bytes - else you will get a warning

Usage

php /** * * @var \Kit\CryptBundle\Service\OpensslService $opensslService */ $opensslService = $this->get('kit_crypt.openssl'); $encrypt = $opensslService->encrypt('lcp0578', 'data_api'); //public function encrypt($string, $name = 'default', $iv = null) dump($encrypt); dump($opensslService->decrypt($encrypt, 'data_api')); //public function decrypt($string, $name = 'default', $iv = null) function cryptoJsAesDecrypt($passphrase, $ct, $iv, $s) function cryptoJsAesEncrypt($passphrase, $value), (*8)

The Versions

29/09 2017

dev-master

9999999-dev https://github.com/kitlabs-cn/KitCryptBundle

Symfony Crypt Bundle

  Sources   Download

MIT

The Requires

  • php >=5.5.9
  • ext-openssl *

 

aes des crypt bundle opnessl

29/09 2017

v0.1.2

0.1.2.0 https://github.com/kitlabs-cn/KitCryptBundle

Symfony Crypt Bundle

  Sources   Download

MIT

The Requires

  • php >=5.5.9
  • ext-openssl *

 

aes des crypt bundle opnessl

29/09 2017

v0.1.1

0.1.1.0 https://github.com/kitlabs-cn/KitCryptBundle

Symfony Crypt Bundle

  Sources   Download

MIT

The Requires

  • php >=5.5.9
  • ext-openssl *

 

aes des crypt bundle opnessl

29/09 2017

v0.1.0

0.1.0.0 https://github.com/kitlabs-cn/KitCryptBundle

Symfony Debug Command Bundle

  Sources   Download

MIT

The Requires

  • php >=5.5.9
  • ext-openssl *

 

aes des crypt bundle opnessl