salliyme/security

Security with RSA Encrypt

v1.0 2021-09-28 07:07 UTC

This package is auto-updated.

Last update: 2024-09-28 15:54:50 UTC


README

By [salliyme]

This library helps you generate RSA cert and encrypt and decrypt simply.

Installation

Use Composer to install the library.

$ composer require salliyme/security

Basic usage

use salliyme\security\Encrypt;

$instance = new Encrypt();
$instance->generateKey();
$instance->init();
$plainData = "This is a test Encrypt Encrypt and Decrypt Methods.";
$enc = $instance->private_encrypt($plainData);
$dec = $instance->public_decrypt($enc);
echo "Text:", $dec, PHP_EOL;
$plainText = "This data to test Encrypt public Encrypt and private Decrypt.";
$enc1 = $instance->public_encrypt($plainText);
$dec1 = $instance->private_decrypt($enc1);
echo "Text2:", $dec1, PHP_EOL;

License

This bundle is under the MIT license. For the full copyright and license information please view the LICENSE file that was distributed with this source code.