summaryrefslogtreecommitdiff
path: root/one.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'one.cpp')
-rw-r--r--one.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/one.cpp b/one.cpp
index 06944494..9ebc83c1 100644
--- a/one.cpp
+++ b/one.cpp
@@ -822,7 +822,7 @@ static int idtool(int argc,char **argv)
char hexbuf[1024];
printf("%s",Utils::hex(signature.data,ZT_C25519_SIGNATURE_LEN,hexbuf));
} else if (!strcmp(argv[1],"verify")) {
- if (argc < 4) {
+ if (argc < 5) {
idtoolPrintHelp(stdout,argv[0]);
return 1;
}
@@ -844,8 +844,19 @@ static int idtool(int argc,char **argv)
if ((signature.length() > ZT_ADDRESS_LENGTH)&&(id.verify(inf.data(),(unsigned int)inf.length(),signature.data(),(unsigned int)signature.length()))) {
printf("%s signature valid" ZT_EOL_S,argv[3]);
} else {
- fprintf(stderr,"%s signature check FAILED" ZT_EOL_S,argv[3]);
- return 1;
+ signature.clear();
+ if (OSUtils::readFile(argv[4],signature)) {
+ signature.assign(buf,Utils::unhex(signature.c_str(),buf,(unsigned int)sizeof(buf)));
+ if ((signature.length() > ZT_ADDRESS_LENGTH)&&(id.verify(inf.data(),(unsigned int)inf.length(),signature.data(),(unsigned int)signature.length()))) {
+ printf("%s signature valid" ZT_EOL_S,argv[3]);
+ } else {
+ fprintf(stderr,"%s signature check FAILED" ZT_EOL_S,argv[3]);
+ return 1;
+ }
+ } else {
+ fprintf(stderr,"%s signature check FAILED" ZT_EOL_S,argv[3]);
+ return 1;
+ }
}
} else if (!strcmp(argv[1],"initmoon")) {
if (argc < 3) {