Add ContactItem
diff --git a/src/contact-item.cpp b/src/contact-item.cpp
new file mode 100644
index 0000000..08f4fa6
--- /dev/null
+++ b/src/contact-item.cpp
@@ -0,0 +1,40 @@
+/* -*- 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 "contact-item.h"
+#include "exception.h"
+
+#include <ndn.cxx/fields/signature-sha256-with-rsa.h>
+
+using namespace std;
+using namespace ndn;
+using namespace ndn::security;
+
+ContactItem::ContactItem(const EndorseCertificate& selfEndorseCertificate,
+                         const string& alias)
+  : m_selfEndorseCertificate(selfEndorseCertificate)
+{
+  Name endorsedkeyName = selfEndorseCertificate.getPublicKeyName();
+  Ptr<const signature::Sha256WithRsa> endorseSig = boost::dynamic_pointer_cast<const signature::Sha256WithRsa>(selfEndorseCertificate.getSignature());
+  const Name& signingKeyName = endorseSig->getKeyLocator().getKeyName();
+
+  if(endorsedkeyName != signingKeyName)
+    throw LnException("not a self-claimed");
+
+  m_namespace = endorsedkeyName.getSubName(0, endorsedkeyName.size() - 1);
+  m_alias = alias.empty() ? m_namespace.toUri() : alias;
+
+  Ptr<ProfileData> profileData = selfEndorseCertificate.getProfileData();
+  Ptr<const Blob> nameBlob = profileData->getProfile().getProfileEntry("name");
+  m_name = string(nameBlob->buf(), nameBlob->size());
+  Ptr<const Blob> institutionBlob = profileData->getProfile().getProfileEntry("institution");
+  m_institution = string(institutionBlob->buf(), institutionBlob->size());
+}
+
diff --git a/src/contact-item.h b/src/contact-item.h
new file mode 100644
index 0000000..2940693
--- /dev/null
+++ b/src/contact-item.h
@@ -0,0 +1,54 @@
+/* -*- 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 CONTACT_ITEM_H
+#define CONTACT_ITEM_H
+
+#include <ndn.cxx/data.h>
+#include <vector>
+#include "endorse-certificate.h"
+
+class ContactItem
+{
+  typedef std::vector<Ptr<EndorseCertificate> > EndorseCertificateList;
+
+public:
+  ContactItem(const EndorseCertificate& selfEndorseCertificate,
+              const std::string& alias = std::string());
+  
+  ~ContactItem() {}
+
+  const ndn::Name&
+  getNameSpace() const
+  { return m_namespace; }
+
+  const std::string&
+  getAlias() const
+  { return m_alias; }
+
+  const std::string&
+  getName() const
+  { return m_name; }
+
+  const std::string&
+  getInstitution() const
+  { return m_institution; }
+
+private:
+  EndorseCertificate m_selfEndorseCertificate;
+
+  ndn::Name m_namespace;
+  std::string m_alias;
+
+  std::string m_name;
+  std::string m_institution;
+};
+
+#endif
diff --git a/src/profile.cpp b/src/profile.cpp
index 182fe77..06282af 100644
--- a/src/profile.cpp
+++ b/src/profile.cpp
@@ -42,10 +42,10 @@
 { m_entries[profileType] = profileValue; }
 
 Ptr<const Blob>
-Profile::getProfileEntry(const string& profileType)
+Profile::getProfileEntry(const string& profileType) const
 {
   if(m_entries.find(profileType) != m_entries.end())
-      return Ptr<Blob>(new Blob(m_entries[profileType].buf(), m_entries[profileType].size()));
+    return Ptr<Blob>(new Blob(m_entries.at(profileType).buf(), m_entries.at(profileType).size()));
 
   return NULL;
 }
diff --git a/src/profile.h b/src/profile.h
index 403b600..0f5a5cc 100644
--- a/src/profile.h
+++ b/src/profile.h
@@ -41,7 +41,7 @@
                   const ndn::Blob& profileValue);
   
   ndn::Ptr<const ndn::Blob>
-  getProfileEntry(const std::string& profileType);
+  getProfileEntry(const std::string& profileType) const;
 
   inline Profile::iterator
   begin()