3 Star 2 Fork 0

Howard Liu / FormCrypt

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Form Crypt

Encrypt your HTML form data using unbreakable RSA

How to install

Install via composer: execute the following commands in your project's folder!

$ curl -o composer.phar https://getcomposer.org/composer.phar
$ #Skip the above step if you have already installed composer
$ php composer.phar require ix-network/form-crypt

Then require() the class autoloader in your app

require "vendor/autoload.php";

At last copy the js files in the folder js to your project's frontend js folder. The default folder is source/js.

How to use

use IXNetwork/FormCrypt/Encryptor;
use IXNetwork/FormCrypt/Decryptor;

# Init encryptor
$encryptor = Encryptor::construct($keyLength = 2048, $openSSLConfigFile = '');

# Generate key pair. Private key will be automatically stored in $_SESSION['FormCrypt-privateKey']
$publicKey = $encryptor->generateKey();

# Generate Javascript code block, including only the encryptor function
$javascript = $encryptor->generateJavascript($inputFieldNames = ['password'], $functionName = 'encryptData');

# Generate a HTML code block which can be directly insert into the `header` section of your HTML output
$html = $encryptor->generateHTML($javascriptLibraryFolder = 'source/js', $inputFieldNames = ['password'], $functionName = 'encryptData');

# Init decryptor: presence of $_SESSION['FormCrypt-privateKey'] is required for init
$decryptor = Decryptor::construct();

# Decrypt encrypted form data
$decryptedData = $decryptor->decrypt($EncryptedData);

Open Source License

JS BN Library - MIT Licensed. Copyright (c) 2003-2009 Tom Wu

JS RSA Library - MIT Licensed. Copyright 2013 Ziyan Zhou zhou@ziyan.info

PHP Library - MIT Licensed. Copyright 2016 Howard Liu howard@ixnet.work

Distributed by Packagist network.

The MIT License (MIT) Copyright (c) 2016 Howard Liu Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Encrypt your HTML form data using unbreakable RSA 展开 收起
PHP
MIT
取消

发行版 (1)

全部

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/fsgmhoward/FormCrypt.git
git@gitee.com:fsgmhoward/FormCrypt.git
fsgmhoward
FormCrypt
FormCrypt
master

搜索帮助