diff options
Diffstat (limited to 'node/Topology.cpp')
| -rw-r--r-- | node/Topology.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/node/Topology.cpp b/node/Topology.cpp index 4fae1372..6fcb17af 100644 --- a/node/Topology.cpp +++ b/node/Topology.cpp @@ -27,6 +27,8 @@ #include <algorithm> +#include "Constants.hpp" +#include "Defaults.hpp" #include "Topology.hpp" #include "NodeConfig.hpp" #include "CMWC4096.hpp" @@ -239,6 +241,24 @@ void Topology::clean() } } +bool Topology::authenticateRootTopology(const Dictionary &rt) +{ + try { + std::string signer(rt.signingIdentity()); + if (!signer.length()) + return false; + Identity signerId(signer); + std::map< Address,Identity >::const_iterator authority(ZT_DEFAULTS.rootTopologyAuthorities.find(signerId.address())); + if (authority == ZT_DEFAULTS.rootTopologyAuthorities.end()) + return false; + if (signerId != authority->second) + return false; + return rt.verify(authority->second); + } catch ( ... ) { + return false; + } +} + void Topology::_dumpPeers() { Buffer<ZT_PEER_WRITE_BUF_SIZE> buf; |
