diff --git a/ndn-cpp/security/certificate/oid.cpp b/ndn-cpp/security/certificate/oid.cpp
new file mode 100644
index 0000000..6ae1942
--- /dev/null
+++ b/ndn-cpp/security/certificate/oid.cpp
@@ -0,0 +1,67 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * @author: Jeff Thompson <jefft0@remap.ucla.edu>
+ * See COPYING for copyright and distribution information.
+ */
+
+#include <stdlib.h>
+#include <sstream>
+
+#include "oid.hpp"
+
+using namespace std;
+
+namespace ndn {
+
+OID::OID(const string& oid)
+{
+  string str = oid + ".";
+
+  size_t pos = 0;
+  size_t ppos = 0;
+
+  while(string::npos != pos){
+    ppos = pos;
+
+    pos = str.find_first_of('.', pos);
+    if(pos == string::npos)
+	    break;
+
+    oid_.push_back(atoi(str.substr(ppos, pos - ppos).c_str()));
+
+    pos++;
+  }
+}
+
+string OID::toString()
+{
+  ostringstream convert;
+  
+  vector<int>::iterator it = oid_.begin();
+  for(; it < oid_.end(); it++){
+    if(it != oid_.begin())
+      convert << ".";
+    convert << *it;
+  }
+  
+  return convert.str();
+}
+
+bool OID::equal(const OID& oid)
+{
+  vector<int>::const_iterator i = oid_.begin();
+  vector<int>::const_iterator j = oid.oid_.begin();
+    
+  for (; i != oid_.end () && j != oid.oid_.end (); i++, j++) {
+    if(*i != *j)
+      return false;
+  }
+
+  if (i == oid_.end () && j == oid.oid_.end ())
+    return true;
+  else
+    return false;
+}
+
+}
diff --git a/ndn-cpp/security/certificate/oid.hpp b/ndn-cpp/security/certificate/oid.hpp
new file mode 100644
index 0000000..bcbcfe9
--- /dev/null
+++ b/ndn-cpp/security/certificate/oid.hpp
@@ -0,0 +1,62 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * @author: Yingdi Yu <yingdi@cs.ucla.edu>
+ * @author: Jeff Thompson <jefft0@remap.ucla.edu>
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NDN_OID_HPP
+#define	NDN_OID_HPP
+
+#include <vector>
+#include <string>
+
+namespace ndn {
+
+class OID {
+public:
+  OID () 
+  {
+  }
+    
+  OID(const std::string& oid);
+
+  OID(const std::vector<int>& oid)
+  : oid_(oid)
+  {
+  }
+
+  const std::vector<int> &
+  getIntegerList() const
+  {
+    return oid_;
+  }
+
+  void
+  setIntegerList(const std::vector<int>& value){
+    oid_ = value;
+  }
+
+  std::string 
+  toString();
+
+  bool operator == (const OID& oid)
+  {
+    return equal(oid);
+  }
+
+  bool operator != (const OID& oid)
+  {
+    return !equal(oid);
+  }
+  
+private:
+  bool equal(const OID& oid);
+
+  std::vector<int> oid_;
+};
+
+}
+
+#endif
diff --git a/ndn-cpp/security/certificate/public-key.cpp b/ndn-cpp/security/certificate/public-key.cpp
new file mode 100644
index 0000000..1f64c07
--- /dev/null
+++ b/ndn-cpp/security/certificate/public-key.cpp
@@ -0,0 +1,57 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * @author: Yingdi Yu <yingdi@cs.ucla.edu>
+ * @author: Jeff Thompson <jefft0@remap.ucla.edu>
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "../security-exception.hpp"
+#include "../../c/util/crypto.h"
+#include "public-key.hpp"
+
+using namespace std;
+using namespace ndn::ptr_lib;
+
+namespace ndn {
+
+#if 0
+Ptr<der::DerNode>
+PublicKey::toDER()
+{
+  boost::iostreams::stream
+    <boost::iostreams::array_source> is (m_key.buf (), m_key.size ());
+
+  return der::DerNode::parse(reinterpret_cast<InputIterator &> (is));
+}
+#endif
+
+static int RSA_OID[] = { 1, 2, 840, 113549, 1, 1, 1 };
+
+shared_ptr<PublicKey>
+PublicKey::fromDer(const Blob& keyDer)
+{
+  // Use a temporary pointer since d2i updates it.
+  const unsigned char *derPointer = keyDer.buf();
+  RSA *publicKey = d2i_RSA_PUBKEY(NULL, &derPointer, keyDer.size());
+  if (!publicKey)
+    throw UnrecognizedKeyFormatException("Error decoding public key DER");  
+  RSA_free(publicKey);
+  
+  return shared_ptr<PublicKey>(new PublicKey(OID(vector<int>(RSA_OID, RSA_OID + sizeof(RSA_OID))), keyDer));
+}
+
+Blob
+PublicKey::getDigest(DigestAlgorithm digestAlgorithm) const
+{
+  if (digestAlgorithm == DIGEST_ALGORITHM_SHA256) {
+    unsigned char digest[SHA256_DIGEST_LENGTH];
+    ndn_digestSha256(keyDer_.buf(), keyDer_.size(), digest);
+    
+    return Blob(digest, sizeof(digest));
+  }
+  else
+    throw UnrecognizedDigestAlgorithmException("Wrong format!");
+}
+
+}
diff --git a/ndn-cpp/security/certificate/public-key.hpp b/ndn-cpp/security/certificate/public-key.hpp
new file mode 100644
index 0000000..7db3f49
--- /dev/null
+++ b/ndn-cpp/security/certificate/public-key.hpp
@@ -0,0 +1,72 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * @author: Yingdi Yu <yingdi@cs.ucla.edu>
+ * @author: Jeff Thompson <jefft0@remap.ucla.edu>
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NDN_PUBLIC_KEY_HPP
+#define	NDN_PUBLIC_KEY_HPP
+
+#include "../../util/blob.hpp"
+#include "oid.hpp"
+#include "../security-common.hpp"
+
+namespace ndn {
+
+class PublicKey {
+public:    
+  /**
+   * The default constructor.
+   */
+  PublicKey() {}
+
+  /**
+   * Constructor
+   * @param algorithm The algorithm of the public key.
+   * @param keyDer The blob of the PublicKeyInfo in terms of DER.
+   */
+  PublicKey(const OID& algorithm, const Blob& keyDer)
+  : algorithm_(algorithm), keyDer_(keyDer)
+  {
+  }
+
+#if 0
+  /**
+   * Encode the public key into DER.
+   * @return the encoded DER syntax tree.
+   */
+  Ptr<der::DerNode>
+  toDer();
+#endif
+
+  /**
+   * Decode the public key from DER blob.
+   * @param keyDer The DER blob.
+   * @return The decoded public key.
+   */
+  static ptr_lib::shared_ptr<PublicKey>
+  fromDer(const Blob& keyDer);
+
+  /*
+   * @brief get the digest of the public key
+   * @param digestAlgorithm The digest algorithm. If omitted, use DIGEST_SHA256 by default.
+   */
+  Blob 
+  getDigest(DigestAlgorithm digestAlgorithm = DIGEST_ALGORITHM_SHA256) const;
+
+  /*
+   * Get the raw bytes of the public key in DER format.
+   */
+  const Blob& 
+  getKeyDer() const { return keyDer_; }
+    
+private:
+  OID algorithm_; /**< Algorithm */
+  Blob keyDer_;   /**< PublicKeyInfo in DER */
+};
+
+}
+
+#endif
