mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-19 13:01:39 -07:00
Merge branch 'dev' into dev-extosdep
This commit is contained in:
commit
e22c80dce6
137 changed files with 2805 additions and 13183 deletions
23
one.cpp
23
one.cpp
|
@ -13,6 +13,7 @@
|
|||
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#include "node/ECC.hpp"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -25,6 +26,7 @@
|
|||
#include "node/Constants.hpp"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
// clang-format off
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
|
@ -39,6 +41,7 @@
|
|||
#include "windows/ZeroTierOne/ServiceInstaller.h"
|
||||
#include "windows/ZeroTierOne/ServiceBase.h"
|
||||
#include "windows/ZeroTierOne/ZeroTierOneService.h"
|
||||
// clang-format on
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
|
@ -1553,9 +1556,9 @@ static int idtool(int argc,char **argv)
|
|||
fprintf(stderr,"%s is not readable" ZT_EOL_S,argv[3]);
|
||||
return 1;
|
||||
}
|
||||
C25519::Signature signature = id.sign(inf.data(),(unsigned int)inf.length());
|
||||
ECC::Signature signature = id.sign(inf.data(),(unsigned int)inf.length());
|
||||
char hexbuf[1024];
|
||||
printf("%s",Utils::hex(signature.data,ZT_C25519_SIGNATURE_LEN,hexbuf));
|
||||
printf("%s",Utils::hex(signature.data,ZT_ECC_SIGNATURE_LEN,hexbuf));
|
||||
} else if (!strcmp(argv[1],"verify")) {
|
||||
if (argc < 5) {
|
||||
idtoolPrintHelp(stdout,argv[0]);
|
||||
|
@ -1603,14 +1606,14 @@ static int idtool(int argc,char **argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
C25519::Pair kp(C25519::generate());
|
||||
ECC::Pair kp(ECC::generate());
|
||||
|
||||
char idtmp[4096];
|
||||
nlohmann::json mj;
|
||||
mj["objtype"] = "world";
|
||||
mj["worldType"] = "moon";
|
||||
mj["updatesMustBeSignedBy"] = mj["signingKey"] = Utils::hex(kp.pub.data,ZT_C25519_PUBLIC_KEY_LEN,idtmp);
|
||||
mj["signingKey_SECRET"] = Utils::hex(kp.priv.data,ZT_C25519_PRIVATE_KEY_LEN,idtmp);
|
||||
mj["updatesMustBeSignedBy"] = mj["signingKey"] = Utils::hex(kp.pub.data,ZT_ECC_PUBLIC_KEY_SET_LEN,idtmp);
|
||||
mj["signingKey_SECRET"] = Utils::hex(kp.priv.data,ZT_ECC_PRIVATE_KEY_SET_LEN,idtmp);
|
||||
mj["id"] = id.address().toString(idtmp);
|
||||
nlohmann::json seedj;
|
||||
seedj["identity"] = id.toString(false,idtmp);
|
||||
|
@ -1647,11 +1650,11 @@ static int idtool(int argc,char **argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
C25519::Pair signingKey;
|
||||
C25519::Public updatesMustBeSignedBy;
|
||||
Utils::unhex(OSUtils::jsonString(mj["signingKey"],"").c_str(),signingKey.pub.data,ZT_C25519_PUBLIC_KEY_LEN);
|
||||
Utils::unhex(OSUtils::jsonString(mj["signingKey_SECRET"],"").c_str(),signingKey.priv.data,ZT_C25519_PRIVATE_KEY_LEN);
|
||||
Utils::unhex(OSUtils::jsonString(mj["updatesMustBeSignedBy"],"").c_str(),updatesMustBeSignedBy.data,ZT_C25519_PUBLIC_KEY_LEN);
|
||||
ECC::Pair signingKey;
|
||||
ECC::Public updatesMustBeSignedBy;
|
||||
Utils::unhex(OSUtils::jsonString(mj["signingKey"],"").c_str(),signingKey.pub.data,ZT_ECC_PUBLIC_KEY_SET_LEN);
|
||||
Utils::unhex(OSUtils::jsonString(mj["signingKey_SECRET"],"").c_str(),signingKey.priv.data,ZT_ECC_PRIVATE_KEY_SET_LEN);
|
||||
Utils::unhex(OSUtils::jsonString(mj["updatesMustBeSignedBy"],"").c_str(),updatesMustBeSignedBy.data,ZT_ECC_PUBLIC_KEY_SET_LEN);
|
||||
|
||||
std::vector<World::Root> roots;
|
||||
nlohmann::json &rootsj = mj["roots"];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue