Add EndorseCertificate
diff --git a/src/endorse-certificate.cpp b/src/endorse-certificate.cpp
new file mode 100644
index 0000000..a565ebc
--- /dev/null
+++ b/src/endorse-certificate.cpp
@@ -0,0 +1,77 @@
+/* -*- 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 "endorse-certificate.h"
+#include "exception.h"
+#include <ndn.cxx/security/certificate/certificate-subdescrpt.h>
+
+
+using namespace std;
+using namespace ndn;
+using namespace ndn::security;
+
+EndorseExtension::EndorseExtension(const Blob & value)
+  : CertificateExtension("1.3.6.1.5.32.2", true, value)
+{}
+
+EndorseCertificate::EndorseCertificate(const IdentityCertificate& kskCertificate,
+				       const Name& signer,
+				       const Time& notBefore,
+				       const Time& notAfter)
+  : Certificate()
+  , m_keyName(kskCertificate.getPublicKeyName())
+  , m_signer(signer)
+{
+  setNotBefore(notBefore);
+  setNotAfter(notAfter);
+  addSubjectDescription(CertificateSubDescrypt("2.5.4.41", m_keyName.toUri()));
+  setPublicKeyInfo(kskCertificate.getPublicKeyInfo());
+}
+
+EndorseCertificate::EndorseCertificate(const EndorseCertificate& endorseCertificate)
+  : Certificate(endorseCertificate)
+  , m_keyName(endorseCertificate.m_keyName)
+  , m_signer(endorseCertificate.m_signer)
+  , m_profileList(endorseCertificate.m_profileList)
+{}
+
+EndorseCertificate::EndorseCertificate(const Data& data)
+  : Certificate(data)
+{
+  const Name& dataName = data.getName();
+  name::Component certFlag(string("PROFILE-CERT"));  
+
+  int profileIndex = -1;
+  for(int i = 0; i < dataName.size(); i++)
+    {
+      if(0 == dataName.get(i).compare(certFlag))
+	{
+	  profileIndex = i;
+	  break;
+	}
+    }
+
+  if(profileIndex < 0)
+    throw LnException("No PROFILE-CERT component in data name!");
+
+  m_keyName = dataName.getSubName(0, profileIndex);
+  m_signer = dataName.getSubName(profileIndex + 1, dataName.size() - profileIndex - 2);
+
+  OID profileExtenstionOID("1.3.6.1.5.32.2");
+  ExtensionList::iterator it = m_extnList.begin();
+  for(; it != m_extnList.end(); it++)
+    {
+      if(profileExtenstionOID == it->getOID())
+	{
+	  Ptr<Blob> valueBlob = Ptr<Blob>(new Blob(it->getValue().buf(), it->getValue().size()));
+	  m_profileList.push_back(ProfileData(*(Data::decodeFromWire(valueBlob))));
+	}
+    }
+}
diff --git a/src/endorse-certificate.h b/src/endorse-certificate.h
new file mode 100644
index 0000000..28202da
--- /dev/null
+++ b/src/endorse-certificate.h
@@ -0,0 +1,74 @@
+/* -*- 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_ENDORSE_CERTIFICATE_H
+#define LINKEDN_ENDORSE_CERTIFICATE_H
+
+#include <vector>
+#include <ndn.cxx/data.h>
+#include <ndn.cxx/security/certificate/identity-certificate.h>
+#include <ndn.cxx/security/certificate/certificate-extension.h>
+
+#include "profile-data.h"
+
+class EndorseExtension : public ndn::security::CertificateExtension
+{
+public:
+  EndorseExtension(const ndn::Blob & value);
+
+  virtual
+  ~EndorseExtension() {}
+};
+
+class EndorseCertificate : public ndn::security::Certificate
+{
+public:
+  EndorseCertificate(const ndn::security::IdentityCertificate& kskCertificate,
+                     const ndn::Name& signer,
+                     const ndn::Time& notBefore,
+                     const ndn::Time& notAfter);
+
+  EndorseCertificate(const EndorseCertificate& endorseCertificate);
+
+  EndorseCertificate(const ndn::Data& data);
+
+  virtual
+  ~EndorseCertificate()
+  {}
+
+  void 
+  addProfile(const ProfileData& profile);
+
+  void
+  encode();
+
+  inline const ndn::Name&
+  getSigner() const
+  { return m_signer; }
+
+  inline const std::vector<ProfileData>&
+  getProfileList() const
+  { return m_profileList; }
+
+  inline ndn::Name
+  getPublicKeyName ()
+  { return m_keyName; }
+
+private:
+  void 
+  decode();
+
+private:
+  ndn::Name m_keyName;
+  ndn::Name m_signer;
+  std::vector<ProfileData> m_profileList;
+};
+
+#endif
diff --git a/src/profile-data.h b/src/profile-data.h
index 6e29a43..c70f6fc 100644
--- a/src/profile-data.h
+++ b/src/profile-data.h
@@ -23,7 +23,8 @@
   ProfileData (const ProfileData& profile);
 
   ProfileData (const ndn::Data& data);
-
+  
+  virtual
   ~ProfileData () {}
 
   inline const ndn::Name&