Make Signature an abstract base class and added subclass Sha256WithRsaSignature. Change Data.signature to a pointer to a Signature.
diff --git a/ndn-cpp/node.cpp b/ndn-cpp/node.cpp
index 2170fe9..7c7c5f0 100644
--- a/ndn-cpp/node.cpp
+++ b/ndn-cpp/node.cpp
@@ -8,6 +8,7 @@
#include "c/encoding/binary-xml.h"
#include "forwarding-entry.hpp"
#include "security/key-chain.hpp"
+#include "sha256-with-rsa-signature.hpp"
#include "node.hpp"
using namespace std;
@@ -55,10 +56,11 @@
void Node::NdndIdFetcher::operator()(const ptr_lib::shared_ptr<const Interest>& interest, const ptr_lib::shared_ptr<Data>& ndndIdData)
{
- if (ndndIdData->getSignature().getPublisherPublicKeyDigest().getPublisherPublicKeyDigest().size() > 0) {
+ Sha256WithRsaSignature *signature = dynamic_cast<Sha256WithRsaSignature*>(ndndIdData->getSignature());
+ if (signature && signature->getPublisherPublicKeyDigest().getPublisherPublicKeyDigest().size() > 0) {
// Set the ndndId_ and continue.
// TODO: If there are multiple connected hubs, the NDN ID is really stored per connected hub.
- info_->node_.ndndId_ = ndndIdData->getSignature().getPublisherPublicKeyDigest().getPublisherPublicKeyDigest();
+ info_->node_.ndndId_ = signature->getPublisherPublicKeyDigest().getPublisherPublicKeyDigest();
info_->node_.registerPrefixHelper(info_->prefix_, info_->onInterest_, info_->flags_);
}
// TODO: else need to log not getting the ndndId.