Adapting to TLV-specific ndn-cpp
Change-Id: I5f39f38156221fc978db5048c1ff4a3bbb0c17d9
diff --git a/src/chat-policy-rule.cpp b/src/chat-policy-rule.cpp
index db1d910..a4a6245 100644
--- a/src/chat-policy-rule.cpp
+++ b/src/chat-policy-rule.cpp
@@ -9,7 +9,7 @@
*/
#include "chat-policy-rule.h"
-#include <ndn-cpp/sha256-with-rsa-signature.hpp>
+#include <ndn-cpp/security/signature/signature-sha256-with-rsa.hpp>
using namespace ndn;
using namespace std;
@@ -36,16 +36,15 @@
bool
ChatPolicyRule::matchSignerName(const Data & data)
{
- const Sha256WithRsaSignature* sigPtr = dynamic_cast<const Sha256WithRsaSignature*> (data.getSignature());
-
- if(NULL == sigPtr)
+ try{
+ SignatureSha256WithRsa sig(data.getSignature());
+ Name signerName = sig.getKeyLocator().getName ();
+ return m_signerRegex->match(signerName);
+ }catch(SignatureSha256WithRsa::Error &e){
return false;
-
- if(ndn_KeyLocatorType_KEYNAME != sigPtr->getKeyLocator().getType())
+ }catch(KeyLocator::Error &e){
return false;
-
- Name signerName = sigPtr->getKeyLocator ().getKeyName ();
- return m_signerRegex->match(signerName);
+ }
}
bool