diff --git a/www/admin/class_test.db.encryption.php b/www/admin/class_test.db.encryption.php index 0d8da1cb..1287dd49 100644 --- a/www/admin/class_test.db.encryption.php +++ b/www/admin/class_test.db.encryption.php @@ -15,6 +15,8 @@ ob_start(); define('USE_DATABASE', true); // sample config require 'config.php'; +// for testing encryption compare +use OpenPGP\OpenPGP; // define log file id $LOG_FILE_ID = 'classTest-db-query-encryption'; ob_end_flush(); @@ -50,6 +52,7 @@ print "Secret Key: " . $key . "
"; // test text $text_string = "I a some deep secret"; +$text_string = "I a some deep secret ABC"; // $crypt = new SymmetricEncryption($key); $encrypted = $crypt->encrypt($text_string); @@ -134,6 +137,28 @@ if ($res === false) { print "libsodium and pgcrypto hash hmac match
"; } } +$encryptedMessage_template = <<getLiteralData()->getData(); + print "Pg decrypted PHP: " . $decrypted . "
"; + if ($decrypted == $text_string) { + print "Decryption worked
"; + } +} catch (\Exception $e) { + print "Error decrypting message: " . $e->getMessage() . "
"; +} // do compare for PHP and pgcrypto settings diff --git a/www/composer.json b/www/composer.json index 8fe948fd..d723baf3 100644 --- a/www/composer.json +++ b/www/composer.json @@ -24,6 +24,7 @@ "egrajp/smarty-extended": "^5.4", "php": ">=8.1", "gullevek/dotenv": "^2.0", - "psr/log": "^2.0 || ^3.0" + "psr/log": "^2.0 || ^3.0", + "php-privacy/openpgp": "^2.1" } }