security: Disable security temporarily

Refs: #1530

Change-Id: If46346f424c7413d29aa312a2d924dbcb97ee04e
diff --git a/src/communication/data-manager.cpp b/src/communication/data-manager.cpp
index bcae456..f56dd79 100644
--- a/src/communication/data-manager.cpp
+++ b/src/communication/data-manager.cpp
@@ -9,7 +9,7 @@
 #include "data-manager.hpp"
 #include "utility/tokenizer.hpp"
 #include "lsdb.hpp"
-#include "security/key-manager.hpp"
+// #include "security/key-manager.hpp"
 
 namespace nlsr {
 
@@ -30,7 +30,7 @@
   }
   else
   {
-    if (m_nlsr.getKeyManager().verify(data))
+    // if (m_nlsr.getKeyManager().verify(data))
     {
       std::cout << "Verified Data Content" << std::endl;
       chkString = "info";
@@ -46,10 +46,10 @@
         processContentLsa(dataName, dataContent);
       }
     }
-    else
-    {
-      std::cout << "Unverified Data Content. Discarded" << std::endl;
-    }
+    // else
+    // {
+    //   std::cout << "Unverified Data Content. Discarded" << std::endl;
+    // }
   }
 }
 
@@ -200,14 +200,14 @@
   uint32_t seqNum = boost::lexical_cast<uint32_t>(nt.getToken(
                                                     nt.getTokenNumber() - 2));
   std::cout << "Cert Name: " << certName << " Seq Num: " << seqNum << std::endl;
-  if (m_nlsr.getKeyManager().verify(m_nlsr, *(cert)))
-  {
-    m_nlsr.getKeyManager().addCertificate(cert, seqNum, true);
-  }
-  else
-  {
-    m_nlsr.getKeyManager().addCertificate(cert, seqNum, false);
-  }
-  m_nlsr.getKeyManager().printCertStore();
+  // if (m_nlsr.getKeyManager().verify(m_nlsr, *(cert)))
+  // {
+  //   m_nlsr.getKeyManager().addCertificate(cert, seqNum, true);
+  // }
+  // else
+  // {
+  //   m_nlsr.getKeyManager().addCertificate(cert, seqNum, false);
+  // }
+  // m_nlsr.getKeyManager().printCertStore();
 }
 }//namespace nlsr
diff --git a/src/communication/interest-manager.cpp b/src/communication/interest-manager.cpp
index 226efaf..070c92b 100644
--- a/src/communication/interest-manager.cpp
+++ b/src/communication/interest-manager.cpp
@@ -52,7 +52,8 @@
     Data data(ndn::Name(interest.getName()).appendVersion());
     data.setFreshnessPeriod(time::seconds(10)); // 10 sec
     data.setContent((const uint8_t*)"info", sizeof("info"));
-    m_nlsr.getKeyManager().signData(data);
+    // m_nlsr.getKeyManager().signData(data);
+    m_keyChain.sign(data);
     cout << ">> D: " << data << endl;
     m_nlsr.getNlsrFace()->put(data);
     int status = m_nlsr.getAdl().getStatusOfNeighbor(neighbor);
@@ -125,7 +126,8 @@
       data.setFreshnessPeriod(time::seconds(10)); // 10 sec
       string content = nameLsa->getData();
       data.setContent((const uint8_t*)content.c_str(), content.size());
-      m_nlsr.getKeyManager().signData(data);
+      // m_nlsr.getKeyManager().signData(data);
+      m_keyChain.sign(data);
       std::cout << ">> D: " << data << std::endl;
       m_nlsr.getNlsrFace()->put(data);
     }
@@ -145,7 +147,8 @@
       data.setFreshnessPeriod(time::seconds(10)); // 10 sec
       string content = adjLsa->getData();
       data.setContent((const uint8_t*)content.c_str(), content.size());
-      m_nlsr.getKeyManager().signData(data);
+      // m_nlsr.getKeyManager().signData(data);
+      m_keyChain.sign(data);
       std::cout << ">> D: " << data << std::endl;
       m_nlsr.getNlsrFace()->put(data);
     }
@@ -165,7 +168,8 @@
       data.setFreshnessPeriod(time::seconds(10)); // 10 sec
       string content = corLsa->getData();
       data.setContent((const uint8_t*)content.c_str(), content.size());
-      m_nlsr.getKeyManager().signData(data);
+      // m_nlsr.getKeyManager().signData(data);
+      m_keyChain.sign(data);
       std::cout << ">> D: " << data << std::endl;
       m_nlsr.getNlsrFace()->put(data);
     }
@@ -176,56 +180,56 @@
 InterestManager::processInterestKeys(const ndn::Interest& interest)
 {
   std::cout << "processInterestKeys called " << std::endl;
-  string intName = interest.getName().toUri();
-  std::cout << "Interest Name for Key: " << intName << std::endl;
-  Tokenizer nt(intName, "/");
-  std::string chkString("ID-CERT");
-  std::string certName;
-  uint32_t seqNum;
-  ndn::Name dataName;
-  std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool> chkCert;
-  if (nt.getTokenPosition(chkString) == nt.getTokenNumber() - 1)
-  {
-    certName = nt.getTokenString(0, nt.getTokenNumber() - 1);
-    cout << "Cert Name: " << certName << std::endl;
-    chkCert = m_nlsr.getKeyManager().getCertificateFromStore(certName);
-  }
-  else
-  {
-    certName = nt.getTokenString(0, nt.getTokenNumber() - 2);
-    seqNum = boost::lexical_cast<uint32_t>(nt.getToken(nt.getTokenNumber() - 1));
-    std::cout << "Cert Name: " << certName << " Seq Num: " << seqNum << std::endl;
-    chkCert = m_nlsr.getKeyManager().getCertificateFromStore(certName, seqNum);
-  }
-  if (chkCert.second)
-  {
-    if (nt.getTokenPosition(chkString) == nt.getTokenNumber() - 1)
-    {
-      std::string dn;
-      dataName = ndn::Name(interest.getName()).appendVersion();
-      std::pair<uint32_t, bool> seqChk =
-        m_nlsr.getKeyManager().getCertificateSeqNum(certName);
-      if (seqChk.second)
-      {
-        dn = dataName.toUri() + "/" + boost::lexical_cast<std::string>(seqChk.first);
-        dataName = ndn::Name(dn);
-      }
-      else
-      {
-        dn = dataName.toUri() + "/" + boost::lexical_cast<std::string>(10);
-        dataName = ndn::Name(dn);
-      }
-    }
-    else
-    {
-      dataName = ndn::Name(interest.getName());
-    }
-    Data data(dataName.appendVersion());
-    data.setFreshnessPeriod(time::seconds(10)); //10 sec
-    data.setContent(chkCert.first->wireEncode());
-    m_nlsr.getKeyManager().signData(data);
-    m_nlsr.getNlsrFace()->put(data);
-  }
+  // string intName = interest.getName().toUri();
+  // std::cout << "Interest Name for Key: " << intName << std::endl;
+  // Tokenizer nt(intName, "/");
+  // std::string chkString("ID-CERT");
+  // std::string certName;
+  // uint32_t seqNum;
+  // ndn::Name dataName;
+  // std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool> chkCert;
+  // if (nt.getTokenPosition(chkString) == nt.getTokenNumber() - 1)
+  // {
+  //   certName = nt.getTokenString(0, nt.getTokenNumber() - 1);
+  //   cout << "Cert Name: " << certName << std::endl;
+  //   chkCert = m_nlsr.getKeyManager().getCertificateFromStore(certName);
+  // }
+  // else
+  // {
+  //   certName = nt.getTokenString(0, nt.getTokenNumber() - 2);
+  //   seqNum = boost::lexical_cast<uint32_t>(nt.getToken(nt.getTokenNumber() - 1));
+  //   std::cout << "Cert Name: " << certName << " Seq Num: " << seqNum << std::endl;
+  //   chkCert = m_nlsr.getKeyManager().getCertificateFromStore(certName, seqNum);
+  // }
+  // if (chkCert.second)
+  // {
+  //   if (nt.getTokenPosition(chkString) == nt.getTokenNumber() - 1)
+  //   {
+  //     std::string dn;
+  //     dataName = ndn::Name(interest.getName()).appendVersion();
+  //     std::pair<uint32_t, bool> seqChk =
+  //       m_nlsr.getKeyManager().getCertificateSeqNum(certName);
+  //     if (seqChk.second)
+  //     {
+  //       dn = dataName.toUri() + "/" + boost::lexical_cast<std::string>(seqChk.first);
+  //       dataName = ndn::Name(dn);
+  //     }
+  //     else
+  //     {
+  //       dn = dataName.toUri() + "/" + boost::lexical_cast<std::string>(10);
+  //       dataName = ndn::Name(dn);
+  //     }
+  //   }
+  //   else
+  //   {
+  //     dataName = ndn::Name(interest.getName());
+  //   }
+  //   Data data(dataName.appendVersion());
+  //   data.setFreshnessPeriod(time::seconds(10)); //10 sec
+  //   data.setContent(chkCert.first->wireEncode());
+  //   m_nlsr.getKeyManager().signData(data);
+  //   m_nlsr.getNlsrFace()->put(data);
+  // }
 }
 
 
diff --git a/src/communication/interest-manager.hpp b/src/communication/interest-manager.hpp
index 86d590b..725103d 100644
--- a/src/communication/interest-manager.hpp
+++ b/src/communication/interest-manager.hpp
@@ -62,6 +62,7 @@
 private:
   Nlsr& m_nlsr;
 
+  ndn::KeyChain m_keyChain;
 };
 
 }//namespace nlsr
diff --git a/src/communication/sync-logic-handler.cpp b/src/communication/sync-logic-handler.cpp
index 696f06a..16b92bc 100644
--- a/src/communication/sync-logic-handler.cpp
+++ b/src/communication/sync-logic-handler.cpp
@@ -1,6 +1,6 @@
 #include "nlsr.hpp"
 #include "sync-logic-handler.hpp"
-#include "security/key-manager.hpp"
+// #include "security/key-manager.hpp"
 #include "utility/tokenizer.hpp"
 
 
@@ -61,7 +61,7 @@
   {
     //process keys update here
     std::string certName = nt.getTokenString(0);
-    processKeysUpdateFromSync(certName, seqNo, pnlsr);
+    // processKeysUpdateFromSync(certName, seqNo, pnlsr);
   }
 }
 
@@ -107,19 +107,19 @@
   }
 }
 
-void
-SyncLogicHandler::processKeysUpdateFromSync(std::string certName,
-                                            uint64_t seqNo, Nlsr& pnlsr)
-{
-  std::cout << "Cert Name: " << certName << std::endl;
-  if (pnlsr.getKeyManager().isNewCertificate(certName, seqNo))
-  {
-    string certNamePrefix = certName + "/" +
-                            boost::lexical_cast<string>(seqNo);
-    pnlsr.getIm().expressInterest(certNamePrefix, 3,
-                                  pnlsr.getConfParameter().getInterestResendTime());
-  }
-}
+// void
+// SyncLogicHandler::processKeysUpdateFromSync(std::string certName,
+//                                             uint64_t seqNo, Nlsr& pnlsr)
+// {
+//   std::cout << "Cert Name: " << certName << std::endl;
+//   // if (pnlsr.getKeyManager().isNewCertificate(certName, seqNo))
+//   {
+//     string certNamePrefix = certName + "/" +
+//                             boost::lexical_cast<string>(seqNo);
+//     pnlsr.getIm().expressInterest(certNamePrefix, 3,
+//                                   pnlsr.getConfParameter().getInterestResendTime());
+//   }
+// }
 
 void
 SyncLogicHandler::publishRoutingUpdate(SequencingManager& sm,
@@ -129,11 +129,11 @@
   publishSyncUpdate(updatePrefix, sm.getCombinedSeqNo());
 }
 
-void
-SyncLogicHandler::publishKeyUpdate(KeyManager& km)
-{
-  publishSyncUpdate(km.getProcessCertName().toUri(), km.getCertSeqNo());
-}
+// void
+// SyncLogicHandler::publishKeyUpdate(KeyManager& km)
+// {
+//   publishSyncUpdate(km.getProcessCertName().toUri(), km.getCertSeqNo());
+// }
 
 void
 SyncLogicHandler::publishIdentityUpdate(string identityName)
diff --git a/src/communication/sync-logic-handler.hpp b/src/communication/sync-logic-handler.hpp
index 8fd29fe..05123ff 100644
--- a/src/communication/sync-logic-handler.hpp
+++ b/src/communication/sync-logic-handler.hpp
@@ -10,7 +10,7 @@
 
 #include "sequencing-manager.hpp"
 
-class KeyManager;
+// class KeyManager;
 
 extern "C" {
 #include <unistd.h>
@@ -46,8 +46,8 @@
   void
   publishRoutingUpdate(SequencingManager& sm, string updatePrefix);
 
-  void
-  publishKeyUpdate(KeyManager& km);
+  // void
+  // publishKeyUpdate(KeyManager& km);
 
   void
   publishIdentityUpdate(string identityName);
@@ -67,8 +67,8 @@
   processRoutingUpdateFromSync(std::string routerName, uint64_t seqNo,
                                Nlsr& pnlsr);
 
-  void
-  processKeysUpdateFromSync(std::string certName, uint64_t seqNo, Nlsr& pnlsr);
+  // void
+  // processKeysUpdateFromSync(std::string certName, uint64_t seqNo, Nlsr& pnlsr);
 
   void
   publishSyncUpdate(string updatePrefix, uint64_t seqNo);
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index 70a07cf..53a9556 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -39,14 +39,14 @@
   m_nlsrLsdb.setLsaRefreshTime(m_confParam.getLsaRefreshTime());
   m_nlsrLsdb.setThisRouterPrefix(m_confParam.getRouterPrefix());
   m_fib.setEntryRefreshTime(2 * m_confParam.getLsaRefreshTime());
-  if (!m_km.initialize(m_confParam))
-  {
-    std::cerr << "Can not initiate/load certificate" << endl;
-  }
+  // if (!m_km.initialize(m_confParam))
+  // {
+  //   std::cerr << "Can not initiate/load certificate" << endl;
+  // }
   m_sm.setSeqFileName(m_confParam.getSeqFileDir());
   m_sm.initiateSeqNoFromFile();
   /* debugging purpose start */
-  cout <<	m_confParam;
+  cout << m_confParam;
   m_adl.printAdl();
   m_npl.print();
   /* debugging purpose end */
@@ -58,7 +58,7 @@
   setInterestFilterNlsr(m_confParam.getRootKeyPrefix());
   m_slh.setSyncPrefix(m_confParam.getChronosyncSyncPrefix());
   m_slh.createSyncSocket(boost::ref(*this));
-  m_slh.publishKeyUpdate(m_km);
+  // m_slh.publishKeyUpdate(m_km);
   m_im.scheduleInfoInterest(10);
 }
 
diff --git a/src/nlsr.hpp b/src/nlsr.hpp
index ac254c3..ffa4b05 100644
--- a/src/nlsr.hpp
+++ b/src/nlsr.hpp
@@ -15,7 +15,7 @@
 #include "route/routing-table.hpp"
 #include "route/npt.hpp"
 #include "route/fib.hpp"
-#include "security/key-manager.hpp"
+// #include "security/key-manager.hpp"
 #include "communication/sync-logic-handler.hpp"
 
 
@@ -41,7 +41,7 @@
     , m_im(*this)
     , m_dm(*this)
     , m_sm()
-    , m_km()
+    // , m_km()
     , m_isDaemonProcess(false)
     , m_configFileName("nlsr.conf")
     , m_nlsrLsdb()
@@ -127,11 +127,11 @@
     return m_nlsrFace;
   }
 
-  KeyManager&
-  getKeyManager()
-  {
-    return m_km;
-  }
+  // KeyManager&
+  // getKeyManager()
+  // {
+  //   return m_km;
+  // }
 
 
   InterestManager&
@@ -262,7 +262,7 @@
   InterestManager m_im;
   DataManager m_dm;
   SequencingManager m_sm;
-  KeyManager m_km;
+  // KeyManager m_km;
   bool m_isDaemonProcess;
   string m_configFileName;
 
diff --git a/src/security/certificate-store-entry.cpp b/src/security/certificate-store-entry.cpp.disable
similarity index 100%
rename from src/security/certificate-store-entry.cpp
rename to src/security/certificate-store-entry.cpp.disable
diff --git a/src/security/certificate-store-entry.hpp b/src/security/certificate-store-entry.hpp.disable
similarity index 100%
rename from src/security/certificate-store-entry.hpp
rename to src/security/certificate-store-entry.hpp.disable
diff --git a/src/security/certificate-store.cpp b/src/security/certificate-store.cpp.disable
similarity index 100%
rename from src/security/certificate-store.cpp
rename to src/security/certificate-store.cpp.disable
diff --git a/src/security/certificate-store.hpp b/src/security/certificate-store.hpp.disable
similarity index 100%
rename from src/security/certificate-store.hpp
rename to src/security/certificate-store.hpp.disable
diff --git a/src/security/key-manager.cpp b/src/security/key-manager.cpp.disable
similarity index 100%
rename from src/security/key-manager.cpp
rename to src/security/key-manager.cpp.disable
diff --git a/src/security/key-manager.hpp b/src/security/key-manager.hpp.disable
similarity index 100%
rename from src/security/key-manager.hpp
rename to src/security/key-manager.hpp.disable
diff --git a/src/security/waiting-list-entry.cpp b/src/security/waiting-list-entry.cpp.disable
similarity index 100%
rename from src/security/waiting-list-entry.cpp
rename to src/security/waiting-list-entry.cpp.disable
diff --git a/src/security/waiting-list-entry.hpp b/src/security/waiting-list-entry.hpp.disable
similarity index 100%
rename from src/security/waiting-list-entry.hpp
rename to src/security/waiting-list-entry.hpp.disable
diff --git a/src/security/waiting-list.cpp b/src/security/waiting-list.cpp.disable
similarity index 100%
rename from src/security/waiting-list.cpp
rename to src/security/waiting-list.cpp.disable
diff --git a/src/security/waiting-list.hpp b/src/security/waiting-list.hpp.disable
similarity index 100%
rename from src/security/waiting-list.hpp
rename to src/security/waiting-list.hpp.disable