1. Go to this page and download the library: Download june/data_security library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
june / data_security example snippets
use june\DataSecurity\Config;
use june\DataSecurity\Openssl;
$data = "Data that needs to be encrypted";
$config = new Config([
"key" => "your key",
"iv" => 'iv',
"aad" => 'aad'
]);
$openssl = new Openssl($config);
$ciphertext = $openssl->encrypted($data);
echo $ciphertext;
$data = $openssl->decryption($ciphertext);
echo $data;
use june\DataSecurity\Config;
use june\DataSecurity\Openssl;
$data = "Data that needs to be encrypted";
$config = new Config([
"privateKey" => "",
"privateKeyFilePath" => "",
"publicKey" => "",
"publicKeyFilePath" => "",
]);
$openssl = new Openssl($config);
// Public key encryption
$ciphertext = $openssl->publicEncrypt($data);
echo $ciphertext;
$data = $openssl->privateDecrypt($ciphertext);
echo $data;
// Private key encryption
$ciphertext = $openssl->privateEncrypt($data);
echo $ciphertext;
$data = $openssl->publicDecrypt($ciphertext);
echo $data;