PHP code example of naylonkessler / simple-rsa-cryptor-php
1. Go to this page and download the library: Download naylonkessler/simple-rsa-cryptor-php 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/ */
naylonkessler / simple-rsa-cryptor-php example snippets
use SimpleRSACryptor\Cryptor;
use SimpleRSACryptor\Keys\PublicKey;
use SimpleRSACryptor\Keys\PrivateKey;
$publicKey = new PublicKey('path-to-public-key-file.pem');
$privateKey = new PrivateKey('path-to-private-key-file.pem');
$passPhrase = 'pass phrase of private key';
$cryptor = new Cryptor($publicKey, $privateKey, $passPhrase);
$encrypted = $cryptor->encrypt('Some data');
$decrypted = $cryptor->decrypt($encrypted);
echo $decrypted;