diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-09-16 15:06:17 -0400 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-09-16 15:06:17 -0400 |
commit | 77f8d75529e401ac7b45927f1d75b4df87bc0c55 (patch) | |
tree | 8da195cf4a75b26a81240b0923bc0fc6ba199f11 /idtool.cpp | |
parent | 94bf3e9a0e0bb14becf3102baec3620b34b648e6 (diff) | |
download | infinitytier-77f8d75529e401ac7b45927f1d75b4df87bc0c55.tar.gz infinitytier-77f8d75529e401ac7b45927f1d75b4df87bc0c55.zip |
Fix idtool build, tweak address derivation again.
Diffstat (limited to 'idtool.cpp')
-rw-r--r-- | idtool.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -33,6 +33,7 @@ #include "node/Identity.hpp" #include "node/Utils.hpp" +#include "node/C25519.hpp" using namespace ZeroTier; @@ -131,13 +132,8 @@ int main(int argc,char **argv) std::cerr << argv[3] << " is not readable" << std::endl; return -1; } - std::string signature = id.sign(inf.data(),inf.length()); - if (!signature.length()) { - std::cerr << "Error computing SHA256 or signature (bug?)" << std::endl; - return -1; - } - - std::cout << Utils::base64Encode(signature.data(),signature.length()); + C25519::Signature signature = id.sign(inf.data(),inf.length()); + std::cout << Utils::hex(signature.data,signature.size()); } else if (!strcmp(argv[1],"verify")) { if (argc < 4) { printHelp(argv[0]); @@ -156,8 +152,8 @@ int main(int argc,char **argv) return -1; } - std::string signature(Utils::base64Decode(argv[4],strlen(argv[4]))); - if ((signature.length() > ZT_ADDRESS_LENGTH)&&(id.verifySignature(inf.data(),inf.length(),signature.data(),signature.length()))) { + std::string signature(Utils::unhex(argv[4])); + if ((signature.length() > ZT_ADDRESS_LENGTH)&&(id.verify(inf.data(),inf.length(),signature.data(),signature.length()))) { std::cout << argv[3] << " signature valid" << std::endl; } else { std::cerr << argv[3] << " signature check FAILED" << std::endl; |