security: Add Validator

Change-Id: Ib97bbb1a95f43684f14f02d0e50b1b6b6f93979b
diff --git a/src/sync-logic.cc b/src/sync-logic.cc
index ec4d63e..5bbd83c 100644
--- a/src/sync-logic.cc
+++ b/src/sync-logic.cc
@@ -58,6 +58,7 @@
 int SyncLogic::m_instanceCounter = 0;
 
 SyncLogic::SyncLogic (const Name& syncPrefix,
+                      const Name& identity,
                       shared_ptr<Validator> validator, 
                       shared_ptr<Face> face,
                       LogicUpdateCallback onUpdate,
@@ -65,6 +66,7 @@
   : m_state (new FullState)
   , m_syncInterestTable (*face->ioService(), time::seconds(m_syncInterestReexpress))
   , m_syncPrefix (syncPrefix)
+  , m_identity (identity)
   , m_onUpdate (onUpdate)
   , m_onRemove (onRemove)
   , m_perBranch (false)
@@ -89,12 +91,14 @@
 }
 
 SyncLogic::SyncLogic (const Name& syncPrefix,
+                      const Name& identity,
                       shared_ptr<Validator> validator,
                       shared_ptr<Face> face,
                       LogicPerBranchCallback onUpdateBranch)
   : m_state (new FullState)
   , m_syncInterestTable (*face->ioService(), time::seconds (m_syncInterestReexpress))
   , m_syncPrefix (syncPrefix)
+  , m_identity (identity)
   , m_onUpdateBranch (onUpdateBranch)
   , m_perBranch(true)
   , m_validator(validator)
@@ -164,6 +168,10 @@
     {
       _LOG_DEBUG_ID ("<< I " << name);
 
+      if(name.get(m_syncPrefix.size()).toEscapedString() == "intro-cert")
+        // it is a certificate, validator will take care of it.
+        return;
+
       DigestConstPtr digest;
       string type;
       tie (digest, type) = convertNameToDigestAndType (name);
@@ -636,7 +644,7 @@
   syncData.setContent(reinterpret_cast<const uint8_t*>(wireData), size);
   syncData.setFreshnessPeriod(m_syncResponseFreshness);
   
-  m_keyChain->sign(syncData);
+  m_keyChain->signByIdentity(syncData, m_identity);
   
   m_face->put(syncData);