diff --git a/src/security/identity/memory-identity-storage.cpp b/src/security/identity/memory-identity-storage.cpp
index b3b7c69..c5fb409 100644
--- a/src/security/identity/memory-identity-storage.cpp
+++ b/src/security/identity/memory-identity-storage.cpp
@@ -10,6 +10,7 @@
 #endif
 #include <algorithm>
 #include <ndn-cpp/security/security-exception.hpp>
+#include <ndn-cpp/security/certificate/identity-certificate.hpp>
 #include <ndn-cpp/security/identity/memory-identity-storage.hpp>
 
 using namespace std;
@@ -49,25 +50,32 @@
 bool 
 MemoryIdentityStorage::doesKeyExist(const Name& keyName)
 {
-#if 1
-  throw runtime_error("MemoryIdentityStorage::doesKeyExist not implemented");
-#endif
+  return keyStore_.find(keyName.toUri()) != keyStore_.end();
 }
 
 void 
 MemoryIdentityStorage::addKey(const Name& keyName, KeyType keyType, const Blob& publicKeyDer)
 {
-#if 1
-  throw runtime_error("MemoryIdentityStorage::addKey not implemented");
-#endif
+  Name identityName = keyName.getSubName(0, keyName.size() - 1);
+
+  if (!doesIdentityExist(identityName))
+    addIdentity(identityName);
+
+  if (doesKeyExist(keyName))
+    throw SecurityException("a key with the same name already exists!");
+  
+  keyStore_[keyName.toUri()] = make_shared<KeyRecord>(keyType, publicKeyDer);
 }
 
 Blob
 MemoryIdentityStorage::getKey(const Name& keyName)
 {
-#if 1
-  throw runtime_error("MemoryIdentityStorage::getKey not implemented");
-#endif
+  map<string, shared_ptr<KeyRecord> >::iterator record = keyStore_.find(keyName.toUri());
+  if (record == keyStore_.end())
+    // Not found.  Silently return null.
+    return Blob();
+  
+  return record->second->getKeyDer();
 }
 
 void 
@@ -89,25 +97,44 @@
 bool
 MemoryIdentityStorage::doesCertificateExist(const Name& certificateName)
 {
-#if 1
-  throw runtime_error("MemoryIdentityStorage::doesCertificateExist not implemented");
-#endif
+  return certificateStore_.find(certificateName.toUri()) != certificateStore_.end();
 }
 
 void 
 MemoryIdentityStorage::addCertificate(const IdentityCertificate& certificate)
 {
-#if 1
-  throw runtime_error("MemoryIdentityStorage::addCertificate not implemented");
-#endif
+  const Name& certificateName = certificate.getName();
+  Name keyName = certificate.getPublicKeyName();
+
+  if (!doesKeyExist(keyName))
+    throw SecurityException("No corresponding Key record for certificate! " + keyName.toUri() + " " + certificateName.toUri());
+
+  // Check if certificate has already existed!
+  if (doesCertificateExist(certificateName))
+    throw SecurityException("Certificate has already been installed!");
+
+  // Check if the public key of certificate is the same as the key record. 
+  Blob keyBlob = getKey(keyName);
+  if (!keyBlob || (*keyBlob) != *(certificate.getPublicKeyInfo().getKeyDer()))
+    throw SecurityException("Certificate does not match the public key!");
+  
+  // Insert the certificate.
+  if (!certificate.getDefaultWireEncoding())
+    certificate.wireEncode();
+  certificateStore_[certificateName.toUri()] = certificate.getDefaultWireEncoding();
 }
 
 ptr_lib::shared_ptr<Data> 
-MemoryIdentityStorage::getCertificate(const Name &certificateName, bool allowAny)
+MemoryIdentityStorage::getCertificate(const Name& certificateName, bool allowAny)
 {
-#if 1
-  throw runtime_error("MemoryIdentityStorage::getCertificate not implemented");
-#endif
+  map<string, Blob>::iterator record = certificateStore_.find(certificateName.toUri());
+  if (record == certificateStore_.end())
+    // Not found.  Silently return null.
+    return shared_ptr<Data>();
+  
+  shared_ptr<Data> data(new Data());
+  data->wireDecode(*record->second);
+  return data;
 }
 
 Name 
diff --git a/src/security/identity/memory-private-key-storage.cpp b/src/security/identity/memory-private-key-storage.cpp
index f461a5b..b2bbcb5 100644
--- a/src/security/identity/memory-private-key-storage.cpp
+++ b/src/security/identity/memory-private-key-storage.cpp
@@ -26,7 +26,7 @@
    size_t privateKeyDerLength)
 {
   publicKeyStore_[keyName.toUri()] = PublicKey::fromDer(Blob(publicKeyDer, publicKeyDerLength));
-  privateKeyStore_[keyName.toUri()] = shared_ptr<RsaPrivateKey>(new RsaPrivateKey(privateKeyDer, privateKeyDerLength));
+  privateKeyStore_[keyName.toUri()] = make_shared<RsaPrivateKey>(privateKeyDer, privateKeyDerLength);
 }
 
 void 
