pgolasz / kohana-encrypt
本包的最新版本(1.0.3)没有可用的许可信息。
为 Kohana 3.3 使用的加密模块。采用 OPENSSL(AES)的 Encrypt-then-MAC 方案和 Encrypt-then-Sign(RSA)。
1.0.3
2017-08-29 12:36 UTC
This package is not auto-updated.
Last update: 2024-09-15 01:52:01 UTC
README
为 Kohana 3.3 使用的加密模块。Laravel Encrypt-then-MAC 方案的端口,用于 OPENSSL(AES 和 RSA)加密。使用 AES-256-CBC 和 AES-128-CBC,以及 RSA 的用户公钥和私钥。
安装
$ cd modules
$ git clone [git-repo-url]
将此行添加到您的 bootstrap.php 中的 Kohana::modules
'kohana-encrypt' => MODPATH . 'kohana-encrypt'
使用 composer 安装 phpseclib
$ composer install
在您的 bootstrap.php 中包含 autoload.php
/**
* Enable composer autoload libraries
*/
require APPPATH . '../vendor/autoload.php';
为您的应用程序生成 AES 和 RSA 密钥
$ php index.php --uri=task/encyptkeys
也可以在应用程序的 common 模块中生成配置,例如,如果您的核心类位于 /modules/custommodule/classes,则配置将在 /modules/custom/config 中生成。
$ php index.php --uri=task/encyptkeys --module=custommodule
使用方法
- OPENSSL(AES-256-CBC 或 AES-128-CBC)
$encrypt = Encrypt::instance(); echo $encrypt->encrypt('This is my secret');
- RSA
$encrypt = Encrypt::instance('secondary'); echo $encrypt->encrypt('This is my secret');
许可证
MIT
自由软件,太棒了!