table: Processing of PublisherPublicKeyLocator in CS
refs: #1424
Change-Id: Ia4ad2c92a7a6860b73674444ba4a0120a90e5342
diff --git a/daemon/table/cs.cpp b/daemon/table/cs.cpp
index 874ef52..e5da3fa 100644
--- a/daemon/table/cs.cpp
+++ b/daemon/table/cs.cpp
@@ -27,6 +27,7 @@
#include "cs.hpp"
#include "core/logger.hpp"
#include <ndn-cpp-dev/util/crypto.hpp>
+#include "ndn-cpp-dev/security/signature-sha256-with-rsa.hpp"
#define SKIPLIST_MAX_LAYERS 32
#define SKIPLIST_PROBABILITY 25 // 25% (p = 1/4)
@@ -636,6 +637,24 @@
return false;
}
+ if (!interest.getPublisherPublicKeyLocator().empty())
+ {
+ if (entry->getData().getSignature().getType() == ndn::Signature::Sha256WithRsa)
+ {
+ ndn::SignatureSha256WithRsa rsaSignature(entry->getData().getSignature());
+ if (rsaSignature.getKeyLocator() != interest.getPublisherPublicKeyLocator())
+ {
+ NFD_LOG_TRACE("violates publisher key selector");
+ return false;
+ }
+ }
+ else
+ {
+ NFD_LOG_TRACE("violates publisher key selector");
+ return false;
+ }
+ }
+
if (doesInterestContainDigest)
{
const ndn::name::Component& lastComponent = entry->getName().get(-1);