diff --git a/src/security/nlsr_cert_store.cpp b/src/security/nlsr_cert_store.cpp
index d1e821a..897d44a 100644
--- a/src/security/nlsr_cert_store.cpp
+++ b/src/security/nlsr_cert_store.cpp
@@ -1,4 +1,8 @@
+#include <ndn-cpp-dev/security/signature-sha256-with-rsa.hpp> 
+#include <ndn-cpp-dev/security/key-chain.hpp>
 #include "nlsr_cert_store.hpp"
+#include "nlsr_wle.hpp"
+#include "nlsr_km.hpp"
 
 namespace nlsr
 {
@@ -6,9 +10,13 @@
   nlsrCertificateStoreEntryCompare(NlsrCertificateStoreEntry& ncse1,
                                    NlsrCertificateStoreEntry& ncse2)
 
-  {
-    return ncse1.getCert()->getName().toUri() ==
-           ncse2.getCert()->getName().toUri() ;
+  {    
+    int sizeDiff=ncse1.getCert()->getName().size()-
+                                              ncse2.getCert()->getName().size();
+    return (ncse2.getCert()->getName().isPrefixOf(ncse1.getCert()->getName()) &&
+                                               (sizeDiff <= 1 && sizeDiff>= 0));
+  
+    
   }
 
   static bool
@@ -17,8 +25,59 @@
 
   {
     ndn::Name ccn(compCertName);
-    return ( ncse1.getCert()->getName().toUri() == compCertName ||
-             ccn.isPrefixOf(ncse1.getCert()->getName()) );
+    int sizeDiff= ncse1.getCert()->getName().size() -ccn.size();
+    return ( ccn.isPrefixOf(ncse1.getCert()->getName()) &&
+                                               (sizeDiff <= 1 && sizeDiff>= 0));
+  }
+  
+  void 
+  NlsrCertificateStore::updateWaitingList(std::string respCertName)
+  {
+    ndn::Name tmpName(respCertName);
+    respCertName=tmpName.getPrefix(-1).toUri();
+    std::pair<WaitingListEntry, bool> chkWle=
+                              waitingList.getWaitingListEntry(respCertName);
+    if( chkWle.second )
+    {
+      std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool> sc=
+                                          getCertificateFromStore(respCertName);
+      std::list<std::string> waitees=(chkWle.first).getWaitingCerts();
+      for(std::list<std::string>::iterator it = waitees.begin();
+                                                       it != waitees.end();++it)
+      {
+        KeyManager km;
+        std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool> wc=
+                                                 getCertificateFromStore(*(it));
+        if( wc.second && sc.second )
+        {
+          if(km.verifySignature(*(wc.first),sc.first->getPublicKeyInfo()))
+          {
+            //1. Update Certificate Store
+            setCertificateIsVerified(*(it),true);
+            //2. Call updateWaitingList for waitee ( *(it) )
+            updateWaitingList(*(it));
+          }
+        }
+      }
+    }
+    
+    //remove that entry from waiting list
+    waitingList.removeFromWaitingList(respCertName);
+  }
+  
+  void
+  NlsrCertificateStore::updateWaitingList(NlsrCertificateStoreEntry& ncse)
+  {
+    if( ncse.getIsSignerVerified())
+    {
+      updateWaitingList(ncse.getCert()->getName().toUri());
+    }
+    else
+    {
+      ndn::SignatureSha256WithRsa signature(ncse.getCert()->getSignature());
+      waitingList.addtoWaitingList(signature.getKeyLocator().getName().toUri(), 
+                                             ncse.getCert()->getName().toUri());
+    }
   }
 
   bool
@@ -30,14 +89,16 @@
     if(it == certTable.end())
     {
       certTable.push_back(ncse);
+      updateWaitingList(ncse);
       return true;
     }
-    if( it !=  certTable.end() )
+    else if( it !=  certTable.end() )
     {
       if ( (*it).getCertSeqNum() < ncse.getCertSeqNum() )
       {
         certTable.erase(it);
         certTable.push_back(ncse);
+        updateWaitingList(ncse);
         return true;
       }
     }
@@ -52,6 +113,48 @@
     return addCertificate(ncse);
   }
 
+  std::pair<uint32_t, bool>
+  NlsrCertificateStore::getCertificateSeqNum(std::string certName)
+  {
+    std::list<NlsrCertificateStoreEntry>::iterator it =
+      std::find_if( certTable.begin(), certTable.end(),
+                    bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
+    if(it == certTable.end())
+    {
+      return std::make_pair(0,false);
+    }
+    return std::make_pair((*it).getCertSeqNum(),true);
+  }
+  
+ 
+  
+  void 
+  NlsrCertificateStore::setCertificateIsVerified(std::string certName, 
+                                                                bool isVerified)
+  {
+    std::list<NlsrCertificateStoreEntry>::iterator it =
+      std::find_if( certTable.begin(), certTable.end(),
+                    bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
+    if(it != certTable.end())
+    {
+      it->setIsSignerVerified(true);
+    }
+  }
+  
+  bool
+  NlsrCertificateStore::getCertificateIsVerified( std::string certName )
+  {
+    std::list<NlsrCertificateStoreEntry>::iterator it =
+      std::find_if( certTable.begin(), certTable.end(),
+                    bind(&nlsrCertificateStoreEntryCompareByName, _1, certName));
+    if(it != certTable.end())
+    {
+      return it->getIsSignerVerified();
+    }
+    
+    return false;
+  }
+
   std::pair<ndn::shared_ptr<ndn::IdentityCertificate>, bool>
   NlsrCertificateStore::getCertificateFromStore(const std::string certName)
   {
@@ -61,7 +164,7 @@
     if(it == certTable.end())
     {
       ndn::shared_ptr<ndn::IdentityCertificate> cert=
-        ndn::make_shared<ndn::IdentityCertificate>();
+                                    ndn::make_shared<ndn::IdentityCertificate>();
       return std::make_pair(cert,false);
     }
     return std::make_pair((*it).getCert(),true);
@@ -126,5 +229,6 @@
     {
       std::cout<<(*it)<<std::endl;
     }
+    std::cout<<waitingList<<std::endl;
   }
 }
