kitlabs/kit-crypt-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

kitlabs/kit-crypt-bundle

最新稳定版本:v5.3.0

Composer 安装命令:

composer require kitlabs/kit-crypt-bundle

包简介

Symfony Crypt Bundle

README 文档

README

Symfony Crypt Bundle(use openssl)

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:

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

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
// app/AppKernel.php
 
// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
 
            new Kit\CryptBundle\KitCryptBundle(),
        );
 
        // ...
    }
 
    // ...
}

Setp 3: config

# 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

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

Usage

/**
 * 
 * @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)

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-09-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固