summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau2024-12-15 17:01:34 +0000
committerFelix Fietkau2024-12-15 17:16:49 +0000
commit041e05870c20d481c0b20c952b4e0be9868a1e64 (patch)
tree0861f12ab1311d9d127fadab06b61f4b970d0e5a
parentb17164751fc784fc126de844aa7c4a2edfd16dc2 (diff)
unet-tool: add support for dumping pubkey from signed file
Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r--cli.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/cli.c b/cli.c
index 12d3bd5..88bcb8f 100644
--- a/cli.c
+++ b/cli.c
@@ -89,6 +89,7 @@ static int usage(const char *progname)
" -s <n>,<salt> Generating secret key from seed using <n> rounds and <salt>\n"
" (passphrase is read from stdin)\n"
" -p Prompt for seed password\n"
+ " -b <file>: Read signed network data file\n"
"\n", progname);
return 1;
}
@@ -556,6 +557,7 @@ static bool cmd_needs_peerkey(void)
static bool cmd_needs_pubkey(void)
{
switch (cmd) {
+ case CMD_PUBKEY:
case CMD_DOWNLOAD:
case CMD_VERIFY:
return true;
@@ -568,7 +570,6 @@ static bool cmd_needs_key(void)
{
switch (cmd) {
case CMD_SIGN:
- case CMD_PUBKEY:
case CMD_HOST_PUBKEY:
return true;
default:
@@ -598,7 +599,7 @@ int main(int argc, char **argv)
bool has_peerkey = false;
int ret, ch;
- while ((ch = getopt(argc, argv, "h:k:K:o:qD:GHpPs:SU:V")) != -1) {
+ while ((ch = getopt(argc, argv, "b:h:k:K:o:qD:GHpPs:SU:V")) != -1) {
switch (ch) {
case 'D':
case 'U':
@@ -668,6 +669,12 @@ int main(int argc, char **argv)
case 'p':
password_prompt = true;
break;
+ case 'b':
+ if (load_network_data(optarg))
+ return 1;
+
+ has_pubkey = true;
+ break;
case 'U':
cmd = CMD_UPLOAD;
cmd_arg = optarg;