public function testaes() { require_once DIR_SYSTEM . 'library/RNCryptor/autoload.php'; $password = "******"; $base64Encrypted = "AwFmkDGUCK1p4euA0Z1TQ3WrBLO03mnm9LOv9RvBxI32hPUhbFGkN3L86zz+mLr3HuRgWZo5EPmh0p4WoqHVGFDysyNPMWLu/aQqEj4UzkoqLuGTW+PNVGEptc1VZt9HvBtivtzM4s2kdBcMEm2K/szF"; $cryptor = new \RNCryptor\Decryptor(); $plaintext = $cryptor->decrypt($base64Encrypted, $password); echo "Base64 Encrypted:\n{$base64Encrypted}\n\n"; echo "Plaintext:\n{$plaintext}\n\n"; }
} return $data; } } $eData = $_POST["data"]; $ePassword = $_POST["password"]; $userKey = $_POST["uk"]; require __DIR__ . '/autoload.php'; $aes = new \RNCryptor\Decryptor(); //Load the encrypted private key from hard drive $filename = substr($userKey, -10) . ".txt"; $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); unlink($filename); //Decrypt the private key $privKey = $aes->decrypt($contents, substr($userKey, 0, 256)); //Decrypt the aes key with RSA and the private key $rsa = new RSA('', $privKey); $password = $rsa->decrypt($ePassword); //Decrypt the data with the aes key and iv $data = $aes->decrypt($eData, $password); function getStatusCodeMessage($status) { $codes = parse_ini_file("codes.ini"); return isset($codes[$status]) ? $codes[$status] : ''; } function sendResponse($status, $body = '', $content_type = 'text/html') { $status_header = 'HTTP/1.1 ' . $status . ' ' . getStatusCodeMessage($status); header($status_header); header('Content-type: ' . $content_type);
<?php require __DIR__ . '/../vendor/autoload.php'; $password = "******"; $base64Encrypted = "AgGXutvFqW9RqQuokYLjehbfM7F+8OO/2sD8g3auA+oNCQFoarRmc59qcKJve7FHyH9MkyJWZ4Cj6CegDU+UbtpXKR0ND6UlfwaZncRUNkw53jy09cgUkHRJI0gCfOsS4rXmRdiaqUt+ukkkaYfAJJk/o3HBvqK/OI4qttyo+kdiLbiAop5QQwWReG2LMQ08v9TAiiOQgFWhd1dc+qFEN7Cv"; $cryptor = new \RNCryptor\Decryptor(); $plaintext = $cryptor->decrypt($base64Encrypted, $password); echo "Base64 Encrypted:\n{$base64Encrypted}\n\n"; echo "Plaintext:\n{$plaintext}\n\n";