crypt::newkey(); // Run the command and Take the Result and put it in the Follow Lines
define('FIRSTKEY', 'KeyofFirstLine'); // Save this Line in config file
define('SECONDKEY','KeyofSecondLine'); // Save this Line in config file
$yourtext = 'This is your Text and I like this.';
$encrypted = crypt::encrypt($yourtext); // Your Text is now encrypted
$decrypted = crypt::decrypt($encrypted); // Your Text is now decrypted
// Set in Class keycrypt your Key Length
const mainlength = 4096; // or 1024 or 2048
$pathtopublickeyfile = 'mypublic.key';
$pathtoprivateKeyFile = 'myprivate.key';
keycrypt::createkeys($pathtoprivateKeyFile,$pathtopublickeyfile); // After That you find your keys in the generated Files
$yourtext = 'This is your Text and I like this.';
try {
$encrypted = keycrypt::encrypt($yourtext,$pathtopublickeyfile);
} catch(\Exception $e){
echo $e->getMessage();
}
echo $encrypted;
echo '</br>';
try {
$decrypted = keycrypt::decrypt($encrypted,$pathtoprivateKeyFile);
} catch(\Exception $e){
echo $e->getMessage();
}
echo $decrypted;