BASE . LOG,
'log_file_id' => $LOG_FILE_ID,
'log_per_date' => true,
]);
// db connection and attach logger
$db = new CoreLibs\DB\IO(DB_CONFIG, $log);
$db->log->debug('START', '=============================>');
$PAGE_NAME = 'TEST CLASS: DB QUERY ENCRYPTION';
print "";
print "
" . $PAGE_NAME . "";
print "";
print '';
print '' . $PAGE_NAME . '
';
// encryption key
$key = CreateKey::generateRandomKey();
print "Secret Key: " . $key . "
";
// test text
$text_string = "I a some deep secret";
//
$crypt = new SymmetricEncryption($key);
$encrypted = $crypt->encrypt($text_string);
$string_hashed = Hash::hashStd($text_string);
$string_hmac = Hash::hashHmac($text_string, $key);
$decrypted = $crypt->decrypt($encrypted);
print "String: " . $text_string . "
";
print "Encrypted: " . $encrypted . "
";
print "Hashed: " . $string_hashed . "
";
print "Hmac: " . $string_hmac . "
";
$db->dbExecParams(
<<dbGetReturningExt('cuuid');
print "INSERTED: " . print_r($cuuid, true) . "
";
print "LAST ERROR: " . $db->dbGetLastError(true) . "
";
// read back
$res = $db->dbReturnRowParams(
<<" . Support::prAr($res) . "
";
// do compare
print "";
// __END__