diff --git a/src/security/in-memory-pib-impl.cpp b/src/security/in-memory-pib-impl.cpp
new file mode 100644
index 0000000..bf9d299
--- /dev/null
+++ b/src/security/in-memory-pib-impl.cpp
@@ -0,0 +1,224 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2015 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#include "in-memory-pib-impl.hpp"
+#include "pib.hpp"
+
+namespace ndn {
+namespace security {
+
+InMemoryPibImpl::InMemoryPibImpl()
+  : m_hasDefaultIdentity(false)
+{
+}
+
+void
+InMemoryPibImpl::setTpmLocator(const std::string& tpmLocator)
+{
+  throw Error("InMemoryPib/Tpm does not need a locator");
+}
+
+std::string
+InMemoryPibImpl::getTpmLocator() const
+{
+  return "tpm-memory:";
+}
+
+bool
+InMemoryPibImpl::hasIdentity(const Name& identity) const
+{
+  return (m_identities.count(identity) > 0);
+}
+
+void
+InMemoryPibImpl::addIdentity(const Name& identity)
+{
+  m_identities.insert(identity);
+}
+
+void
+InMemoryPibImpl::removeIdentity(const Name& identity)
+{
+  m_identities.erase(identity);
+  if (identity == m_defaultIdentity)
+    m_hasDefaultIdentity = false;
+}
+
+std::set<Name>
+InMemoryPibImpl::getIdentities() const
+{
+  return m_identities;
+}
+
+void
+InMemoryPibImpl::setDefaultIdentity(const Name& identityName)
+{
+  addIdentity(identityName);
+  m_defaultIdentity = identityName;
+  m_hasDefaultIdentity = true;
+}
+
+Name
+InMemoryPibImpl::getDefaultIdentity() const
+{
+  if (m_hasDefaultIdentity)
+    return m_defaultIdentity;
+
+  throw Pib::Error("No default identity");
+}
+
+bool
+InMemoryPibImpl::hasKey(const Name& identity, const name::Component& keyId) const
+{
+  return (m_keys.count(getKeyName(identity, keyId)) > 0);
+}
+
+void
+InMemoryPibImpl::addKey(const Name& identity, const name::Component& keyId, const PublicKey& publicKey)
+{
+  m_keys[getKeyName(identity, keyId)] = publicKey;
+}
+
+void
+InMemoryPibImpl::removeKey(const Name& identity, const name::Component& keyId)
+{
+  m_keys.erase(getKeyName(identity, keyId));
+}
+
+PublicKey
+InMemoryPibImpl::getKeyBits(const Name& identity, const name::Component& keyId) const
+{
+  auto it = m_keys.find(getKeyName(identity, keyId));
+  if (it == m_keys.end())
+    throw Pib::Error("No default certificate");
+
+  return it->second;
+}
+
+std::set<name::Component>
+InMemoryPibImpl::getKeysOfIdentity(const Name& identity) const
+{
+  std::set<name::Component> ids;
+  for (const auto& it : m_keys) {
+    if (identity == it.first.getPrefix(-1))
+      ids.insert(it.first.get(-1));
+  }
+  return ids;
+}
+
+void
+InMemoryPibImpl::setDefaultKeyOfIdentity(const Name& identity, const name::Component& keyId)
+{
+  Name keyName = getKeyName(identity, keyId);
+
+  if (!hasKey(identity, keyId))
+    throw Pib::Error("No key");
+
+  m_defaultKey[identity] = keyName;
+}
+
+name::Component
+InMemoryPibImpl::getDefaultKeyOfIdentity(const Name& identity) const
+{
+  auto it = m_defaultKey.find(identity);
+  if (it == m_defaultKey.end())
+    throw Pib::Error("No default key");
+
+  return it->second.get(-1);
+}
+
+Name
+InMemoryPibImpl::getKeyName(const Name& identity, const name::Component& keyId) const
+{
+  Name keyName = identity;
+  keyName.append(keyId);
+  return keyName;
+}
+
+bool
+InMemoryPibImpl::hasCertificate(const Name& certName) const
+{
+  return (m_certs.count(certName) > 0);
+}
+
+void
+InMemoryPibImpl::addCertificate(const IdentityCertificate& certificate)
+{
+  m_certs[certificate.getName()] = certificate;
+}
+
+void
+InMemoryPibImpl::removeCertificate(const Name& certName)
+{
+  m_certs.erase(certName);
+}
+
+IdentityCertificate
+InMemoryPibImpl::getCertificate(const Name& certName) const
+{
+  auto it = m_certs.find(certName);
+  if (it == m_certs.end())
+    throw Pib::Error("No cert");
+
+  return it->second;
+}
+
+std::set<Name>
+InMemoryPibImpl::getCertificatesOfKey(const Name& identity, const name::Component& keyId) const
+{
+  Name keyName = getKeyName(identity, keyId);
+
+  std::set<Name> certNames;
+  for (const auto& it : m_certs) {
+    if (it.second.getPublicKeyName() == keyName)
+      certNames.insert(it.first);
+  }
+  return certNames;
+}
+
+void
+InMemoryPibImpl::setDefaultCertificateOfKey(const Name& identity, const name::Component& keyId, const Name& certName)
+{
+  if (!hasCertificate(certName))
+    throw Pib::Error("No cert");
+
+  Name keyName = getKeyName(identity, keyId);
+  m_defaultCert[keyName] = certName;
+}
+
+IdentityCertificate
+InMemoryPibImpl::getDefaultCertificateOfKey(const Name& identity, const name::Component& keyId) const
+{
+  Name keyName = getKeyName(identity, keyId);
+
+  auto it = m_defaultCert.find(keyName);
+  if (it == m_defaultCert.end())
+    throw Pib::Error("No default certificate");
+
+  auto certIt = m_certs.find(it->second);
+  if (certIt == m_certs.end())
+    throw Pib::Error("No default certificate");
+  else
+    return certIt->second;
+}
+
+} // namespace security
+} // namespace ndn
diff --git a/src/security/in-memory-pib-impl.hpp b/src/security/in-memory-pib-impl.hpp
new file mode 100644
index 0000000..8ef5bab
--- /dev/null
+++ b/src/security/in-memory-pib-impl.hpp
@@ -0,0 +1,153 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2015 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#ifndef NDN_SECURITY_IN_MEMORY_PIB_IMPL_HPP
+#define NDN_SECURITY_IN_MEMORY_PIB_IMPL_HPP
+
+#include "pib-impl.hpp"
+
+namespace ndn {
+namespace security {
+
+/**
+ * @brief An in-memory implementation of Pib
+ *
+ * All the contents in Pib are stored in memory
+ * and have the same lifetime as the implementation instance.
+ */
+class InMemoryPibImpl : public PibImpl
+{
+public:
+  class Error : public PibImpl::Error
+  {
+  public:
+    explicit
+    Error(const std::string& what)
+      : PibImpl::Error(what)
+    {
+    }
+  };
+
+public:
+  InMemoryPibImpl();
+
+public: // TpmLocator management
+
+  virtual void
+  setTpmLocator(const std::string& tpmLocator) NDN_CXX_DECL_OVERRIDE;
+
+  virtual std::string
+  getTpmLocator() const NDN_CXX_DECL_OVERRIDE;
+
+public: // Identity management
+
+  virtual bool
+  hasIdentity(const Name& identity) const NDN_CXX_DECL_OVERRIDE;
+
+  virtual void
+  addIdentity(const Name& identity) NDN_CXX_DECL_OVERRIDE;
+
+  virtual void
+  removeIdentity(const Name& identity) NDN_CXX_DECL_OVERRIDE;
+
+  virtual std::set<Name>
+  getIdentities() const NDN_CXX_DECL_OVERRIDE;
+
+  virtual void
+  setDefaultIdentity(const Name& identityName) NDN_CXX_DECL_OVERRIDE;
+
+  virtual Name
+  getDefaultIdentity() const NDN_CXX_DECL_OVERRIDE;
+
+public: // Key management
+
+  virtual bool
+  hasKey(const Name& identity, const name::Component& keyId) const NDN_CXX_DECL_OVERRIDE;
+
+  virtual void
+  addKey(const Name& identity, const name::Component& keyId, const PublicKey& publicKey) NDN_CXX_DECL_OVERRIDE;
+
+  virtual void
+  removeKey(const Name& identity, const name::Component& keyId) NDN_CXX_DECL_OVERRIDE;
+
+  virtual PublicKey
+  getKeyBits(const Name& identity, const name::Component& keyId) const NDN_CXX_DECL_OVERRIDE;
+
+  virtual std::set<name::Component>
+  getKeysOfIdentity(const Name& identity) const NDN_CXX_DECL_OVERRIDE;
+
+  virtual void
+  setDefaultKeyOfIdentity(const Name& identity, const name::Component& keyId) NDN_CXX_DECL_OVERRIDE;
+
+  virtual name::Component
+  getDefaultKeyOfIdentity(const Name& identity) const NDN_CXX_DECL_OVERRIDE;
+
+public: // Certificate management
+
+  virtual bool
+  hasCertificate(const Name& certName) const NDN_CXX_DECL_OVERRIDE;
+
+  virtual void
+  addCertificate(const IdentityCertificate& certificate) NDN_CXX_DECL_OVERRIDE;
+
+  virtual void
+  removeCertificate(const Name& certName) NDN_CXX_DECL_OVERRIDE;
+
+  virtual IdentityCertificate
+  getCertificate(const Name& certName) const NDN_CXX_DECL_OVERRIDE;
+
+  virtual std::set<Name>
+  getCertificatesOfKey(const Name& identity, const name::Component& keyId) const NDN_CXX_DECL_OVERRIDE;
+
+  virtual void
+  setDefaultCertificateOfKey(const Name& identity, const name::Component& keyId, const Name& certName) NDN_CXX_DECL_OVERRIDE;
+
+  virtual IdentityCertificate
+  getDefaultCertificateOfKey(const Name& identity, const name::Component& keyId) const NDN_CXX_DECL_OVERRIDE;
+
+private: // Key management
+
+  Name
+  getKeyName(const Name& identity, const name::Component& keyId) const;
+
+private:
+
+  std::set<Name> m_identities;
+  bool m_hasDefaultIdentity;
+  Name m_defaultIdentity;
+
+  /// @brief keyName => keyBits
+  std::map<Name, PublicKey> m_keys;
+
+  /// @brief identity => default key Name
+  std::map<Name, Name> m_defaultKey;
+
+  /// @brief certificate Name => certificate
+  std::map<Name, IdentityCertificate> m_certs;
+
+  /// @brief keyName => default certificate Name
+  std::map<Name, Name> m_defaultCert;
+};
+
+} // namespace security
+} // namespace ndn
+
+#endif // NDN_SECURITY_SEC_PIB_MEMORY_IMPL_HPP
