fixed issues with base64 length limit.

This commit is contained in:
2025-09-16 10:05:07 -06:00
parent f8f07abc2c
commit 32fd5afc65
6 changed files with 312 additions and 243 deletions

View File

@@ -141,4 +141,4 @@ elseif ($operation === 'retrieve') {
else {
showUsage();
}
?>
?>

18
utils/verify_keys.php Normal file
View File

@@ -0,0 +1,18 @@
<?php
// Load Sodium extension
require __DIR__ . '/../vendor/autoload.php'; // Adjust the path to the autoload file
// Base64 decode the public and private keys
$publicKey = base64_decode('0HCO9Tm3JvvbK+J93PStb4/23HSxEZS9WUrWSjmLIz4=');
$privateKey = base64_decode('s1cAUQfbxa6Q8lJxn90N6aKER17Ng9tD/gHpX+8x6drQcI71Obcm+9sr4n3c9K1vj/bcdLERlL1ZStZKOYsjPg==');
// Derive the public key from the private key to check if they match
$derivedPublicKey = sodium_crypto_sign_publickey_from_secretkey($privateKey);
// Compare the derived public key with the provided public key
if (hash_equals($publicKey, $derivedPublicKey)) {
echo "The public and private key pair match!" . PHP_EOL;
} else {
echo "The public and private key pair do NOT match!" . PHP_EOL;
}
?>