diff --git a/ChronoSync b/ChronoSync
index 6e235db..0cb0f2b 160000
--- a/ChronoSync
+++ b/ChronoSync
@@ -1 +1 @@
-Subproject commit 6e235db7ec1df8e6a26c28345b9e9341f84823ce
+Subproject commit 0cb0f2bcc689e6b771393036f283f035465c7c87
diff --git a/src/addcontactpanel.cpp b/src/addcontactpanel.cpp
index f43cddb..dc6618f 100644
--- a/src/addcontactpanel.cpp
+++ b/src/addcontactpanel.cpp
@@ -13,7 +13,7 @@
 #include <QMessageBox>
 
 #ifndef Q_MOC_RUN
-#include <ndn-cpp/security/signature/sha256-with-rsa-handler.hpp>
+#include <ndn-cpp/security/verifier.hpp>
 #include <boost/iostreams/stream.hpp>
 #include "null-ptrs.h"
 #include "endorse-collection.pb.h"
@@ -207,7 +207,8 @@
 {
   // _LOG_TRACE("displayContactInfo");
   const Profile& profile = m_currentEndorseCertificate->getProfileData().getProfile();
-  const Blob& profileBlob = m_currentEndorseCertificate->getProfileData().getContent();
+  const Block& profileContent = m_currentEndorseCertificate->getProfileData().getContent();
+  Buffer profileBlock(profileContent.value(), profileContent.value_size());
 
   map<string, int> endorseCount;
 
@@ -216,7 +217,8 @@
       Chronos::EndorseCollection endorseCollection;
       
       boost::iostreams::stream
-        <boost::iostreams::array_source> is ((const char*)m_currentCollectEndorse->getContent().buf(), m_currentCollectEndorse->getContent().size());
+        <boost::iostreams::array_source> is (reinterpret_cast<const char*>(m_currentCollectEndorse->getContent().value()), 
+                                             m_currentCollectEndorse->getContent().value_size());
       
       endorseCollection.ParseFromIstream(&is);
 
@@ -224,7 +226,8 @@
         {
           try{
             Data data;
-            data.wireDecode((const uint8_t*)endorseCollection.endorsement(i).blob().c_str(), endorseCollection.endorsement(i).blob().size());
+            data.wireDecode(Block(reinterpret_cast<const uint8_t*>(endorseCollection.endorsement(i).blob().c_str()),
+                                  endorseCollection.endorsement(i).blob().size()));
             EndorseCertificate endorseCert(data);
             
             Name signerKeyName = endorseCert.getSigner();
@@ -237,11 +240,12 @@
             if(!contact->isIntroducer() || !contact->canBeTrustedFor(m_currentEndorseCertificate->getProfileData().getIdentityName()))
               continue;
           
-            if(!Sha256WithRsaHandler::verifySignature(data, contact->getSelfEndorseCertificate().getPublicKeyInfo()))
+            if(!Verifier::verifySignature(data, data.getSignature(), contact->getSelfEndorseCertificate().getPublicKeyInfo()))
               continue;
 
-            const Blob& tmpProfileBlob = endorseCert.getProfileData().getContent();
-            if(!isSameBlob(profileBlob, tmpProfileBlob))
+            const Block& tmpProfileContent = endorseCert.getProfileData().getContent();
+            Buffer tmpProfileBlock(tmpProfileContent.value(), tmpProfileContent.value_size());
+            if(profileBlock != tmpProfileBlock)
               continue;
 
           const vector<string>& endorseList = endorseCert.getEndorseList();
@@ -286,26 +290,26 @@
   }
 }
 
-bool
-AddContactPanel::isSameBlob(const ndn::Blob& blobA, const ndn::Blob& blobB)
-{
-  size_t size = blobA.size();
+// bool
+// AddContactPanel::isSameBlob(const ndn::Blob& blobA, const ndn::Blob& blobB)
+// {
+//   size_t size = blobA.size();
 
-  if(size != blobB.size())
-    return false;
+//   if(size != blobB.size())
+//     return false;
 
-  const uint8_t* ap = blobA.buf();
-  const uint8_t* bp = blobB.buf();
+//   const uint8_t* ap = blobA.buf();
+//   const uint8_t* bp = blobB.buf();
   
-  for(int i = 0; i < size; i++)
-    {
-      if(ap[i] != bp[i])
-        return false;
-    }
+//   for(int i = 0; i < size; i++)
+//     {
+//       if(ap[i] != bp[i])
+//         return false;
+//     }
 
-  return true;
+//   return true;
 
-}
+// }
 
 
 #if WAF
diff --git a/src/addcontactpanel.h b/src/addcontactpanel.h
index efc1dc0..4ecf3bd 100644
--- a/src/addcontactpanel.h
+++ b/src/addcontactpanel.h
@@ -48,8 +48,8 @@
   bool
   isCorrectName(const ndn::Name& name);
 
-  static bool
-  isSameBlob(const ndn::Blob& blobA, const ndn::Blob& blobB);
+  // static bool
+  // isSameBlob(const ndn::Blob& blobA, const ndn::Blob& blobB);
 
 private slots:
   void
diff --git a/src/browsecontactdialog.cpp b/src/browsecontactdialog.cpp
index 58396ba..c84b5f9 100644
--- a/src/browsecontactdialog.cpp
+++ b/src/browsecontactdialog.cpp
@@ -17,7 +17,6 @@
 #include <boost/asio.hpp>
 #include <boost/tokenizer.hpp>
 #include "logging.h"
-#include "exception.h"
 // #include "ndn.cxx/error.h"
 #endif
 
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
diff --git a/src/chatdialog.cpp b/src/chatdialog.cpp
index c2d498d..cd7a7ea 100644
--- a/src/chatdialog.cpp
+++ b/src/chatdialog.cpp
@@ -21,7 +21,7 @@
 #include <sync-intro-certificate.h>
 #include <boost/random/random_device.hpp>
 #include <boost/random/uniform_int_distribution.hpp>
-#include <ndn-cpp/sha256-with-rsa-signature.hpp>
+#include <ndn-cpp/security/signature/signature-sha256-with-rsa.hpp>
 #include "logging.h"
 #endif
 
@@ -35,7 +35,6 @@
 Q_DECLARE_METATYPE(size_t)
 
 ChatDialog::ChatDialog(ndn::ptr_lib::shared_ptr<ContactManager> contactManager,
-                       ndn::ptr_lib::shared_ptr<ndn::IdentityManager> identityManager,
                        const ndn::Name& chatroomPrefix,
 		       const ndn::Name& localPrefix,
                        const ndn::Name& defaultIdentity,
@@ -49,7 +48,7 @@
   , m_localPrefix(localPrefix)
   , m_defaultIdentity(defaultIdentity)
   , m_invitationPolicyManager(new InvitationPolicyManager(m_chatroomPrefix.get(-1).toEscapedString(), m_defaultIdentity))
-  , m_identityManager(identityManager)
+  , m_keyChain(new ndn::KeyChain())
   , m_nick(nick)
   , m_sock(NULL)
   , m_lastMsgTime(0)
@@ -89,8 +88,8 @@
 
   startFace();
 
-  ndn::Name certificateName = m_identityManager->getDefaultCertificateNameForIdentity(m_defaultIdentity);
-  m_syncPolicyManager = ndn::ptr_lib::make_shared<SyncPolicyManager>(m_defaultIdentity, certificateName, m_chatroomPrefix, m_face, m_transport);
+  ndn::Name certificateName = m_keyChain->getDefaultCertificateNameForIdentity(m_defaultIdentity);
+  m_syncPolicyManager = ndn::ptr_lib::make_shared<SyncPolicyManager>(m_defaultIdentity, certificateName, m_chatroomPrefix, m_face);
 
   connect(ui->inviteButton, SIGNAL(clicked()),
           this, SLOT(openInviteListDialog()));
@@ -134,8 +133,7 @@
 void
 ChatDialog::startFace()
 {
-  m_transport = ndn::ptr_lib::make_shared<ndn::TcpTransport>();
-  m_face = ndn::ptr_lib::make_shared<ndn::Face>(m_transport, ndn::ptr_lib::make_shared<ndn::TcpTransport::ConnectionInfo>("localhost"));
+  m_face = ndn::ptr_lib::make_shared<ndn::Face>();
   
   connectToDaemon();
 
@@ -334,7 +332,7 @@
 {
   m_invitationPolicyManager->addTrustAnchor(contact->getSelfEndorseCertificate());
 
-  ndn::Name certificateName = m_identityManager->getDefaultCertificateNameForIdentity(m_defaultIdentity);
+  ndn::Name certificateName = m_keyChain->getDefaultCertificateNameForIdentity(m_defaultIdentity);
 
   ndn::Name interestName("/ndn/broadcast/chronos/invitation");
   interestName.append(contact->getNameSpace());
@@ -346,16 +344,11 @@
   interestName.append(certificateName);
 
   string signedUri = interestName.toUri();
-  ndn::Blob signedBlob((const uint8_t*)signedUri.c_str(), signedUri.size());
 
-  ndn::ptr_lib::shared_ptr<const ndn::Sha256WithRsaSignature> sha256sig = ndn::ptr_lib::dynamic_pointer_cast<const ndn::Sha256WithRsaSignature>(m_identityManager->signByCertificate(signedBlob.buf(), signedBlob.size(), certificateName));
-  const ndn::Blob& sigBits = sha256sig->getSignature();
+  ndn::Signature sig = m_keyChain->sign(reinterpret_cast<const uint8_t*>(signedUri.c_str()), signedUri.size(), certificateName);
+  const ndn::Block& sigValue = sig.getValue();
 
-  _LOG_DEBUG("size A: " << interestName.size());
-
-  interestName.append(sigBits);
-
-  _LOG_DEBUG("size B: " << interestName.size());
+  interestName.append(sigValue);
 
   //TODO... remove version from invitation interest
   //  interestName.appendVersion();
@@ -385,7 +378,7 @@
                                   const ndn::Name& identity, 
                                   bool isIntroducer)
 {
-  string content((const char*)data->getContent().buf(), data->getContent().size());
+  string content(reinterpret_cast<const char*>(data->getContent().value()), data->getContent().value_size());
   if(content == string("nack"))
     invitationRejected(identity);
   else
@@ -422,8 +415,8 @@
 ChatDialog::invitationAccepted(const ndn::Name& identity, ndn::ptr_lib::shared_ptr<ndn::Data> data, const string& inviteePrefix, bool isIntroducer)
 {
   _LOG_DEBUG(" " << identity.toUri() << " Accepted your invitation!");
-  const ndn::Sha256WithRsaSignature* sha256sig = dynamic_cast<const ndn::Sha256WithRsaSignature*>(data->getSignature());
-  const ndn::Name & keyLocatorName = sha256sig->getKeyLocator().getKeyName();
+  ndn::SignatureSha256WithRsa sig(data->getSignature());
+  const ndn::Name & keyLocatorName = sig.getKeyLocator().getName();
   ndn::ptr_lib::shared_ptr<ndn::IdentityCertificate> dskCertificate = m_invitationPolicyManager->getValidatedDskCertificate(keyLocatorName);
   m_syncPolicyManager->addChatDataRule(inviteePrefix, *dskCertificate, isIntroducer);
   publishIntroCert(*dskCertificate, isIntroducer);
@@ -434,15 +427,15 @@
 {
   SyncIntroCertificate syncIntroCertificate(m_chatroomPrefix,
                                             dskCertificate.getPublicKeyName(),
-                                            m_identityManager->getDefaultKeyNameForIdentity(m_defaultIdentity),
+                                            m_keyChain->getDefaultKeyNameForIdentity(m_defaultIdentity),
                                             dskCertificate.getNotBefore(),
                                             dskCertificate.getNotAfter(),
                                             dskCertificate.getPublicKeyInfo(),
                                             (isIntroducer ? SyncIntroCertificate::INTRODUCER : SyncIntroCertificate::PRODUCER));
-  ndn::Name certName = m_identityManager->getDefaultCertificateNameForIdentity(m_defaultIdentity);
+  ndn::Name certName = m_keyChain->getDefaultCertificateNameForIdentity(m_defaultIdentity);
   _LOG_DEBUG("Publish Intro Certificate: " << syncIntroCertificate.getName());
-  m_identityManager->signByCertificate(syncIntroCertificate, certName);
-  m_transport->send(*syncIntroCertificate.wireEncode());
+  m_keyChain->sign(syncIntroCertificate, certName);
+  m_face->put(syncIntroCertificate);
 }
 
 void
@@ -464,7 +457,6 @@
   m_sock = new Sync::SyncSocket(m_chatroomPrefix.toUri(),
                                 m_syncPolicyManager,
                                 m_face,
-                                m_transport,
                                 boost::bind(&ChatDialog::processTreeUpdateWrapper, this, _1, _2),
                                 boost::bind(&ChatDialog::processRemoveWrapper, this, _1));
   
@@ -604,8 +596,8 @@
 ChatDialog::processDataWrapper(const ndn::ptr_lib::shared_ptr<ndn::Data>& data)
 {
   string name = data->getName().toUri();
-  const char* buf = (const char*)data->getContent().buf();
-  size_t len = data->getContent().size();
+  const char* buf = reinterpret_cast<const char*>(data->getContent().value());
+  size_t len = data->getContent().value_size();
 
   char *tempBuf = new char[len];
   memcpy(tempBuf, buf, len);
@@ -617,8 +609,8 @@
 ChatDialog::processDataNoShowWrapper(const ndn::ptr_lib::shared_ptr<ndn::Data>& data)
 {
   string name = data->getName().toUri();
-  const char* buf = (const char*)data->getContent().buf();
-  size_t len = data->getContent().size();
+  const char* buf = reinterpret_cast<const char*>(data->getContent().value());
+  size_t len = data->getContent().value_size();
 
   char *tempBuf = new char[len];
   memcpy(tempBuf, buf, len);
@@ -899,7 +891,6 @@
       m_sock = new Sync::SyncSocket(m_chatroomPrefix.toUri(),
                                     m_syncPolicyManager,
                                     m_face,
-                                    m_transport,
                                     bind(&ChatDialog::processTreeUpdateWrapper, this, _1, _2),
                                     bind(&ChatDialog::processRemoveWrapper, this, _1));
       usleep(100000);
@@ -1050,8 +1041,7 @@
   m_newLocalPrefixReady = false;
   ndn::Name interestName("/local/ndn/prefix");
   ndn::Interest interest(interestName);
-  interest.setChildSelector(ndn_Interest_CHILD_SELECTOR_RIGHT);
-  interest.setInterestLifetimeMilliseconds(1000);
+  interest.setInterestLifetime(1000);
 
   m_face->expressInterest(interest, 
                           bind(&ChatDialog::onLocalPrefix, this, _1, _2), 
@@ -1078,7 +1068,7 @@
 ChatDialog::onLocalPrefix(const ndn::ptr_lib::shared_ptr<const ndn::Interest>& interest, 
                           const ndn::ptr_lib::shared_ptr<ndn::Data>& data)
 {
-  string dataString((const char*)data->getContent().buf(), data->getContent().size());
+  string dataString(reinterpret_cast<const char*>(data->getContent().value()), data->getContent().value_size());
   QString originPrefix = QString::fromStdString (dataString).trimmed ();
   string trimmedString = originPrefix.toStdString();
   m_newLocalPrefix = ndn::Name(trimmedString);
diff --git a/src/chatdialog.h b/src/chatdialog.h
index be2c89b..a4b168f 100644
--- a/src/chatdialog.h
+++ b/src/chatdialog.h
@@ -25,7 +25,7 @@
 #ifndef Q_MOC_RUN
 #include <ndn-cpp/data.hpp>
 #include <ndn-cpp/face.hpp>
-#include <ndn-cpp/security/identity/identity-manager.hpp>
+#include <ndn-cpp/security/key-chain.hpp>
 #include "invitation-policy-manager.h"
 #include "contact-item.h"
 
@@ -53,7 +53,6 @@
 
 public:
   explicit ChatDialog(ndn::ptr_lib::shared_ptr<ContactManager> contactManager,
-                      ndn::ptr_lib::shared_ptr<ndn::IdentityManager> identityManager,
                       const ndn::Name& chatroomPrefix,
                       const ndn::Name& localPrefix,
                       const ndn::Name& defaultIdentity,
@@ -344,9 +343,8 @@
   ndn::Name m_defaultIdentity;
   ndn::ptr_lib::shared_ptr<InvitationPolicyManager> m_invitationPolicyManager;
   ndn::ptr_lib::shared_ptr<SyncPolicyManager> m_syncPolicyManager; 
-  ndn::ptr_lib::shared_ptr<ndn::IdentityManager> m_identityManager;
+  ndn::ptr_lib::shared_ptr<ndn::KeyChain> m_keyChain;
   ndn::ptr_lib::shared_ptr<ndn::Face> m_face;
-  ndn::ptr_lib::shared_ptr<ndn::Transport> m_transport;
 
   boost::recursive_mutex m_mutex;
   boost::thread m_thread;
diff --git a/src/chronos-invitation.cpp b/src/chronos-invitation.cpp
index fb9d918..7912a2d 100644
--- a/src/chronos-invitation.cpp
+++ b/src/chronos-invitation.cpp
@@ -11,7 +11,6 @@
 #include "chronos-invitation.h"
 
 #include <ndn-cpp/security/certificate/identity-certificate.hpp>
-#include "exception.h"
 #include "logging.h"
 
 using namespace std;
@@ -27,7 +26,7 @@
      || interestName.get(1).toEscapedString() != string("broadcast")
      || interestName.get(2).toEscapedString() != string("chronos")
      || interestName.get(3).toEscapedString() != string("invitation"))
-    throw LnException("Wrong ChronosInvitation Name");
+    throw Error("Wrong ChronosInvitation Name");
     
   int i = 4;
   int size = interestName.size();
@@ -39,7 +38,7 @@
       break;
 
   if(i >= size)
-    throw LnException("Wrong ChronosInvitation Name, No chatroom tag");
+    throw Error("Wrong ChronosInvitation Name, No chatroom tag");
   m_inviteeNameSpace = interestName.getSubName(inviteeBegin, i - inviteeBegin);
 
   string inviterPrefixStr("inviter-prefix");
@@ -49,7 +48,7 @@
       break;
 
   if(i > size)
-    throw LnException("Wrong ChronosInvitation Name, No inviter-prefix tag");
+    throw Error("Wrong ChronosInvitation Name, No inviter-prefix tag");
   m_chatroom = interestName.getSubName(chatroomBegin, i - chatroomBegin);
 
   string inviterStr("inviter");
@@ -59,7 +58,7 @@
       break;
   
   if(i > size)
-    throw LnException("Wrong ChronosInvitation Name, No inviter tag");
+    throw Error("Wrong ChronosInvitation Name, No inviter tag");
   m_inviterPrefix = interestName.getSubName(inviterPrefixBegin, i - inviterPrefixBegin);
 
   int inviterCertBegin = (++i);
@@ -71,7 +70,7 @@
   m_inviterNameSpace = keyName.getPrefix(-1);
 
   string signedName = interestName.getSubName(0, size - 1).toUri();
-  m_signedBlob = Blob((const uint8_t*)signedName.c_str(), signedName.size());
+  m_signedBlob = Buffer(signedName.c_str(), signedName.size());
 }
 
 ChronosInvitation::ChronosInvitation(const ChronosInvitation& invitation)
diff --git a/src/chronos-invitation.h b/src/chronos-invitation.h
index e343b15..98380e8 100644
--- a/src/chronos-invitation.h
+++ b/src/chronos-invitation.h
@@ -17,6 +17,8 @@
 class ChronosInvitation
 {
 public:
+  struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} };
+
   ChronosInvitation() {}
 
   ChronosInvitation(const ndn::Name& interestName);
@@ -42,7 +44,7 @@
   getInviterCertificateName() const
   { return m_inviterCertificateName; }
 
-  const ndn::Blob&
+  const ndn::Buffer&
   getSignatureBits() const
   { return m_signatureBits; }
 
@@ -50,7 +52,7 @@
   getInviterNameSpace() const
   { return m_inviterNameSpace; }
 
-  const ndn::Blob&
+  const ndn::Buffer&
   getSignedBlob() const
   { return m_signedBlob; }
   
@@ -65,10 +67,10 @@
   ndn::Name m_chatroom;
   ndn::Name m_inviterPrefix;
   ndn::Name m_inviterCertificateName;
-  ndn::Blob m_signatureBits;
+  ndn::Buffer m_signatureBits;
   ndn::Name m_inviterNameSpace;
 
-  ndn::Blob m_signedBlob;
+  ndn::Buffer m_signedBlob;
 };
 
 #endif
diff --git a/src/contact-item.cpp b/src/contact-item.cpp
index 46cc4a3..8c02b29 100644
--- a/src/contact-item.cpp
+++ b/src/contact-item.cpp
@@ -9,7 +9,6 @@
  */
 
 #include "contact-item.h"
-#include "exception.h"
 #include "null-ptrs.h"
 
 #include "logging.h"
diff --git a/src/contact-manager.cpp b/src/contact-manager.cpp
index b940bd8..3095177 100644
--- a/src/contact-manager.cpp
+++ b/src/contact-manager.cpp
@@ -8,12 +8,25 @@
  * Author: Yingdi Yu <yingdi@cs.ucla.edu>
  */
 
+#if __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wreorder"
+#pragma clang diagnostic ignored "-Wtautological-compare"
+#pragma clang diagnostic ignored "-Wunused-variable"
+#pragma clang diagnostic ignored "-Wunused-function"
+#elif __GNUC__
+#pragma GCC diagnostic ignored "-Wreorder"
+#pragma GCC diagnostic ignored "-Wunused-variable"
+#pragma GCC diagnostic ignored "-Wunused-function"
+#endif
+
+
 #include "contact-manager.h"
 
 #ifndef Q_MOC_RUN
 #include <ndn-cpp/face.hpp>
-#include <ndn-cpp/sha256-with-rsa-signature.hpp>
-#include <ndn-cpp/security/signature/sha256-with-rsa-handler.hpp>
+#include <ndn-cpp/security/signature/signature-sha256-with-rsa.hpp>
+#include <ndn-cpp/security/verifier.hpp>
 #include <cryptopp/base64.h>
 #include <ndn-cpp-et/policy-manager/identity-policy-rule.hpp>
 #include <fstream>
@@ -28,15 +41,13 @@
 
 INIT_LOGGER("ContactManager");
 
-ContactManager::ContactManager(shared_ptr<IdentityManager> identityManager, 
+ContactManager::ContactManager(shared_ptr<KeyChain> keyChain, 
                                shared_ptr<Face> face,
-                               shared_ptr<Transport> transport,
                                QObject* parent)
   : QObject(parent),
-    m_face(face),
-    m_transport(transport)
+    m_face(face)
 {
-  m_identityManager = identityManager;
+  m_keyChain = keyChain;
   m_contactStorage = make_shared<ContactStorage>();
   m_dnsStorage = make_shared<DnsStorage>();
 
@@ -46,30 +57,6 @@
 ContactManager::~ContactManager()
 {}
 
-// void
-// ContactManager::connectToDaemon()
-// {
-//   //Hack! transport does not connect to daemon unless an interest is expressed.
-//   Name name("/ndn");
-//   shared_ptr<ndn::Interest> interest = make_shared<ndn::Interest>(name);
-//   m_face->expressInterest(*interest, 
-//                           bind(&ContactManager::onConnectionData, this, _1, _2),
-//                           bind(&ContactManager::onConnectionDataTimeout, this, _1));
-// }
-
-// void
-// ContactManager::onConnectionData(const shared_ptr<const ndn::Interest>& interest,
-//                             const shared_ptr<Data>& data)
-// {
-//   _LOG_DEBUG("onConnectionData");
-// }
-
-// void
-// ContactManager::onConnectionDataTimeout(const shared_ptr<const ndn::Interest>& interest)
-// {
-//   _LOG_DEBUG("onConnectionDataTimeout");
-// }
-
 void
 ContactManager::initializeSecurity()
 {
@@ -124,7 +111,7 @@
                             true,
                             new CryptoPP::Base64Decoder(new CryptoPP::StringSink(decoded)));
   Data data;
-  data.wireDecode((const uint8_t*)decoded.c_str(), decoded.size());
+  data.wireDecode(Block(reinterpret_cast<const uint8_t*>(decoded.c_str()), decoded.size()));
   shared_ptr<IdentityCertificate> anchor = make_shared<IdentityCertificate>(data);
   m_policyManager->addTrustAnchor(anchor);  
 
@@ -154,7 +141,7 @@
                             true,
                             new CryptoPP::Base64Decoder(new CryptoPP::StringSink(decoded2)));
   Data data2;
-  data2.wireDecode((const uint8_t*)decoded2.c_str(), decoded2.size());
+  data2.wireDecode(Block(reinterpret_cast<const uint8_t*>(decoded.c_str()), decoded.size()));
   shared_ptr<IdentityCertificate>anchor2 = make_shared<IdentityCertificate>(data2);
   m_policyManager->addTrustAnchor(anchor2);  
 
@@ -169,11 +156,10 @@
   interestName.append("DNS").append("PROFILE");
   
   Interest interest(interestName);
-  interest.setChildSelector(ndn_Interest_CHILD_SELECTOR_RIGHT);
 
-  OnVerified onVerified = boost::bind(&ContactManager::onDnsSelfEndorseCertificateVerified, this, _1, identity);
-  OnVerifyFailed onVerifyFailed = boost::bind(&ContactManager::onDnsSelfEndorseCertificateVerifyFailed, this, _1, identity);
-  TimeoutNotify timeoutNotify = boost::bind(&ContactManager::onDnsSelfEndorseCertificateTimeoutNotify, this, identity);
+  OnVerified onVerified = func_lib::bind(&ContactManager::onDnsSelfEndorseCertificateVerified, this, _1, identity);
+  OnVerifyFailed onVerifyFailed = func_lib::bind(&ContactManager::onDnsSelfEndorseCertificateVerifyFailed, this, _1, identity);
+  TimeoutNotify timeoutNotify = func_lib::bind(&ContactManager::onDnsSelfEndorseCertificateTimeoutNotify, this, identity);
 
   sendInterest(interest, onVerified, onVerifyFailed, timeoutNotify);
 }
@@ -188,9 +174,9 @@
 {
   try{
     Data plainData;
-    plainData.wireDecode(data->getContent().buf(), data->getContent().size());
+    plainData.wireDecode(Block(data->getContent().value(), data->getContent().value_size()));
     EndorseCertificate selfEndorseCertificate(plainData);
-    if(Sha256WithRsaHandler::verifySignature(plainData, selfEndorseCertificate.getPublicKeyInfo()))
+    if(Verifier::verifySignature(plainData, plainData.getSignature(), selfEndorseCertificate.getPublicKeyInfo()))
       emit contactFetched (selfEndorseCertificate); 
     else
       emit contactFetchFailed (identity);
@@ -212,12 +198,11 @@
   interestName.append("DNS").append("ENDORSED");
 
   Interest interest(interestName);
-  interest.setChildSelector(ndn_Interest_CHILD_SELECTOR_RIGHT);
-  interest.setInterestLifetimeMilliseconds(1000);
+  interest.setInterestLifetime(1000);
 
-  OnVerified onVerified = boost::bind(&ContactManager::onDnsCollectEndorseVerified, this, _1, identity);
-  OnVerifyFailed onVerifyFailed = boost::bind(&ContactManager::onDnsCollectEndorseVerifyFailed, this, _1, identity);
-  TimeoutNotify timeoutNotify = boost::bind(&ContactManager::onDnsCollectEndorseTimeoutNotify, this, identity);
+  OnVerified onVerified = func_lib::bind(&ContactManager::onDnsCollectEndorseVerified, this, _1, identity);
+  OnVerifyFailed onVerifyFailed = func_lib::bind(&ContactManager::onDnsCollectEndorseVerifyFailed, this, _1, identity);
+  TimeoutNotify timeoutNotify = func_lib::bind(&ContactManager::onDnsCollectEndorseTimeoutNotify, this, identity);
 
   sendInterest(interest, onVerified, onVerifyFailed, timeoutNotify);
 }
@@ -243,12 +228,11 @@
   Name interestName = certName;
   
   Interest interest(interestName);
-  interest.setChildSelector(ndn_Interest_CHILD_SELECTOR_RIGHT);
-  interest.setInterestLifetimeMilliseconds(1000);
+  interest.setInterestLifetime(1000);
 
-  OnVerified onVerified = boost::bind(&ContactManager::onKeyVerified, this, _1, certName);
-  OnVerifyFailed onVerifyFailed = boost::bind(&ContactManager::onKeyVerifyFailed, this, _1, certName);
-  TimeoutNotify timeoutNotify = boost::bind(&ContactManager::onKeyTimeoutNotify, this, certName);
+  OnVerified onVerified = func_lib::bind(&ContactManager::onKeyVerified, this, _1, certName);
+  OnVerifyFailed onVerifyFailed = func_lib::bind(&ContactManager::onKeyVerifyFailed, this, _1, certName);
+  TimeoutNotify timeoutNotify = func_lib::bind(&ContactManager::onKeyTimeoutNotify, this, certName);
 
   sendInterest(interest, onVerified, onVerifyFailed, timeoutNotify);
 }
@@ -262,12 +246,12 @@
   Profile profile(identityCertificate);
   ProfileData profileData(profile);
 
-  Name certificateName = m_identityManager->getDefaultCertificateName();
-  m_identityManager->signByCertificate(profileData, certificateName);
+  Name certificateName = m_keyChain->getDefaultCertificateName();
+  m_keyChain->sign(profileData, certificateName);
 
   try{
     EndorseCertificate endorseCertificate(identityCertificate, profileData);
-    m_identityManager->signByCertificate(endorseCertificate, certificateName);
+    m_keyChain->sign(endorseCertificate, certificateName);
     emit contactKeyFetched (endorseCertificate); 
   }catch(std::exception& e){
     _LOG_ERROR("Exception: " << e.what());
@@ -295,8 +279,7 @@
   Name interestName = certName;
   
   Interest interest(interestName);
-  interest.setChildSelector(ndn_Interest_CHILD_SELECTOR_RIGHT);
-  interest.setInterestLifetimeMilliseconds(1000);
+  interest.setInterestLifetime(1000);
 
   OnVerified onVerified = boost::bind(&ContactManager::onIdCertificateVerified, this, _1, certName);
   OnVerifyFailed onVerifyFailed = boost::bind(&ContactManager::onIdCertificateVerifyFailed, this, _1, certName);
@@ -426,7 +409,7 @@
                                       onVerifyFailed,
                                       timeoutNotify));
 
-  _LOG_DEBUG("id: " << id << " entry id: " << m_face->getNode().getEntryIndexForExpressedInterest(interest.getName()));
+  // _LOG_DEBUG("id: " << id << " entry id: " << m_face->getNode().getEntryIndexForExpressedInterest(interest.getName()));
 }
 
 void
@@ -443,11 +426,12 @@
     return;
 
   // Check if profile exists
-  Blob profileDataBlob = m_contactStorage->getSelfEndorseCertificate(identity);
-  if(CHRONOCHAT_NULL_BLOB != profileDataBlob)
+  try{
+    Block profileDataBlob = m_contactStorage->getSelfEndorseCertificate(identity);
     m_contactStorage->updateSelfEndorseCertificate(*newEndorseCertificate, identity);
-  else
+  }catch(ContactStorage::Error &e){
     m_contactStorage->addSelfEndorseCertificate(*newEndorseCertificate, identity);
+  }
 
   publishSelfEndorseCertificateInDNS(*newEndorseCertificate);
 }
@@ -455,17 +439,18 @@
 void
 ContactManager::updateEndorseCertificate(const ndn::Name& identity, const ndn::Name& signerIdentity)
 {
-  Blob oldEndorseCertificateBlob = m_contactStorage->getEndorseCertificate(identity);
   shared_ptr<EndorseCertificate> newEndorseCertificate = generateEndorseCertificate(identity, signerIdentity);
 
   if(CHRONOCHAT_NULL_ENDORSECERTIFICATE_PTR == newEndorseCertificate)
     return;
 
-  if(CHRONOCHAT_NULL_BLOB != oldEndorseCertificateBlob)
+  try{
+    Block oldEndorseCertificateBlob = m_contactStorage->getEndorseCertificate(identity);
     m_contactStorage->updateEndorseCertificate(*newEndorseCertificate, identity);
-  else
+  }catch(ContactStorage::Error &e){
     m_contactStorage->addEndorseCertificate(*newEndorseCertificate, identity);
- 
+  }
+
   publishEndorseCertificateInDNS(*newEndorseCertificate, signerIdentity);
 }
 
@@ -476,8 +461,8 @@
   if(contact == CHRONOCHAT_NULL_CONTACTITEM_PTR)
     return CHRONOCHAT_NULL_ENDORSECERTIFICATE_PTR;
 
-  Name signerKeyName = m_identityManager->getDefaultKeyNameForIdentity(signerIdentity);
-  Name signerCertName = m_identityManager->getDefaultCertificateNameForIdentity(signerIdentity);
+  Name signerKeyName = m_keyChain->getDefaultKeyNameForIdentity(signerIdentity);
+  Name signerCertName = m_keyChain->getDefaultCertificateNameForIdentity(signerIdentity);
 
   vector<string> endorseList;
   m_contactStorage->getEndorseList(identity, endorseList);
@@ -485,7 +470,7 @@
   
   try{
     shared_ptr<EndorseCertificate> cert = make_shared<EndorseCertificate>(contact->getSelfEndorseCertificate(), signerKeyName, endorseList); 
-    m_identityManager->signByCertificate(*cert, signerCertName);
+    m_keyChain->sign(*cert, signerCertName);
     return cert;
   }catch(std::exception& e){
     _LOG_ERROR("Exception: " << e.what());
@@ -505,14 +490,14 @@
 ContactManager::getSignedSelfEndorseCertificate(const Name& identity,
                                                 const Profile& profile)
 {
-  Name certificateName = m_identityManager->getDefaultCertificateNameForIdentity(identity);
+  Name certificateName = m_keyChain->getDefaultCertificateNameForIdentity(identity);
   if(0 == certificateName.size())
     return CHRONOCHAT_NULL_ENDORSECERTIFICATE_PTR;
 
   ProfileData profileData(profile);
-  m_identityManager->signByCertificate(profileData, certificateName);
+  m_keyChain->sign(profileData, certificateName);
 
-  shared_ptr<IdentityCertificate> signingCert = m_identityManager->getCertificate(certificateName);
+  shared_ptr<IdentityCertificate> signingCert = m_keyChain->getCertificate(certificateName);
   if(CHRONOCHAT_NULL_IDENTITYCERTIFICATE_PTR == signingCert)
     return CHRONOCHAT_NULL_ENDORSECERTIFICATE_PTR;
 
@@ -521,14 +506,14 @@
   shared_ptr<IdentityCertificate> kskCert;
   if(signingKeyName.get(-1).toEscapedString().substr(0,4) == string("dsk-"))
     {
-      const Sha256WithRsaSignature* dskCertSig = dynamic_cast<const Sha256WithRsaSignature*>(signingCert->getSignature());
+      SignatureSha256WithRsa dskCertSig(signingCert->getSignature());
       // HACK! KSK certificate should be retrieved from network.
-      Name keyName = IdentityCertificate::certificateNameToPublicKeyName(dskCertSig->getKeyLocator().getKeyName());
+      Name keyName = IdentityCertificate::certificateNameToPublicKeyName(dskCertSig.getKeyLocator().getName());
 
       // TODO: check null existing cases.
-      Name kskCertName = m_identityManager->getDefaultCertificateNameForIdentity(keyName.getPrefix(-1));
+      Name kskCertName = m_keyChain->getDefaultCertificateNameForIdentity(keyName.getPrefix(-1));
 
-      kskCert = m_identityManager->getCertificate(kskCertName);
+      kskCert = m_keyChain->getCertificate(kskCertName);
     }
   else
     {
@@ -545,7 +530,7 @@
   
   try{
     shared_ptr<EndorseCertificate> selfEndorseCertificate = make_shared<EndorseCertificate>(*kskCert, profileData, endorseList);
-    m_identityManager->signByCertificate(*selfEndorseCertificate, kskCert->getName());
+    m_keyChain->sign(*selfEndorseCertificate, kskCert->getName());
 
     return selfEndorseCertificate;
   }catch(std::exception& e){
@@ -573,12 +558,12 @@
 
   data.setContent(selfEndorseCertificate.wireEncode());
 
-  Name signCertName = m_identityManager->getDefaultCertificateNameForIdentity(identity);
-  m_identityManager->signByCertificate(data, signCertName);
+  Name signCertName = m_keyChain->getDefaultCertificateNameForIdentity(identity);
+  m_keyChain->sign(data, signCertName);
 
   m_dnsStorage->updateDnsSelfProfileData(data, identity);
   
-   m_transport->send(*data.wireEncode());
+  m_face->put(data);
 }
 
 void
@@ -599,12 +584,12 @@
 
   data.setContent(endorseCertificate.wireEncode());
 
-  Name signCertName = m_identityManager->getDefaultCertificateNameForIdentity(signerIdentity);
-  m_identityManager->signByCertificate(data, signCertName);
+  Name signCertName = m_keyChain->getDefaultCertificateNameForIdentity(signerIdentity);
+  m_keyChain->sign(data, signCertName);
 
   m_dnsStorage->updateDnsEndorseOthers(data, signerIdentity, endorsee);
 
-  m_transport->send(*data.wireEncode());
+  m_face->put(data);
 }
 
 void
@@ -620,29 +605,29 @@
   dnsName.append("DNS").append("ENDORSED").appendVersion(version);
   data.setName(dnsName);
   
-  vector<Blob> collectEndorseList;
+  vector<Buffer> collectEndorseList;
   m_contactStorage->getCollectEndorseList(identity, collectEndorseList);
   
   Chronos::EndorseCollection endorseCollection;
 
-  vector<Blob>::const_iterator it = collectEndorseList.begin();
+  vector<Buffer>::const_iterator it = collectEndorseList.begin();
   for(; it != collectEndorseList.end(); it++)
     {
-      string entryStr((const char*)it->buf(), it->size());
+      string entryStr(reinterpret_cast<const char*>(it->buf()), it->size());
       endorseCollection.add_endorsement()->set_blob(entryStr);
     }
 
   string encoded;
   endorseCollection.SerializeToString(&encoded);
 
-  data.setContent((const uint8_t*)encoded.c_str(), encoded.size());
+  data.setContent(reinterpret_cast<const uint8_t*>(encoded.c_str()), encoded.size());
   
-  Name signCertName = m_identityManager->getDefaultCertificateNameForIdentity(identity);
-  m_identityManager->signByCertificate(data, signCertName);
+  Name signCertName = m_keyChain->getDefaultCertificateNameForIdentity(identity);
+  m_keyChain->sign(data, signCertName);
 
   m_dnsStorage->updateDnsOthersEndorse(data, identity);
 
-  m_transport->send(*data.wireEncode());
+  m_face->put(data);
 }
 
 void
@@ -650,14 +635,14 @@
 {
   ProfileData profileData(profile);
   
-  Name certificateName = m_identityManager->getDefaultCertificateNameForIdentity (m_defaultIdentity);
-  m_identityManager->signByCertificate(profileData, certificateName);
+  Name certificateName = m_keyChain->getDefaultCertificateNameForIdentity (m_defaultIdentity);
+  m_keyChain->sign(profileData, certificateName);
 
 
   try{
     EndorseCertificate endorseCertificate(identityCertificate, profileData);
     
-    m_identityManager->signByCertificate(endorseCertificate, certificateName);
+    m_keyChain->sign(endorseCertificate, certificateName);
 
     ContactItem contactItem(endorseCertificate);
 
diff --git a/src/contact-manager.h b/src/contact-manager.h
index d096abf..d27e1cb 100644
--- a/src/contact-manager.h
+++ b/src/contact-manager.h
@@ -19,6 +19,7 @@
 #include "endorse-certificate.h"
 #include "profile.h"
 #include <ndn-cpp/face.hpp>
+#include <ndn-cpp/security/key-chain.hpp>
 #include <ndn-cpp/security/policy/validation-request.hpp>
 #include <ndn-cpp-et/policy-manager/simple-policy-manager.hpp>
 #endif
@@ -30,9 +31,8 @@
   Q_OBJECT
 
 public:
-  ContactManager(ndn::ptr_lib::shared_ptr<ndn::IdentityManager> identityManager,
+  ContactManager(ndn::ptr_lib::shared_ptr<ndn::KeyChain> keyChain,
                  ndn::ptr_lib::shared_ptr<ndn::Face> m_face,
-                 ndn::ptr_lib::shared_ptr<ndn::Transport> m_transport,
                  QObject* parent = 0);
 
   ~ContactManager();
@@ -71,7 +71,7 @@
 
   ndn::Name
   getDefaultIdentity()
-  { return m_identityManager->getDefaultIdentity(); }
+  { return m_keyChain->getDefaultIdentity(); }
 
   void
   publishEndorsedDataInDns(const ndn::Name& identity);
@@ -86,21 +86,11 @@
   void
   removeContact(const ndn::Name& contactNameSpace);
   
-  ndn::ptr_lib::shared_ptr<ndn::IdentityManager>
-  getIdentityManager()
-  { return m_identityManager; }
+  // ndn::ptr_lib::shared_ptr<ndn::KeyChain>
+  // getKeyChain()
+  // { return m_keyChain; }
 
-private:
-  // void 
-  // connectToDaemon();
-
-  // void
-  // onConnectionData(const ndn::ptr_lib::shared_ptr<const ndn::Interest>& interest,
-  //                  const ndn::ptr_lib::shared_ptr<ndn::Data>& data);
- 
-  // void
-  // onConnectionDataTimeout(const ndn::ptr_lib::shared_ptr<const ndn::Interest>& interest);
-  
+private:  
   void
   initializeSecurity();
 
@@ -237,9 +227,8 @@
   ndn::ptr_lib::shared_ptr<ContactStorage> m_contactStorage;
   ndn::ptr_lib::shared_ptr<DnsStorage> m_dnsStorage;
   ndn::ptr_lib::shared_ptr<ndn::SimplePolicyManager> m_policyManager;
-  ndn::ptr_lib::shared_ptr<ndn::IdentityManager> m_identityManager;
+  ndn::ptr_lib::shared_ptr<ndn::KeyChain> m_keyChain;
   ndn::ptr_lib::shared_ptr<ndn::Face> m_face;
-  ndn::ptr_lib::shared_ptr<ndn::Transport> m_transport;
   ndn::Name m_defaultIdentity;
 };
 
diff --git a/src/contact-storage.cpp b/src/contact-storage.cpp
index 61ed746..7ea965c 100644
--- a/src/contact-storage.cpp
+++ b/src/contact-storage.cpp
@@ -10,7 +10,6 @@
 
 #include "contact-storage.h"
 #include "null-ptrs.h"
-#include "exception.h"
 
 #include <boost/filesystem.hpp>
 #include "logging.h"
@@ -118,7 +117,7 @@
 
   int res = sqlite3_open((chronosDir / "chronos.db").c_str (), &m_db);
   if (res != SQLITE_OK)
-    throw LnException("Chronos DB cannot be open/created");
+    throw Error("Chronos DB cannot be open/created");
 
   // Check if SelfProfile table exists
   sqlite3_stmt *stmt;
@@ -135,7 +134,7 @@
       char *errmsg = 0;
       res = sqlite3_exec (m_db, INIT_SP_TABLE.c_str (), NULL, NULL, &errmsg);
       if (res != SQLITE_OK && errmsg != 0)
-        throw LnException("Init \"error\" in SelfProfile");
+        throw Error("Init \"error\" in SelfProfile");
     }
 
   // Check if SelfEndorse table exists
@@ -152,7 +151,7 @@
       char *errmsg = 0;
       res = sqlite3_exec (m_db, INIT_SE_TABLE.c_str (), NULL, NULL, &errmsg);
       if (res != SQLITE_OK && errmsg != 0)
-        throw LnException("Init \"error\" in SelfEndorse");
+        throw Error("Init \"error\" in SelfEndorse");
     }
 
 
@@ -170,7 +169,7 @@
       char *errmsg = 0;
       res = sqlite3_exec (m_db, INIT_CONTACT_TABLE.c_str (), NULL, NULL, &errmsg);
       if (res != SQLITE_OK && errmsg != 0)
-        throw LnException("Init \"error\" in Contact");
+        throw Error("Init \"error\" in Contact");
     }
 
   // Check if TrustScope table exists
@@ -187,7 +186,7 @@
       char *errmsg = 0;
       res = sqlite3_exec (m_db, INIT_TS_TABLE.c_str (), NULL, NULL, &errmsg);
       if (res != SQLITE_OK && errmsg != 0)
-        throw LnException("Init \"error\" in TrustScope");
+        throw Error("Init \"error\" in TrustScope");
     }
 
   // Check if ContactProfile table exists
@@ -204,7 +203,7 @@
       char *errmsg = 0;
       res = sqlite3_exec (m_db, INIT_CP_TABLE.c_str (), NULL, NULL, &errmsg);
       if (res != SQLITE_OK && errmsg != 0)
-        throw LnException("Init \"error\" in ContactProfile");
+        throw Error("Init \"error\" in ContactProfile");
     }
 
   // Check if ProfileEndorse table exists
@@ -221,7 +220,7 @@
       char *errmsg = 0;
       res = sqlite3_exec (m_db, INIT_PE_TABLE.c_str (), NULL, NULL, &errmsg);
       if (res != SQLITE_OK && errmsg != 0)
-        throw LnException("Init \"error\" in ProfileEndorse");
+        throw Error("Init \"error\" in ProfileEndorse");
     }
 
   // Check if CollectEndorse table exists
@@ -238,7 +237,7 @@
       char *errmsg = 0;
       res = sqlite3_exec (m_db, INIT_CE_TABLE.c_str (), NULL, NULL, &errmsg);
       if (res != SQLITE_OK && errmsg != 0)
-        throw LnException("Init \"error\" in CollectEndorse");
+        throw Error("Init \"error\" in CollectEndorse");
     }
 }
 
@@ -265,13 +264,13 @@
 }
 
 void
-ContactStorage::setSelfProfileEntry(const Name& identity, const string& profileType, const Blob& profileValue)
+ContactStorage::setSelfProfileEntry(const Name& identity, const string& profileType, const Buffer &profileValue)
 {
   sqlite3_stmt *stmt;  
   if(doesSelfEntryExist(identity, profileType))
     {
       sqlite3_prepare_v2 (m_db, "UPDATE SelfProfile SET profile_value=? WHERE profile_type=? and profile_identity=?", -1, &stmt, 0);
-      sqlite3_bind_text(stmt, 1, (const char*)profileValue.buf(), profileValue.size(), SQLITE_TRANSIENT);
+      sqlite3_bind_text(stmt, 1, reinterpret_cast<const char*>(profileValue.buf()), profileValue.size(), SQLITE_TRANSIENT);
       sqlite3_bind_text(stmt, 2, profileType.c_str(), profileType.size(), SQLITE_TRANSIENT);
       sqlite3_bind_text(stmt, 3, identity.toUri().c_str(), identity.toUri().size(), SQLITE_TRANSIENT);
     }
@@ -280,7 +279,7 @@
       sqlite3_prepare_v2 (m_db, "INSERT INTO SelfProfile (profile_identity, profile_type, profile_value) values (?, ?, ?)", -1, &stmt, 0);
       sqlite3_bind_text(stmt, 1, identity.toUri().c_str(), identity.toUri().size(), SQLITE_TRANSIENT);
       sqlite3_bind_text(stmt, 2, profileType.c_str(), profileType.size(), SQLITE_TRANSIENT);
-      sqlite3_bind_text(stmt, 3, (const char*)profileValue.buf(), profileValue.size(), SQLITE_TRANSIENT);
+      sqlite3_bind_text(stmt, 3, reinterpret_cast<const char*>(profileValue.buf()), profileValue.size(), SQLITE_TRANSIENT);
     }
   sqlite3_step (stmt);
   sqlite3_finalize (stmt);
@@ -341,7 +340,7 @@
 ContactStorage::addContact(const ContactItem& contact)
 {
   if(doesContactExist(contact.getNameSpace()))
-    throw LnException("Normal Contact has already existed");
+    throw Error("Normal Contact has already existed");
 
   bool isIntroducer = contact.isIntroducer();
 
@@ -354,8 +353,8 @@
 
   sqlite3_bind_text(stmt, 1, contact.getNameSpace().toUri().c_str(),  contact.getNameSpace().toUri().size (), SQLITE_TRANSIENT);
   sqlite3_bind_text(stmt, 2, contact.getAlias().c_str(), contact.getAlias().size(), SQLITE_TRANSIENT);
-  Blob selfCertificateBlob = contact.getSelfEndorseCertificate().wireEncode();
-  sqlite3_bind_text(stmt, 3, (const char*)selfCertificateBlob.buf(), selfCertificateBlob.size(), SQLITE_TRANSIENT);
+  const Block& selfCertificateBlock = contact.getSelfEndorseCertificate().wireEncode();
+  sqlite3_bind_text(stmt, 3, reinterpret_cast<const char*>(selfCertificateBlock.wire()), selfCertificateBlock.size(), SQLITE_TRANSIENT);
   sqlite3_bind_int(stmt, 4, (isIntroducer ? 1 : 0));
 
   int res = sqlite3_step (stmt);
@@ -456,7 +455,7 @@
       string alias(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
 
       Data certData;
-      certData.wireDecode(reinterpret_cast<const uint8_t*>(sqlite3_column_text(stmt, 1)), sqlite3_column_bytes (stmt, 1));
+      certData.wireDecode(Block(reinterpret_cast<const uint8_t*>(sqlite3_column_text(stmt, 1)), sqlite3_column_bytes (stmt, 1)));
       EndorseCertificate endorseCertificate(certData);
 
       int isIntroducer = sqlite3_column_int (stmt, 2);
@@ -495,7 +494,7 @@
       string alias(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
 
       Data certData;
-      certData.wireDecode(reinterpret_cast<const uint8_t*>(sqlite3_column_text(stmt, 1)), sqlite3_column_bytes (stmt, 1));
+      certData.wireDecode(Block(reinterpret_cast<const uint8_t*>(sqlite3_column_text(stmt, 1)), sqlite3_column_bytes (stmt, 1)));
       EndorseCertificate endorseCertificate(certData);
 
       int isIntroducer = sqlite3_column_int (stmt, 2);
@@ -542,7 +541,7 @@
   return profile;
 }
 
-Blob
+Block
 ContactStorage::getSelfEndorseCertificate(const Name& identity)
 {
   sqlite3_stmt *stmt;
@@ -551,24 +550,26 @@
 
   if(sqlite3_step (stmt) == SQLITE_ROW)
     {
-      Blob result(reinterpret_cast<const uint8_t*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
+      Block result(reinterpret_cast<const uint8_t*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
       sqlite3_finalize (stmt);
       return result;
     }
 
   sqlite3_finalize (stmt);
 
-  return CHRONOCHAT_NULL_BLOB;
+  throw Error("ContactStorage: No self-endorse certificate found!");
+
+  return Block();
 }
 
 void
 ContactStorage::updateSelfEndorseCertificate(const EndorseCertificate& newEndorseCertificate, const Name& identity)
 {
-  Blob newEndorseCertificateBlob = newEndorseCertificate.wireEncode();
+  const Block& newEndorseCertificateBlock = newEndorseCertificate.wireEncode();
 
   sqlite3_stmt *stmt;
   sqlite3_prepare_v2 (m_db, "UPDATE SelfEndorse SET endorse_data=? WHERE identity=?", -1, &stmt, 0);
-  sqlite3_bind_text(stmt, 1, (const char*)newEndorseCertificateBlob.buf(), newEndorseCertificateBlob.size(), SQLITE_TRANSIENT);
+  sqlite3_bind_text(stmt, 1, reinterpret_cast<const char*>(newEndorseCertificateBlock.wire()), newEndorseCertificateBlock.size(), SQLITE_TRANSIENT);
   sqlite3_bind_text(stmt, 2, identity.toUri().c_str(), identity.toUri().size(), SQLITE_TRANSIENT);
   sqlite3_step(stmt);
   
@@ -578,18 +579,18 @@
 void
 ContactStorage::addSelfEndorseCertificate(const EndorseCertificate& newEndorseCertificate, const Name& identity)
 {
-  Blob newEndorseCertificateBlob = newEndorseCertificate.wireEncode();
+  const Block& newEndorseCertificateBlock = newEndorseCertificate.wireEncode();
 
   sqlite3_stmt *stmt;
   sqlite3_prepare_v2 (m_db, "INSERT INTO SelfEndorse (identity, endorse_data) values (?, ?)", -1, &stmt, 0);
   sqlite3_bind_text(stmt, 1, identity.toUri().c_str(), identity.toUri().size(), SQLITE_TRANSIENT);
-  sqlite3_bind_text(stmt, 2, (const char*)newEndorseCertificateBlob.buf(), newEndorseCertificateBlob.size(), SQLITE_TRANSIENT);
+  sqlite3_bind_text(stmt, 2, reinterpret_cast<const char*>(newEndorseCertificateBlock.wire()), newEndorseCertificateBlock.size(), SQLITE_TRANSIENT);
   sqlite3_step(stmt);
 
   sqlite3_finalize (stmt);
 }
 
-Blob
+Block
 ContactStorage::getEndorseCertificate(const Name& identity)
 {
   sqlite3_stmt *stmt;
@@ -599,24 +600,26 @@
   
   if(sqlite3_step (stmt) == SQLITE_ROW)
     {
-      Blob result(reinterpret_cast<const uint8_t*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
+      Block result(reinterpret_cast<const uint8_t*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
       sqlite3_finalize (stmt);
       return result;
     }
 
   sqlite3_finalize (stmt);
+
+  throw Error("ContactStorage: No endorse certificate found!");
   
-  return CHRONOCHAT_NULL_BLOB;
+  return Block();
 }
 
 void
 ContactStorage::updateEndorseCertificate(const EndorseCertificate& endorseCertificate, const Name& identity)
 {
-  Blob newEndorseCertificateBlob = endorseCertificate.wireEncode();
+  const Block& newEndorseCertificateBlock = endorseCertificate.wireEncode();
 
   sqlite3_stmt *stmt;
   sqlite3_prepare_v2 (m_db, "UPDATE ProfileEndorse SET endorse_data=? WHERE identity=?", -1, &stmt, 0);
-  sqlite3_bind_text(stmt, 1, (const char*)newEndorseCertificateBlob.buf(), newEndorseCertificateBlob.size(), SQLITE_TRANSIENT);
+  sqlite3_bind_text(stmt, 1, reinterpret_cast<const char*>(newEndorseCertificateBlock.wire()), newEndorseCertificateBlock.size(), SQLITE_TRANSIENT);
   sqlite3_bind_text(stmt, 2, identity.toUri().c_str(), identity.toUri().size(), SQLITE_TRANSIENT);
   sqlite3_step(stmt);
 
@@ -626,12 +629,12 @@
 void
 ContactStorage::addEndorseCertificate(const EndorseCertificate& endorseCertificate, const Name& identity)
 {
-  Blob newEndorseCertificateBlob = endorseCertificate.wireEncode();
+  const Block& newEndorseCertificateBlock = endorseCertificate.wireEncode();
 
   sqlite3_stmt *stmt;
   sqlite3_prepare_v2 (m_db, "INSERT INTO ProfileEndorse (identity, endorse_data) values (?, ?)", -1, &stmt, 0);
   sqlite3_bind_text(stmt, 1, identity.toUri().c_str(), identity.toUri().size(), SQLITE_TRANSIENT);
-  sqlite3_bind_text(stmt, 2, (const char*)newEndorseCertificateBlob.buf(), newEndorseCertificateBlob.size(), SQLITE_TRANSIENT);
+  sqlite3_bind_text(stmt, 2, reinterpret_cast<const char*>(newEndorseCertificateBlock.value()), newEndorseCertificateBlock.size(), SQLITE_TRANSIENT);
   sqlite3_step(stmt);
 
   sqlite3_finalize (stmt);
@@ -683,8 +686,8 @@
       sqlite3_bind_text(stmt, 1, endorserName.toUri().c_str(), endorserName.toUri().size(), SQLITE_TRANSIENT);
       sqlite3_bind_text(stmt, 2, endorseeName.toUri().c_str(), endorseeName.toUri().size(), SQLITE_TRANSIENT);
       sqlite3_bind_text(stmt, 3, getCertName.toUri().c_str(), getCertName.toUri().size(), SQLITE_TRANSIENT);
-      Blob blob = endorseCertificate.wireEncode();
-      sqlite3_bind_text(stmt, 4, (const char*)blob.buf(), blob.size(), SQLITE_TRANSIENT);
+      const Block &block = endorseCertificate.wireEncode();
+      sqlite3_bind_text(stmt, 4, reinterpret_cast<const char*>(block.wire()), block.size(), SQLITE_TRANSIENT);
       int res = sqlite3_step (stmt);
       sqlite3_finalize (stmt); 
       return;
@@ -693,8 +696,8 @@
     {
       sqlite3_prepare_v2 (m_db, "UPDATE CollectEndorse SET endorse_name=?, endorse_data=? WHERE endorser=? AND endorsee=?", -1, &stmt, 0);
       sqlite3_bind_text(stmt, 1, getCertName.toUri().c_str(), getCertName.toUri().size(), SQLITE_TRANSIENT);
-      Blob blob = endorseCertificate.wireEncode();
-      sqlite3_bind_text(stmt, 2, (const char*)blob.buf(), blob.size(), SQLITE_TRANSIENT);
+      const Block &block = endorseCertificate.wireEncode();
+      sqlite3_bind_text(stmt, 2, reinterpret_cast<const char*>(block.value()), block.size(), SQLITE_TRANSIENT);
       sqlite3_bind_text(stmt, 3, endorserName.toUri().c_str(), endorserName.toUri().size(), SQLITE_TRANSIENT);
       sqlite3_bind_text(stmt, 4, endorseeName.toUri().c_str(), endorseeName.toUri().size(), SQLITE_TRANSIENT);
       int res = sqlite3_step (stmt);
@@ -704,7 +707,7 @@
 }
 
 void
-ContactStorage::getCollectEndorseList(const Name& name, vector<Blob>& endorseList)
+ContactStorage::getCollectEndorseList(const Name& name, vector<Buffer>& endorseList)
 {
   sqlite3_stmt *stmt;
   sqlite3_prepare_v2 (m_db, "SELECT endorse_data FROM CollectEndorse WHERE endorsee=?", -1, &stmt, 0);
@@ -712,7 +715,7 @@
 
   while(sqlite3_step (stmt) == SQLITE_ROW)
     {
-      Blob blob(reinterpret_cast<const uint8_t*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
+      Buffer blob(reinterpret_cast<const uint8_t*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
       endorseList.push_back(blob);
     }
 
diff --git a/src/contact-storage.h b/src/contact-storage.h
index 8b7bc6e..dfc06ef 100644
--- a/src/contact-storage.h
+++ b/src/contact-storage.h
@@ -14,20 +14,21 @@
 #include <sqlite3.h>
 #include "contact-item.h"
 #include "endorse-certificate.h"
-#include <ndn-cpp/security/identity/identity-manager.hpp>
 
 
 class ContactStorage
 {
 
 public:
+  struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} };
+
   ContactStorage();
   
   ~ContactStorage() 
   {sqlite3_close(m_db);}
 
   void
-  setSelfProfileEntry(const ndn::Name& identity, const std::string& profileType, const ndn::Blob& profileValue);
+  setSelfProfileEntry(const ndn::Name& identity, const std::string& profileType, const ndn::Buffer& profileValue);
 
   ndn::ptr_lib::shared_ptr<Profile>
   getSelfProfile(const ndn::Name& identity);
@@ -55,7 +56,7 @@
 
 
   //SelfEndorse
-  ndn::Blob
+  ndn::Block
   getSelfEndorseCertificate(const ndn::Name& identity);
 
   void
@@ -66,7 +67,7 @@
 
 
   //ProfileEndorse
-  ndn::Blob
+  ndn::Block
   getEndorseCertificate(const ndn::Name& identity);
 
   void
@@ -84,7 +85,7 @@
   updateCollectEndorse(const EndorseCertificate& endorseCertificate);
 
   void
-  getCollectEndorseList(const ndn::Name& name, std::vector<ndn::Blob>& endorseList);
+  getCollectEndorseList(const ndn::Name& name, std::vector<ndn::Buffer>& endorseList);
   
 
 private:
diff --git a/src/contactpanel.cpp b/src/contactpanel.cpp
index d9f3324..0a9ffcd 100644
--- a/src/contactpanel.cpp
+++ b/src/contactpanel.cpp
@@ -21,16 +21,14 @@
 #include <QtSql/QSqlError>
 
 #ifndef Q_MOC_RUN
-#include <ndn-cpp/security/identity/osx-private-key-storage.hpp>
-#include <ndn-cpp/security/identity/basic-identity-storage.hpp>
-#include <ndn-cpp/security/signature/sha256-with-rsa-handler.hpp>
+#include <ndn-cpp/security/verifier.hpp>
+#include <ndn-cpp/security/signature/signature-sha256-with-rsa.hpp>
 #include <boost/filesystem.hpp>
 #include <boost/random/random_device.hpp>
 #include <boost/random/uniform_int_distribution.hpp>
 #include "panel-policy-manager.h"
 #include "null-ptrs.h"
 #include "logging.h"
-#include "exception.h"
 #endif
 
 namespace fs = boost::filesystem;
@@ -61,11 +59,9 @@
 
   createAction();
 
-  shared_ptr<BasicIdentityStorage> publicStorage = make_shared<BasicIdentityStorage>();
-  shared_ptr<OSXPrivateKeyStorage> privateStorage = make_shared<OSXPrivateKeyStorage>();
-  m_identityManager = make_shared<IdentityManager>(publicStorage, privateStorage);
+  m_keyChain = make_shared<KeyChain>();
 
-  m_contactManager = make_shared<ContactManager>(m_identityManager, m_face, m_transport);
+  m_contactManager = make_shared<ContactManager>(m_keyChain, m_face);
 
   connect(&*m_contactManager, SIGNAL(noNdnConnection(const QString&)),
           this, SLOT(showError(const QString&)));
@@ -76,10 +72,10 @@
 
   loadTrustAnchor();
 
-  m_defaultIdentity = m_identityManager->getDefaultIdentity();
+  m_defaultIdentity = m_keyChain->getDefaultIdentity();
   if(m_defaultIdentity.size() == 0)
     showError(QString::fromStdString("certificate of ") + QString::fromStdString(m_defaultIdentity.toUri()) + " is missing!\nHave you installed the certificate?");
-  Name defaultCertName = m_identityManager->getDefaultCertificateNameForIdentity(m_defaultIdentity);
+  Name defaultCertName = m_keyChain->getDefaultCertificateNameForIdentity(m_defaultIdentity);
   if(defaultCertName.size() == 0)
     showError(QString::fromStdString("certificate of ") + QString::fromStdString(m_defaultIdentity.toUri()) + " is missing!\nHave you installed the certificate?");
 
@@ -206,8 +202,7 @@
 void
 ContactPanel::startFace()
 {
-  m_transport = make_shared<TcpTransport>();
-  m_face = make_shared<Face>(m_transport, make_shared<TcpTransport::ConnectionInfo>("localhost"));
+  m_face = make_shared<Face>();
   
   connectToDaemon();
 
@@ -248,8 +243,8 @@
   Name name("/ndn");
   ndn::Interest interest(name);
   m_face->expressInterest(interest, 
-                          bind(&ContactPanel::onConnectionData, this, _1, _2),
-                          bind(&ContactPanel::onConnectionDataTimeout, this, _1));
+                          func_lib::bind(&ContactPanel::onConnectionData, this, _1, _2),
+                          func_lib::bind(&ContactPanel::onConnectionDataTimeout, this, _1));
 }
 
 void
@@ -299,11 +294,10 @@
 {
   Name interestName("/local/ndn/prefix");
   Interest interest(interestName);
-  interest.setChildSelector(ndn_Interest_CHILD_SELECTOR_RIGHT);
 
   m_face->expressInterest(interest, 
-                          bind(&ContactPanel::onLocalPrefix, this, _1, _2), 
-                          bind(&ContactPanel::onLocalPrefixTimeout, this, _1, 10));
+                          func_lib::bind(&ContactPanel::onLocalPrefix, this, _1, _2), 
+                          func_lib::bind(&ContactPanel::onLocalPrefixTimeout, this, _1, 10));
   
 }
 
@@ -311,7 +305,7 @@
 ContactPanel::onLocalPrefix(const shared_ptr<const Interest>& interest, 
                             const shared_ptr<Data>& data)
 {
-  string originPrefix((const char*)data->getContent().buf(), data->getContent().size());
+  string originPrefix((const char*)data->getContent().value(), data->getContent().value_size());
   string prefix = QString::fromStdString (originPrefix).trimmed ().toUtf8().constData();
   string randomSuffix = getRandomString();
   m_localPrefix = Name(prefix);
@@ -338,9 +332,9 @@
   m_inviteListenPrefix = Name("/ndn/broadcast/chronos/invitation");
   m_inviteListenPrefix.append(m_defaultIdentity);
   _LOG_DEBUG("Listening for invitation on prefix: " << m_inviteListenPrefix.toUri());
-  m_invitationListenerId = m_face->registerPrefix(m_inviteListenPrefix, 
-                                                  boost::bind(&ContactPanel::onInvitation, this, _1, _2, _3, _4),
-                                                  boost::bind(&ContactPanel::onInvitationRegisterFailed, this, _1));
+  m_invitationListenerId = m_face->setInterestFilter(m_inviteListenPrefix, 
+                                                     func_lib::bind(&ContactPanel::onInvitation, this, _1, _2, _3, _4),
+                                                     func_lib::bind(&ContactPanel::onInvitationRegisterFailed, this, _1));
 }
 
 void
@@ -352,7 +346,7 @@
                            int stepCount /* = 0 */)
 {
   m_face->expressInterest(interest, 
-                          boost::bind(&ContactPanel::onTargetData, 
+                          func_lib::bind(&ContactPanel::onTargetData, 
                                       this,
                                       _1,
                                       _2,
@@ -360,7 +354,7 @@
                                       onVerified, 
                                       onVerifyFailed,
                                       timeoutNotify),
-                          boost::bind(&ContactPanel::onTargetTimeout,
+                          func_lib::bind(&ContactPanel::onTargetTimeout,
                                       this,
                                       _1,
                                       retry,
@@ -383,8 +377,8 @@
   if (nextStep)
     m_face->expressInterest
       (*nextStep->interest_, 
-       bind(&ContactPanel::onCertData, this, _1, _2, nextStep), 
-       bind(&ContactPanel::onCertTimeout, this, _1, onVerifyFailed, data, nextStep));
+       func_lib::bind(&ContactPanel::onCertData, this, _1, _2, nextStep), 
+       func_lib::bind(&ContactPanel::onCertTimeout, this, _1, onVerifyFailed, data, nextStep));
 
 }
 
@@ -418,8 +412,8 @@
   if (nextStep)
     m_face->expressInterest
       (*nextStep->interest_, 
-       bind(&ContactPanel::onCertData, this, _1, _2, nextStep), 
-       bind(&ContactPanel::onCertTimeout, this, _1, previousStep->onVerifyFailed_, cert, nextStep));
+       func_lib::bind(&ContactPanel::onCertData, this, _1, _2, nextStep), 
+       func_lib::bind(&ContactPanel::onCertTimeout, this, _1, previousStep->onVerifyFailed_, cert, nextStep));
 }
 
 void
@@ -430,12 +424,12 @@
 {
   if(nextStep->retry_ > 0)
     m_face->expressInterest(*interest, 
-                            bind(&ContactPanel::onCertData,
+                            func_lib::bind(&ContactPanel::onCertData,
                                  this,
                                  _1,
                                  _2,
                                  nextStep),
-                            bind(&ContactPanel::onCertTimeout,
+                            func_lib::bind(&ContactPanel::onCertTimeout,
                                  this,
                                  _1,
                                  onVerifyFailed,
@@ -478,7 +472,11 @@
     }
 
   shared_ptr<PublicKey> keyPtr = m_policyManager->getTrustedKey(invitation->getInviterCertificateName());
-  if(CHRONOCHAT_NULL_PUBLICKEY_PTR != keyPtr && Sha256WithRsaHandler::verifySignature(invitation->getSignedBlob(), invitation->getSignatureBits(), *keyPtr))
+
+  SignatureSha256WithRsa invitationSig;
+  Block sigBlock(invitation->getSignatureBits().buf(), invitation->getSignatureBits().size());
+  invitationSig.setValue(sigBlock);
+  if(CHRONOCHAT_NULL_PUBLICKEY_PTR != keyPtr && Verifier::verifySignature(invitation->getSignedBlob(), invitationSig, *keyPtr))
     {
       shared_ptr<IdentityCertificate> certificate = make_shared<IdentityCertificate>();
       // hack: incomplete certificate, we don't send it to the wire nor store it anywhere, we only use it to carry information
@@ -508,9 +506,9 @@
   _LOG_DEBUG("Cannot find the inviter's key in trust anchors");
 
   Interest newInterest(invitation->getInviterCertificateName());
-  OnVerified onVerified = boost::bind(&ContactPanel::onInvitationCertVerified, this, _1, invitation);
-  OnVerifyFailed onVerifyFailed = boost::bind(&ContactPanel::onInvitationCertVerifyFailed, this, _1);
-  TimeoutNotify timeoutNotify = boost::bind(&ContactPanel::onInvitationCertTimeoutNotify, this);
+  OnVerified onVerified = func_lib::bind(&ContactPanel::onInvitationCertVerified, this, _1, invitation);
+  OnVerifyFailed onVerifyFailed = func_lib::bind(&ContactPanel::onInvitationCertVerifyFailed, this, _1);
+  TimeoutNotify timeoutNotify = func_lib::bind(&ContactPanel::onInvitationCertTimeoutNotify, this);
 
   sendInterest(newInterest, onVerified, onVerifyFailed, timeoutNotify);
 }
@@ -520,8 +518,12 @@
                                        shared_ptr<ChronosInvitation> invitation)
 {
   shared_ptr<IdentityCertificate> certificate = make_shared<IdentityCertificate>(*data);
+
+  SignatureSha256WithRsa invitationSig;
+  Block sigBlock(invitation->getSignatureBits().buf(), invitation->getSignatureBits().size());
+  invitationSig.setValue(sigBlock);
   
-  if(Sha256WithRsaHandler::verifySignature(invitation->getSignedBlob(), invitation->getSignatureBits(), certificate->getPublicKeyInfo()))
+  if(Verifier::verifySignature(invitation->getSignedBlob(), invitationSig, certificate->getPublicKeyInfo()))
     {
       Name keyName = certificate->getPublicKeyName();
       Name inviterNameSpace = keyName.getPrefix(-1);
@@ -568,12 +570,11 @@
       Name interestName = (*it)->getNameSpace();
       interestName.append("DNS").append(m_defaultIdentity).append("ENDORSEE");
       Interest interest(interestName);
-      interest.setChildSelector(ndn_Interest_CHILD_SELECTOR_RIGHT);
-      interest.setInterestLifetimeMilliseconds(1000);
+      interest.setInterestLifetime(1000);
 
-      OnVerified onVerified = boost::bind(&ContactPanel::onDnsEndorseeVerified, this, _1, count);
-      OnVerifyFailed onVerifyFailed = boost::bind(&ContactPanel::onDnsEndorseeVerifyFailed, this, _1, count);
-      TimeoutNotify timeoutNotify = boost::bind(&ContactPanel::onDnsEndorseeTimeoutNotify, this, count);
+      OnVerified onVerified = func_lib::bind(&ContactPanel::onDnsEndorseeVerified, this, _1, count);
+      OnVerifyFailed onVerifyFailed = func_lib::bind(&ContactPanel::onDnsEndorseeVerifyFailed, this, _1, count);
+      TimeoutNotify timeoutNotify = func_lib::bind(&ContactPanel::onDnsEndorseeTimeoutNotify, this, count);
   
       sendInterest(interest, onVerified, onVerifyFailed, timeoutNotify, 0);
     }
@@ -583,7 +584,7 @@
 ContactPanel::onDnsEndorseeVerified(const shared_ptr<Data>& data, int count)
 {
   Data endorseData;
-  endorseData.wireDecode(data->getContent().buf(), data->getContent().size());
+  endorseData.wireDecode(Block(data->getContent().value(), data->getContent().value_size()));
   EndorseCertificate endorseCertificate(endorseData);
 
   m_contactManager->getContactStorage()->updateCollectEndorse(endorseCertificate);
@@ -731,7 +732,7 @@
 { 
   // _LOG_DEBUG(identity.toStdString());
   Name defaultIdentity = Name(identity.toStdString());
-  Name defaultCertName = m_identityManager->getDefaultCertificateNameForIdentity(defaultIdentity);
+  Name defaultCertName = m_keyChain->getDefaultCertificateNameForIdentity(defaultIdentity);
   if(defaultCertName.size() == 0)
     {
       showWarning(QString::fromStdString("Corresponding certificate is missing!\nHave you installed the certificate?"));
@@ -740,7 +741,7 @@
   m_defaultIdentity = defaultIdentity;
   m_profileEditor->setCurrentIdentity(m_defaultIdentity);
   m_nickName = nickName.toStdString();
-  m_face->removeRegisteredPrefix(m_invitationListenerId);
+  m_face->unsetInterestFilter(m_invitationListenerId);
   m_contactManager->setDefaultIdentity(m_defaultIdentity);
   setInvitationListener();
   collectEndorsement();
@@ -860,7 +861,7 @@
   Name inviteeNamespace(invitee.toStdString());
   shared_ptr<ContactItem> inviteeItem = m_contactManager->getContact(inviteeNamespace);
 
-  ChatDialog* chatDialog = new ChatDialog(m_contactManager, m_identityManager, chatroomName, m_localPrefix, m_defaultIdentity, m_nickName);
+  ChatDialog* chatDialog = new ChatDialog(m_contactManager, chatroomName, m_localPrefix, m_defaultIdentity, m_nickName);
   m_chatDialogs.insert(pair <Name, ChatDialog*> (chatroomName, chatDialog));
 
   connect(chatDialog, SIGNAL(closeChatDialog(const ndn::Name&)),
@@ -886,7 +887,7 @@
   Name chatroomName("/ndn/broadcast/chronos");
   chatroomName.append(invitation.getChatroom());
 
-  ChatDialog* chatDialog = new ChatDialog(m_contactManager, m_identityManager, chatroomName, m_localPrefix, m_defaultIdentity, m_nickName, true);
+  ChatDialog* chatDialog = new ChatDialog(m_contactManager, chatroomName, m_localPrefix, m_defaultIdentity, m_nickName, true);
 
   connect(chatDialog, SIGNAL(closeChatDialog(const ndn::Name&)),
           this, SLOT(removeChatDialog(const ndn::Name&)));
@@ -917,18 +918,17 @@
   Data data(dataName);
   string content = m_localPrefix.toUri();
   data.setContent((const uint8_t *)&content[0], content.size());
-  data.getMetaInfo().setTimestampMilliseconds(time(NULL) * 1000.0);
 
   Name certificateName;
   Name inferredIdentity = m_policyManager->inferSigningIdentity(data.getName());
 
   if(inferredIdentity.getComponentCount() == 0)
-    certificateName = m_identityManager->getDefaultCertificateName();
+    certificateName = m_keyChain->getDefaultCertificateName();
   else
-    certificateName = m_identityManager->getDefaultCertificateNameForIdentity(inferredIdentity);   
-  m_identityManager->signByCertificate(data, certificateName);
+    certificateName = m_keyChain->getDefaultCertificateNameForIdentity(inferredIdentity);   
+  m_keyChain->sign(data, certificateName);
 
-  m_transport->send(*data.wireEncode());
+  m_face->put(data);
 
   startChatroom2(invitation, identityCertificate);
 }
@@ -939,17 +939,16 @@
   Data data(invitation.getInterestName());
   string content("nack");
   data.setContent((const uint8_t *)&content[0], content.size());
-  data.getMetaInfo().setTimestampMilliseconds(time(NULL) * 1000.0);
 
   Name certificateName;
   Name inferredIdentity = m_policyManager->inferSigningIdentity(data.getName());
   if(inferredIdentity.getComponentCount() == 0)
-    certificateName = m_identityManager->getDefaultCertificateName();
+    certificateName = m_keyChain->getDefaultCertificateName();
   else
-    certificateName = m_identityManager->getDefaultCertificateNameForIdentity(inferredIdentity);   
-  m_identityManager->signByCertificate(data, certificateName);
+    certificateName = m_keyChain->getDefaultCertificateNameForIdentity(inferredIdentity);   
+  m_keyChain->sign(data, certificateName);
 
-  m_transport->send(*data.wireEncode());
+  m_face->put(data);
 }
 
 void
diff --git a/src/contactpanel.h b/src/contactpanel.h
index 615a836..ce7f7b7 100644
--- a/src/contactpanel.h
+++ b/src/contactpanel.h
@@ -285,8 +285,7 @@
   ndn::ptr_lib::shared_ptr<std::vector<bool> > m_collectStatus;
 
   ndn::ptr_lib::shared_ptr<PanelPolicyManager> m_policyManager;
-  ndn::ptr_lib::shared_ptr<ndn::IdentityManager> m_identityManager;
-  ndn::ptr_lib::shared_ptr<ndn::Transport> m_transport;
+  ndn::ptr_lib::shared_ptr<ndn::KeyChain> m_keyChain;
   ndn::ptr_lib::shared_ptr<ndn::Face> m_face;
 
   boost::recursive_mutex m_mutex;
diff --git a/src/dns-storage.cpp b/src/dns-storage.cpp
index a5a9588..7ce9245 100644
--- a/src/dns-storage.cpp
+++ b/src/dns-storage.cpp
@@ -10,7 +10,6 @@
 
 #include "dns-storage.h"
 #include "null-ptrs.h"
-#include "exception.h"
 
 #include <boost/filesystem.hpp>
 #include "logging.h"
@@ -45,7 +44,7 @@
 
   int res = sqlite3_open((chronosDir / "dns.db").c_str (), &m_db);
   if (res != SQLITE_OK)
-    throw LnException("Chronos DNS DB cannot be open/created");
+    throw Error("Chronos DNS DB cannot be open/created");
 
   // Check if SelfProfile table exists
   sqlite3_stmt *stmt;
@@ -62,7 +61,7 @@
       char *errmsg = 0;
       res = sqlite3_exec (m_db, INIT_DD_TABLE.c_str (), NULL, NULL, &errmsg);
       if (res != SQLITE_OK && errmsg != 0)
-        throw LnException("Init \"error\" in DnsData");
+        throw Error("Init \"error\" in DnsData");
     }
 }
 
@@ -72,7 +71,7 @@
 }
 
 void
-DnsStorage::updateDnsData(const ndn::Blob& data, const std::string& identity, const std::string& name, const std::string& type, const string& dataName)
+DnsStorage::updateDnsData(const ndn::Block& data, const std::string& identity, const std::string& name, const std::string& type, const string& dataName)
 {  
   sqlite3_stmt *stmt;
   sqlite3_prepare_v2 (m_db, "SELECT data_name FROM DnsData where dns_identity=? and dns_name=? and dns_type=?", -1, &stmt, 0);
@@ -87,7 +86,7 @@
       sqlite3_bind_text(stmt, 1, identity.c_str(), identity.size(), SQLITE_TRANSIENT);
       sqlite3_bind_text(stmt, 2, name.c_str(), name.size(), SQLITE_TRANSIENT);
       sqlite3_bind_text(stmt, 3, type.c_str(), type.size(), SQLITE_TRANSIENT);
-      sqlite3_bind_text(stmt, 4, (const char*)data.buf(), data.size(), SQLITE_TRANSIENT); 
+      sqlite3_bind_text(stmt, 4, (const char*)data.wire(), data.size(), SQLITE_TRANSIENT); 
       sqlite3_bind_text(stmt, 5, dataName.c_str(), dataName.size(), SQLITE_TRANSIENT);
       sqlite3_step(stmt);
       sqlite3_finalize(stmt);
@@ -96,7 +95,7 @@
     {
       sqlite3_finalize(stmt);
       sqlite3_prepare_v2 (m_db, "UPDATE DnsData SET dns_value=?, data_name=? WHERE dns_identity=? and dns_name=?, dns_type=?", -1, &stmt, 0);
-      sqlite3_bind_text(stmt, 1, (const char*)data.buf(), data.size(), SQLITE_TRANSIENT);
+      sqlite3_bind_text(stmt, 1, (const char*)data.wire(), data.size(), SQLITE_TRANSIENT);
       sqlite3_bind_text(stmt, 2, dataName.c_str(), dataName.size(), SQLITE_TRANSIENT);
       sqlite3_bind_text(stmt, 3, identity.c_str(), identity.size(), SQLITE_TRANSIENT);
       sqlite3_bind_text(stmt, 4, name.c_str(), name.size(), SQLITE_TRANSIENT);
@@ -112,9 +111,9 @@
   string dnsIdentity = identity.toUri();
   string dnsName("N/A");
   string dnsType("PROFILE");
-  Blob dnsValue = data.wireEncode();
+  
 
-  updateDnsData(dnsValue, dnsIdentity, dnsName, dnsType, data.getName().toUri());
+  updateDnsData(data.wireEncode(), dnsIdentity, dnsName, dnsType, data.getName().toUri());
 }
 
 void
@@ -123,9 +122,8 @@
   string dnsIdentity = identity.toUri();
   string dnsName = endorsee.toUri();
   string dnsType("ENDORSEE");
-  Blob dnsValue = data.wireEncode();
 
-  updateDnsData(dnsValue, dnsIdentity, dnsName, dnsType, data.getName().toUri());
+  updateDnsData(data.wireEncode(), dnsIdentity, dnsName, dnsType, data.getName().toUri());
 }
   
 void
@@ -134,9 +132,8 @@
   string dnsIdentity = identity.toUri();
   string dnsName("N/A");
   string dnsType("ENDORSED");
-  Blob dnsValue = data.wireEncode();
 
-  updateDnsData(dnsValue, dnsIdentity, dnsName, dnsType, data.getName().toUri());
+  updateDnsData(data.wireEncode(), dnsIdentity, dnsName, dnsType, data.getName().toUri());
 }
 
 shared_ptr<Data>
@@ -149,7 +146,7 @@
   if(sqlite3_step (stmt) == SQLITE_ROW)
     {
       shared_ptr<Data> data = make_shared<Data>();
-      data->wireDecode(reinterpret_cast<const uint8_t*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
+      data->wireDecode(Block(reinterpret_cast<const uint8_t*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0)));
       sqlite3_finalize(stmt);
       return data;
     }
diff --git a/src/dns-storage.h b/src/dns-storage.h
index 0c7934b..de37540 100644
--- a/src/dns-storage.h
+++ b/src/dns-storage.h
@@ -17,6 +17,8 @@
 class DnsStorage
 {
 public:
+  struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} };
+
   DnsStorage();
 
   ~DnsStorage();
@@ -35,7 +37,7 @@
 
 private:
   void
-  updateDnsData(const ndn::Blob& data, const std::string& identity, const std::string& name, const std::string& type, const std::string& dataName);
+  updateDnsData(const ndn::Block& data, const std::string& identity, const std::string& name, const std::string& type, const std::string& dataName);
 
 private:
   sqlite3 *m_db;
diff --git a/src/endorse-certificate.cpp b/src/endorse-certificate.cpp
index 8101eb3..ae07796 100644
--- a/src/endorse-certificate.cpp
+++ b/src/endorse-certificate.cpp
@@ -9,7 +9,6 @@
  */
 
 #include "endorse-certificate.h"
-#include "exception.h"
 #include "endorse-extension.pb.h"
 #include <boost/date_time/posix_time/posix_time.hpp>
 #include <boost/iostreams/stream.hpp>
@@ -23,7 +22,7 @@
 INIT_LOGGER("EndorseCertificate");
 
 ProfileExtension::ProfileExtension(const ProfileData & profileData)
-  : CertificateExtension("1.3.6.1.5.32.2.1", true, profileData.wireEncode())
+  : CertificateExtension("1.3.6.1.5.32.2.1", true, Buffer(profileData.wireEncode().wire(), profileData.wireEncode().size()))
 {}
 
 ProfileExtension::ProfileExtension(const ProfileExtension& profileExtension)
@@ -34,14 +33,14 @@
   : CertificateExtension(extension.getOid(), extension.getIsCritical(), extension.getValue())
 {
   if(extensionId_ != OID("1.3.6.1.5.32.2.1"))
-    throw LnException("Wrong ProfileExtension Number!");
+    throw Error("Wrong ProfileExtension Number!");
 }
 
 shared_ptr<ProfileData>
 ProfileExtension::getProfileData()
 {
   Data data;
-  data.wireDecode(extensionValue_.buf(), extensionValue_.size());
+  data.wireDecode(Block(extensionValue_.buf(), extensionValue_.size()));
   return make_shared<ProfileData>(data);
 }
 
@@ -57,7 +56,7 @@
   : CertificateExtension(extension.getOid(), extension.getIsCritical(), extension.getValue())
 {
   if(extensionId_ != OID("1.3.6.1.5.32.2.2"))
-    throw LnException("Wrong EndorseExtension Number!");
+    throw Error("Wrong EndorseExtension Number!");
 }
 
 vector<string>
@@ -78,7 +77,7 @@
   return endorseList;
 }
 
-Blob
+Buffer
 EndorseExtension::encodeEndorseList(const vector<string>& endorseList)
 {
   Chronos::EndorseExtensionMsg endorseExtension;
@@ -90,7 +89,7 @@
   string encoded;
   endorseExtension.SerializeToString(&encoded);
   
-  return Blob((const uint8_t*)encoded.c_str(), encoded.size());
+  return Buffer(encoded.c_str(), encoded.size());
 }
 
 EndorseCertificate::EndorseCertificate(const IdentityCertificate& kskCertificate,
@@ -168,7 +167,7 @@
 	}
     }
   if(profileIndex < 0)
-    throw LnException("No PROFILE-CERT component in data name!");
+    throw Error("No PROFILE-CERT component in data name!");
 
   m_keyName = dataName.getSubName(0, profileIndex);
   m_signer = dataName.getSubName(profileIndex + 1, dataName.size() - profileIndex - 2);
diff --git a/src/endorse-certificate.h b/src/endorse-certificate.h
index 5f076f2..a727552 100644
--- a/src/endorse-certificate.h
+++ b/src/endorse-certificate.h
@@ -21,6 +21,8 @@
 class ProfileExtension : public ndn::CertificateExtension
 {
 public:
+  struct Error : public ndn::CertificateExtension::Error { Error(const std::string &what) : ndn::CertificateExtension::Error(what) {} };
+
   ProfileExtension(const ProfileData& profileData);
   
   ProfileExtension(const ProfileExtension& profileExtension);
@@ -36,6 +38,8 @@
 class EndorseExtension : public ndn::CertificateExtension
 {
 public:
+  struct Error : public ndn::CertificateExtension::Error { Error(const std::string &what) : ndn::CertificateExtension::Error(what) {} };
+
   EndorseExtension(const std::vector<std::string>& endorseList);
 
   EndorseExtension(const EndorseExtension& endorseExtension);
@@ -48,13 +52,15 @@
   getEndorseList();
 
 private:
-  static ndn::Blob
+  static ndn::Buffer
   encodeEndorseList(const std::vector<std::string>& endorsedList);
 };
 
 class EndorseCertificate : public ndn::Certificate
 {
 public:
+  struct Error : public ndn::Certificate::Error { Error(const std::string &what) : ndn::Certificate::Error(what) {} };
+
   EndorseCertificate() {}
 
   EndorseCertificate(const ndn::IdentityCertificate& kskCertificate,
diff --git a/src/endorse-combobox-delegate.cpp b/src/endorse-combobox-delegate.cpp
index a70a772..bbefbeb 100644
--- a/src/endorse-combobox-delegate.cpp
+++ b/src/endorse-combobox-delegate.cpp
@@ -15,7 +15,6 @@
 
 #ifndef Q_MOC_RUN
 #include "logging.h"
-#include "exception.h"
 #endif
 
 INIT_LOGGER("EndorseComboBoxDelegate");
diff --git a/src/exception.cpp b/src/exception.cpp
deleted file mode 100644
index 22f89a1..0000000
--- a/src/exception.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- *                     Yingdi Yu
- *
- * BSD license, See the LICENSE file for more information
- *
- * Author: Yingdi Yu <yingdi@cs.ucla.edu>
- */
-
-#include "exception.h"
-
-using namespace std;
-
-LnException::LnException(const string & errMsg) throw()
-  : m_errMsg(errMsg)
-{}
diff --git a/src/exception.h b/src/exception.h
deleted file mode 100644
index 5cce5aa..0000000
--- a/src/exception.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- *                     Yingdi Yu
- *
- * BSD license, See the LICENSE file for more information
- *
- * Author: Yingdi Yu <yingdi@cs.ucla.edu>
- */
-
-#ifndef LINKEDN_EXCEPTION_H
-#define LINKEDN_EXCEPTION_H
-
-#include <exception>
-#include <string>
-
-class LnException : public std::exception
-{
-public:
-  LnException(const std::string & errMsg) throw();
-  
-  ~LnException() throw()
-  {}
-  
-  const char* what() const throw()
-  {
-    return m_errMsg.c_str();
-  }
-  
-private:
-  const std::string m_errMsg;
-};
-
-#endif
diff --git a/src/invitation-policy-manager.cpp b/src/invitation-policy-manager.cpp
index 0885e25..dd7b33c 100644
--- a/src/invitation-policy-manager.cpp
+++ b/src/invitation-policy-manager.cpp
@@ -10,8 +10,8 @@
 
 #include "invitation-policy-manager.h"
 #include "null-ptrs.h"
-#include <ndn-cpp/sha256-with-rsa-signature.hpp>
-#include <ndn-cpp/security/signature/sha256-with-rsa-handler.hpp>
+#include <ndn-cpp/security/verifier.hpp>
+#include <ndn-cpp/security/signature/signature-sha256-with-rsa.hpp>
 
 #include "logging.h"
 
@@ -65,101 +65,104 @@
       return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;
     }
 
-  const Sha256WithRsaSignature* sha256sig = dynamic_cast<const Sha256WithRsaSignature*> (data->getSignature());    
+  try{
+    SignatureSha256WithRsa sig(data->getSignature());    
 
-  if(ndn_KeyLocatorType_KEYNAME != sha256sig->getKeyLocator().getType())
-    {
-      _LOG_ERROR("KeyLocator is not name!");
-      onVerifyFailed(data);
-      return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;
-    }
+    const Name & keyLocatorName = sig.getKeyLocator().getName();
 
-  const Name & keyLocatorName = sha256sig->getKeyLocator().getKeyName();
+    if(m_invitationPolicyRule->satisfy(*data))
+      {
+        // Name keyName = IdentityCertificate::certificateNameToPublicKeyName(keyLocatorName);
+        // map<Name, PublicKey>::iterator it = m_trustAnchors.find(keyName);
+        // if(m_trustAnchors.end() != it)
+        //   {
+        //     if(Sha256WithRsaHandler::verifySignature(*data, it->second))
+        //       onVerified(data);
+        //     else
+        //       onVerifyFailed(data);
 
-  if(m_invitationPolicyRule->satisfy(*data))
-    {
-      // Name keyName = IdentityCertificate::certificateNameToPublicKeyName(keyLocatorName);
-      // map<Name, PublicKey>::iterator it = m_trustAnchors.find(keyName);
-      // if(m_trustAnchors.end() != it)
-      //   {
-      //     if(Sha256WithRsaHandler::verifySignature(*data, it->second))
-      //       onVerified(data);
-      //     else
-      //       onVerifyFailed(data);
+        //     return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;
+        //   }
 
-      //     return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;
-      //   }
-
-      shared_ptr<const Certificate> trustedCert = m_certificateCache.getCertificate(keyLocatorName);
+        shared_ptr<const Certificate> trustedCert = m_certificateCache.getCertificate(keyLocatorName);
       
-      if(trustedCert != ndn::TCC_NULL_CERTIFICATE_PTR){
-	if(Sha256WithRsaHandler::verifySignature(*data, trustedCert->getPublicKeyInfo()))
-	  onVerified(data);
-	else
-	  onVerifyFailed(data);
-
-	return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;
-      }
-
-      OnVerified recursiveVerifiedCallback = boost::bind(&InvitationPolicyManager::onDskCertificateVerified, 
-                                                         this, 
-                                                         _1, 
-                                                         data, 
-                                                         onVerified, 
-                                                         onVerifyFailed);
-      
-      OnVerifyFailed recursiveUnverifiedCallback = boost::bind(&InvitationPolicyManager::onDskCertificateVerifyFailed, 
-                                                               this, 
-                                                               _1, 
-                                                               data, 
-                                                               onVerifyFailed);
-
-
-      shared_ptr<Interest> interest = make_shared<Interest>(keyLocatorName);
-      
-      shared_ptr<ValidationRequest> nextStep = make_shared<ValidationRequest>(interest, 
-                                                                              recursiveVerifiedCallback,
-                                                                              recursiveUnverifiedCallback,
-                                                                              0,
-                                                                              stepCount + 1);
-      return nextStep;
-    }
-
-  if(m_kskRegex->match(data->getName()))
-    {
-      Name keyName = m_kskRegex->expand();
-      map<Name, PublicKey>::iterator it = m_trustAnchors.find(keyName);
-      if(m_trustAnchors.end() != it)
-        {
-          IdentityCertificate identityCertificate(*data);
-          if(isSameKey(it->second.getKeyDer(), identityCertificate.getPublicKeyInfo().getKeyDer()))
-            {
-              onVerified(data);
-            }
+        if(trustedCert != ndn::TCC_NULL_CERTIFICATE_PTR){
+          if(Verifier::verifySignature(*data, sig, trustedCert->getPublicKeyInfo()))
+            onVerified(data);
           else
             onVerifyFailed(data);
+
+          return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;
         }
-      else
-        onVerifyFailed(data);
 
-      return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;
-    }
+        OnVerified recursiveVerifiedCallback = boost::bind(&InvitationPolicyManager::onDskCertificateVerified, 
+                                                           this, 
+                                                           _1, 
+                                                           data, 
+                                                           onVerified, 
+                                                           onVerifyFailed);
+      
+        OnVerifyFailed recursiveUnverifiedCallback = boost::bind(&InvitationPolicyManager::onDskCertificateVerifyFailed, 
+                                                                 this, 
+                                                                 _1, 
+                                                                 data, 
+                                                                 onVerifyFailed);
 
-  if(m_dskRule->satisfy(*data))
-    {
-      m_keyNameRegex->match(keyLocatorName);
-      Name keyName = m_keyNameRegex->expand();
 
-      if(m_trustAnchors.end() != m_trustAnchors.find(keyName))
-        if(Sha256WithRsaHandler::verifySignature(*data, m_trustAnchors[keyName]))
-          onVerified(data);
+        shared_ptr<Interest> interest = make_shared<Interest>(keyLocatorName);
+      
+        shared_ptr<ValidationRequest> nextStep = make_shared<ValidationRequest>(interest, 
+                                                                                recursiveVerifiedCallback,
+                                                                                recursiveUnverifiedCallback,
+                                                                                0,
+                                                                                stepCount + 1);
+        return nextStep;
+      }
+
+    if(m_kskRegex->match(data->getName()))
+      {
+        Name keyName = m_kskRegex->expand();
+        map<Name, PublicKey>::iterator it = m_trustAnchors.find(keyName);
+        if(m_trustAnchors.end() != it)
+          {
+            IdentityCertificate identityCertificate(*data);
+            if(it->second == identityCertificate.getPublicKeyInfo())
+              {
+                onVerified(data);
+              }
+            else
+              onVerifyFailed(data);
+          }
         else
           onVerifyFailed(data);
-      else
-        onVerifyFailed(data);
 
-      return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;	
-    }
+        return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;
+      }
+
+    if(m_dskRule->satisfy(*data))
+      {
+        m_keyNameRegex->match(keyLocatorName);
+        Name keyName = m_keyNameRegex->expand();
+
+        if(m_trustAnchors.end() != m_trustAnchors.find(keyName))
+          if(Verifier::verifySignature(*data, sig, m_trustAnchors[keyName]))
+            onVerified(data);
+          else
+            onVerifyFailed(data);
+        else
+          onVerifyFailed(data);
+
+        return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;	
+      }
+  }catch(SignatureSha256WithRsa::Error &e){
+    _LOG_DEBUG("checkVerificationPolicy " << e.what());
+    onVerifyFailed(data);
+    return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;
+  }catch(KeyLocator::Error &e){
+    _LOG_DEBUG("checkVerificationPolicy " << e.what());
+    onVerifyFailed(data);
+    return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;
+  }
 
   onVerifyFailed(data);
   return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;
@@ -218,7 +221,7 @@
       if(it == m_dskCertificates.end())
         m_dskCertificates.insert(pair <Name, shared_ptr<IdentityCertificate> > (certName, certificate));
 
-      if(Sha256WithRsaHandler::verifySignature(*originalData, certificate->getPublicKeyInfo()))
+      if(Verifier::verifySignature(*originalData, originalData->getSignature(), certificate->getPublicKeyInfo()))
         {
           onVerified(originalData);
           return;
@@ -246,24 +249,3 @@
   else
     return CHRONOCHAT_NULL_IDENTITYCERTIFICATE_PTR;
 }
-
-
-bool
-InvitationPolicyManager::isSameKey(const Blob& keyA, const Blob& keyB)
-{
-  size_t size = keyA.size();
-
-  if(size != keyB.size())
-    return false;
-
-  const uint8_t* ap = keyA.buf();
-  const uint8_t* bp = keyB.buf();
-  
-  for(int i = 0; i < size; i++)
-    {
-      if(ap[i] != bp[i])
-        return false;
-    }
-
-  return true;
-}
diff --git a/src/invitation-policy-manager.h b/src/invitation-policy-manager.h
index a49124f..83b77bc 100644
--- a/src/invitation-policy-manager.h
+++ b/src/invitation-policy-manager.h
@@ -71,9 +71,6 @@
                                ndn::ptr_lib::shared_ptr<ndn::Data> originalData,
                                const ndn::OnVerifyFailed& onVerifyFailed);
 
-  static bool
-  isSameKey(const ndn::Blob& keyA, const ndn::Blob& keyB);
-
 private:
   std::string m_chatroomName;
   ndn::Name m_signingIdentity;
diff --git a/src/panel-policy-manager.cpp b/src/panel-policy-manager.cpp
index 92511ed..e60eb4f 100644
--- a/src/panel-policy-manager.cpp
+++ b/src/panel-policy-manager.cpp
@@ -10,8 +10,8 @@
 
 #include "panel-policy-manager.h"
 #include "null-ptrs.h"
-#include <ndn-cpp/sha256-with-rsa-signature.hpp>
-#include <ndn-cpp/security/signature/sha256-with-rsa-handler.hpp>
+#include <ndn-cpp/security/verifier.hpp>
+#include <ndn-cpp/security/signature/signature-sha256-with-rsa.hpp>
 // #include <boost/bind.hpp>
 
 #include "logging.h"
@@ -86,66 +86,68 @@
       return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;
     }
 
-  const Sha256WithRsaSignature* sha256sig = dynamic_cast<const Sha256WithRsaSignature*>(data->getSignature());    
+  try{
+    SignatureSha256WithRsa sig(data->getSignature());    
+    const Name & keyLocatorName = sig.getKeyLocator().getName();
 
-  if(ndn_KeyLocatorType_KEYNAME != sha256sig->getKeyLocator().getType())
-    {
-      _LOG_ERROR("Keylocator is not name!");
-      onVerifyFailed(data);
-      return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;
-    }
+    if(m_kskRegex->match(data->getName()))
+      {
+        Name keyName = m_kskRegex->expand();
+        map<Name, PublicKey>::iterator it = m_trustAnchors.find(keyName);
+        if(m_trustAnchors.end() != it)
+          {
+            // _LOG_DEBUG("found key!");
+            IdentityCertificate identityCertificate(*data);
+            if(it->second == identityCertificate.getPublicKeyInfo())
+              onVerified(data);
+            else
+              onVerifyFailed(data);
+          }
+        else
+          onVerifyFailed(data);
 
-  const Name & keyLocatorName = sha256sig->getKeyLocator().getKeyName();
+        return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;
+      }
 
-  if(m_kskRegex->match(data->getName()))
-    {
-      Name keyName = m_kskRegex->expand();
-      map<Name, PublicKey>::iterator it = m_trustAnchors.find(keyName);
-      if(m_trustAnchors.end() != it)
-        {
-          // _LOG_DEBUG("found key!");
-          IdentityCertificate identityCertificate(*data);
-          if(isSameKey(it->second.getKeyDer(), identityCertificate.getPublicKeyInfo().getKeyDer()))
+    if(m_dskRule->satisfy(*data))
+      {
+        m_keyNameRegex->match(keyLocatorName);
+        Name keyName = m_keyNameRegex->expand();
+
+        if(m_trustAnchors.end() != m_trustAnchors.find(keyName))
+          if(Verifier::verifySignature(*data, sig, m_trustAnchors[keyName]))
             onVerified(data);
           else
             onVerifyFailed(data);
-        }
-      else
-        onVerifyFailed(data);
-
-      return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;
-    }
-
-  if(m_dskRule->satisfy(*data))
-    {
-      m_keyNameRegex->match(keyLocatorName);
-      Name keyName = m_keyNameRegex->expand();
-
-      if(m_trustAnchors.end() != m_trustAnchors.find(keyName))
-        if(Sha256WithRsaHandler::verifySignature(*data, m_trustAnchors[keyName]))
-          onVerified(data);
         else
           onVerifyFailed(data);
-      else
-        onVerifyFailed(data);
 
-      return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;	
-    }
+        return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;	
+      }
 
-  if(m_endorseeRule->satisfy(*data))
-    {
-      m_keyNameRegex->match(keyLocatorName);
-      Name keyName = m_keyNameRegex->expand();
-      if(m_trustAnchors.end() != m_trustAnchors.find(keyName))
-        if(Sha256WithRsaHandler::verifySignature(*data, m_trustAnchors[keyName]))
-          onVerified(data);
+    if(m_endorseeRule->satisfy(*data))
+      {
+        m_keyNameRegex->match(keyLocatorName);
+        Name keyName = m_keyNameRegex->expand();
+        if(m_trustAnchors.end() != m_trustAnchors.find(keyName))
+          if(Verifier::verifySignature(*data, sig, m_trustAnchors[keyName]))
+            onVerified(data);
+          else
+            onVerifyFailed(data);
         else
           onVerifyFailed(data);
-      else
-        onVerifyFailed(data);
 
-      return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;
-    }
+        return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;
+      }
+  }catch(SignatureSha256WithRsa::Error &e){
+    _LOG_DEBUG("checkVerificationPolicy: " << e.what());
+    onVerifyFailed(data);
+    return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;
+  }catch(KeyLocator::Error &e){
+    _LOG_DEBUG("checkVerificationPolicy: " << e.what());
+    onVerifyFailed(data);
+    return CHRONOCHAT_NULL_VALIDATIONREQUEST_PTR;
+  }
 
   _LOG_DEBUG("Unverified!");
 
@@ -193,23 +195,3 @@
     return make_shared<PublicKey>(m_trustAnchors[keyName]);
   return CHRONOCHAT_NULL_PUBLICKEY_PTR;
 }
-
-bool
-PanelPolicyManager::isSameKey(const Blob& keyA, const Blob& keyB)
-{
-  size_t size = keyA.size();
-
-  if(size != keyB.size())
-    return false;
-
-  const uint8_t* ap = keyA.buf();
-  const uint8_t* bp = keyB.buf();
-  
-  for(int i = 0; i < size; i++)
-    {
-      if(ap[i] != bp[i])
-        return false;
-    }
-
-  return true;
-}
diff --git a/src/panel-policy-manager.h b/src/panel-policy-manager.h
index 712f9e5..1c5d688 100644
--- a/src/panel-policy-manager.h
+++ b/src/panel-policy-manager.h
@@ -85,10 +85,6 @@
   getTrustedKey(const ndn::Name& inviterCertName);
 
 private:
-  static bool
-  isSameKey(const ndn::Blob& keyA, const ndn::Blob& keyB);
-
-private:
   int m_stepLimit;
   ndn::TTLCertificateCache m_certificateCache;
   ndn::ptr_lib::shared_ptr<ndn::Regex> m_localPrefixRegex;
diff --git a/src/profile-data.cpp b/src/profile-data.cpp
index 0e17552..2288f9d 100644
--- a/src/profile-data.cpp
+++ b/src/profile-data.cpp
@@ -10,7 +10,6 @@
 
 #include "profile-data.h"
 #include <boost/date_time/posix_time/posix_time.hpp>
-#include "exception.h"
 #include "logging.h"
 
 
@@ -40,8 +39,6 @@
   profile.encode(&content);
   setContent((const uint8_t *)&content[0], content.size());
 
-  getMetaInfo().setTimestampMilliseconds(time(NULL) * 1000.0);
-
 }
 
 // ProfileData::ProfileData(const ProfileData& profileData)
@@ -67,10 +64,10 @@
     }
 
   if(profileIndex < 0)
-    throw LnException("No PROFILE component in data name!");
+    throw Error("No PROFILE component in data name!");
 
   m_identity = dataName.getPrefix(profileIndex);
 
-  string encoded((const char*)data.getContent().buf(), data.getContent().size());
+  string encoded(reinterpret_cast<const char*>(data.getContent().value()), data.getContent().value_size());
   m_profile = *Profile::decode(encoded);
 }
diff --git a/src/profile-data.h b/src/profile-data.h
index dbe4ca5..92353a1 100644
--- a/src/profile-data.h
+++ b/src/profile-data.h
@@ -17,6 +17,8 @@
 class ProfileData : public ndn::Data
 {
 public:
+  struct Error : public ndn::Data::Error { Error(const std::string &what) : ndn::Data::Error(what) {} };
+
   ProfileData();
 
   ProfileData(const Profile& profile);
diff --git a/src/profileeditor.cpp b/src/profileeditor.cpp
index 4abad5a..9d0d844 100644
--- a/src/profileeditor.cpp
+++ b/src/profileeditor.cpp
@@ -16,7 +16,6 @@
 
 #ifndef Q_MOC_RUN
 #include "logging.h"
-#include "exception.h"
 #endif
 
 using namespace ndn;
@@ -31,7 +30,7 @@
     , ui(new Ui::ProfileEditor)
     , m_tableModel(new QSqlTableModel())
     , m_contactManager(contactManager)
-    , m_identityManager(contactManager->getIdentityManager())
+    , m_keyChain(new KeyChain())
 {
   ui->setupUi(this);
   
@@ -85,7 +84,7 @@
 void
 ProfileEditor::onOkClicked()
 {
-  Name defaultCertName = m_identityManager->getDefaultCertificateNameForIdentity(m_currentIdentity);
+  Name defaultCertName = m_keyChain->getDefaultCertificateNameForIdentity(m_currentIdentity);
   if(defaultCertName.size() == 0)
     {
       emit noKeyOrCert(QString::fromStdString("Corresponding certificate is missing!\nHave you installed the certificate?"));
diff --git a/src/profileeditor.h b/src/profileeditor.h
index 6f8477c..5446be9 100644
--- a/src/profileeditor.h
+++ b/src/profileeditor.h
@@ -16,7 +16,7 @@
 
 #ifndef Q_MOC_RUN
 #include "contact-manager.h"
-#include <ndn-cpp/security/identity/identity-manager.hpp>
+#include <ndn-cpp/security/key-chain.hpp>
 #endif
 
 namespace Ui {
@@ -58,7 +58,7 @@
   Ui::ProfileEditor *ui;
   QSqlTableModel* m_tableModel;
   ndn::ptr_lib::shared_ptr<ContactManager> m_contactManager;
-  ndn::ptr_lib::shared_ptr<ndn::IdentityManager> m_identityManager;
+  ndn::ptr_lib::shared_ptr<ndn::KeyChain> m_keyChain;
   ndn::Name m_currentIdentity;
 };
 
