From: Felix Fietkau Date: Sun, 15 Dec 2024 17:01:34 +0000 (+0100) Subject: unet-tool: add support for dumping pubkey from signed file X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=041e05870c20d481c0b20c952b4e0be9868a1e64;p=project%2Funetd.git unet-tool: add support for dumping pubkey from signed file Signed-off-by: Felix Fietkau --- 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 , Generating secret key from seed using rounds and \n" " (passphrase is read from stdin)\n" " -p Prompt for seed password\n" + " -b : 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;