3 Star 2 Fork 0

Howard Liu / FormCrypt

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

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.

Comments ( 0 )

Sign in for post a comment

About

Encrypt your HTML form data using unbreakable RSA spread retract
Cancel

Releases (1)

All

FormCrypt

Contributors

All

Activities

load more
can not load any more
PHP
1
https://gitee.com/fsgmhoward/FormCrypt.git
git@gitee.com:fsgmhoward/FormCrypt.git
fsgmhoward
FormCrypt
FormCrypt
master

Search