mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 12:33:44 +02:00
Fix idtool build, tweak address derivation again.
This commit is contained in:
parent
94bf3e9a0e
commit
77f8d75529
2 changed files with 6 additions and 10 deletions
14
idtool.cpp
14
idtool.cpp
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
#include "node/Identity.hpp"
|
#include "node/Identity.hpp"
|
||||||
#include "node/Utils.hpp"
|
#include "node/Utils.hpp"
|
||||||
|
#include "node/C25519.hpp"
|
||||||
|
|
||||||
using namespace ZeroTier;
|
using namespace ZeroTier;
|
||||||
|
|
||||||
|
@ -131,13 +132,8 @@ int main(int argc,char **argv)
|
||||||
std::cerr << argv[3] << " is not readable" << std::endl;
|
std::cerr << argv[3] << " is not readable" << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
std::string signature = id.sign(inf.data(),inf.length());
|
C25519::Signature signature = id.sign(inf.data(),inf.length());
|
||||||
if (!signature.length()) {
|
std::cout << Utils::hex(signature.data,signature.size());
|
||||||
std::cerr << "Error computing SHA256 or signature (bug?)" << std::endl;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout << Utils::base64Encode(signature.data(),signature.length());
|
|
||||||
} else if (!strcmp(argv[1],"verify")) {
|
} else if (!strcmp(argv[1],"verify")) {
|
||||||
if (argc < 4) {
|
if (argc < 4) {
|
||||||
printHelp(argv[0]);
|
printHelp(argv[0]);
|
||||||
|
@ -156,8 +152,8 @@ int main(int argc,char **argv)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string signature(Utils::base64Decode(argv[4],strlen(argv[4])));
|
std::string signature(Utils::unhex(argv[4]));
|
||||||
if ((signature.length() > ZT_ADDRESS_LENGTH)&&(id.verifySignature(inf.data(),inf.length(),signature.data(),signature.length()))) {
|
if ((signature.length() > ZT_ADDRESS_LENGTH)&&(id.verify(inf.data(),inf.length(),signature.data(),signature.length()))) {
|
||||||
std::cout << argv[3] << " signature valid" << std::endl;
|
std::cout << argv[3] << " signature valid" << std::endl;
|
||||||
} else {
|
} else {
|
||||||
std::cerr << argv[3] << " signature check FAILED" << std::endl;
|
std::cerr << argv[3] << " signature check FAILED" << std::endl;
|
||||||
|
|
|
@ -132,7 +132,7 @@ bool Identity::fromString(const char *str)
|
||||||
// These are fixed parameters and can't be changed without a new
|
// These are fixed parameters and can't be changed without a new
|
||||||
// identity type.
|
// identity type.
|
||||||
#define ZT_IDENTITY_DERIVEADDRESS_MEMORY 33554432
|
#define ZT_IDENTITY_DERIVEADDRESS_MEMORY 33554432
|
||||||
#define ZT_IDENTITY_DERIVEADDRESS_ROUNDS 64
|
#define ZT_IDENTITY_DERIVEADDRESS_ROUNDS 50
|
||||||
|
|
||||||
Address Identity::deriveAddress(const void *keyBytes,unsigned int keyLen)
|
Address Identity::deriveAddress(const void *keyBytes,unsigned int keyLen)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue