More cleanup, and fix SHA384 built-in C code.
This commit is contained in:
parent
91d0cbe892
commit
37047a39f9
9 changed files with 229 additions and 205 deletions
22
selftest.cpp
22
selftest.cpp
|
@ -575,18 +575,16 @@ static int testIdentity()
|
|||
std::cout << "[identity] Testing Locator and DNS TXT encoding... "; std::cout.flush();
|
||||
uint8_t dnsPub[ZT_ECC384_PUBLIC_KEY_SIZE],dnsPriv[ZT_ECC384_PRIVATE_KEY_SIZE];
|
||||
ECC384GenerateKey(dnsPub,dnsPriv);
|
||||
Locator l;
|
||||
Identity ti;
|
||||
ti.generate(Identity::C25519);
|
||||
l.add(InetAddress("127.0.0.1/9993"));
|
||||
l.add(InetAddress("cafe:babe:face:dbad:deca:f::1/9993"));
|
||||
l.finish(ti,OSUtils::now());
|
||||
l.sign(ti);
|
||||
auto tr = l.makeTxtRecords(dnsPub,dnsPriv);
|
||||
//for(auto i=tr.begin();i!=tr.end();++i)
|
||||
// std::cout << " " << i->c_str() << ZT_EOL_S;
|
||||
Locator l2;
|
||||
if (!l2.decodeTxtRecords(tr.begin(),tr.end(),dnsPub)) {
|
||||
std::unique_ptr<Locator> l(new Locator());
|
||||
std::unique_ptr<Identity> ti(new Identity());
|
||||
ti->generate(Identity::C25519);
|
||||
l->add(InetAddress("127.0.0.1/9993"));
|
||||
l->add(InetAddress("cafe:babe:face:dbad:deca:f::1/9993"));
|
||||
l->finish(*ti,OSUtils::now());
|
||||
l->sign(*ti);
|
||||
auto tr = l->makeTxtRecords(dnsPub,dnsPriv);
|
||||
std::unique_ptr<Locator> l2(new Locator());
|
||||
if (!l2->decodeTxtRecords(tr.begin(),tr.end(),dnsPub)) {
|
||||
std::cout << "FAILED (decode TXT records returned false)" ZT_EOL_S;
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue