ShowPubPrivKeys.php
772 Bytes
<?php
$keys_file = getenv("DDBASEROOT")."/ddservice_clients_keys.json";
if (!file_exists($keys_file)) {
echo "[ERROR] DDService clients keys file not exists: $keys_file".PHP_EOL;
exit(1);
}
$keys_content = file_get_contents($keys_file);
if (empty($keys_content)) {
echo "[ERROR] Cannot load DDService clients keys file: $keys_file".PHP_EOL;
exit(1);
}
$existing_keys = json_decode($keys_content, TRUE);
if ($existing_keys == NULL) {
echo "[ERROR] DDService clients keys file seems to be corrupted: $keys_file".PHP_EOL;
exit(1);
}
foreach ($existing_keys as $key_info) {
echo "DESCRIPTION: ".$key_info['description'].PHP_EOL;
echo "PUBLIC_KEY: ".$key_info['public'].PHP_EOL;
echo "PRIVATE_KEY: ".$key_info['private'].PHP_EOL;
echo "".PHP_EOL;
}
exit(0);
?>