security: Added headers for der encoding. Added CertificateExtension and CertificateSubjectDescription.
diff --git a/include/Makefile.am b/include/Makefile.am
index 06d98aa..8ea2630 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -34,6 +34,8 @@
ndn-cpp/security/security-common.hpp \
ndn-cpp/security/key-chain.hpp \
ndn-cpp/security/security-exception.hpp \
+ ndn-cpp/security/certificate/certificate-extension.hpp \
+ ndn-cpp/security/certificate/certificate-subject-description.hpp \
ndn-cpp/security/certificate/certificate.hpp \
ndn-cpp/security/certificate/identity-certificate.hpp \
ndn-cpp/security/certificate/public-key.hpp \
diff --git a/include/Makefile.in b/include/Makefile.in
index 0ede7e9..82fc5c2 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -351,6 +351,8 @@
ndn-cpp/security/security-common.hpp \
ndn-cpp/security/key-chain.hpp \
ndn-cpp/security/security-exception.hpp \
+ ndn-cpp/security/certificate/certificate-extension.hpp \
+ ndn-cpp/security/certificate/certificate-subject-description.hpp \
ndn-cpp/security/certificate/certificate.hpp \
ndn-cpp/security/certificate/identity-certificate.hpp \
ndn-cpp/security/certificate/public-key.hpp \
diff --git a/include/ndn-cpp/security/certificate/certificate-extension.hpp b/include/ndn-cpp/security/certificate/certificate-extension.hpp
new file mode 100644
index 0000000..5990cd4
--- /dev/null
+++ b/include/ndn-cpp/security/certificate/certificate-extension.hpp
@@ -0,0 +1,80 @@
+/* -*- 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.
+ */
+
+#ifndef NDN_CERTIFICATE_EXTENSION_HPP
+#define NDN_CERTIFICATE_EXTENSION_HPP
+
+#include "../../common.hpp"
+#include "../../util/blob.hpp"
+#include "../../encoding/oid.hpp"
+
+namespace ndn {
+
+namespace der { class DerNode; }
+
+/**
+ * A CertificateExtension represents the Extension entry in a certificate.
+ */
+class CertificateExtension
+{
+public:
+ /**
+ * Create a new CertificateExtension.
+ * @param oid The oid of subject description entry.
+ * @param isCritical If true, the extension must be handled.
+ * @param value The extension value. This makes a copy of the value.
+ */
+ CertificateExtension(const std::string& oid, const bool isCritical, const std::vector<uint8_t>& value)
+ : extensionId_(oid), isCritical_(isCritical), extensionValue_(value)
+ {
+ }
+
+ /**
+ * Create a new CertificateExtension.
+ * @param oid The oid of subject description entry.
+ * @param isCritical If true, the extension must be handled.
+ * @param value The extension value. This makes a copy of the value.
+ */
+ CertificateExtension(const OID& oid, const bool isCritical, const std::vector<uint8_t>& value)
+ : extensionId_(oid), isCritical_(isCritical), extensionValue_(value)
+ {
+ }
+
+ /**
+ * The virtual destructor.
+ */
+ virtual
+ ~CertificateExtension() {}
+
+ /**
+ * encode the object into DER syntax tree
+ * @return the encoded DER syntax tree
+ */
+ ptr_lib::shared_ptr<der::DerNode>
+ toDer();
+
+ Blob
+ toDerBlob();
+
+ inline const OID&
+ getOid() const { return extensionId_; }
+
+ inline const bool
+ getIsCritical() const { return isCritical_; }
+
+ inline const Blob&
+ getValue() const { return extensionValue_; }
+
+protected:
+ OID extensionId_;
+ bool isCritical_;
+ Blob extensionValue_;
+};
+
+}
+
+#endif
diff --git a/include/ndn-cpp/security/certificate/certificate-subject-description.hpp b/include/ndn-cpp/security/certificate/certificate-subject-description.hpp
new file mode 100644
index 0000000..90ff7fe
--- /dev/null
+++ b/include/ndn-cpp/security/certificate/certificate-subject-description.hpp
@@ -0,0 +1,70 @@
+/* -*- 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_CERTIFICATE_SUBJECT_DESCRIPTION_HPP
+#define NDN_CERTIFICATE_SUBJECT_DESCRIPTION_HPP
+
+#include "../../common.hpp"
+#include "../../encoding/oid.hpp"
+
+namespace ndn {
+
+namespace der { class DerNode; }
+
+/**
+ * A CertificateSubjectDescription represents the SubjectDescription entry in a Certificate.
+ */
+class CertificateSubjectDescription {
+public:
+ /**
+ * Create a new CertificateSubjectDescription.
+ * @param oid The oid of the subject description entry.
+ * @param value The value of the subject description entry.
+ */
+ CertificateSubjectDescription(std::string oid, std::string value)
+ : oid_(oid), value_(value)
+ {
+ }
+
+ /**
+ * Create a new CertificateSubjectDescription.
+ * @param oid The oid of the subject description entry.
+ * @param value The value of the subject description entry.
+ */
+ CertificateSubjectDescription(OID oid, std::string value)
+ : oid_(oid), value_(value)
+ {
+ }
+
+ /**
+ * Encode the object into a DER syntax tree.
+ * @return The encoded DER syntax tree.
+ */
+ ptr_lib::shared_ptr<der::DerNode>
+ toDer();
+
+ std::string
+ getOidString()
+ {
+ return oid_.toString();
+ }
+
+ const std::string &
+ getValue() const
+ {
+ return value_;
+ }
+
+private:
+ OID oid_;
+ std::string value_;
+};
+
+}
+
+#endif
diff --git a/include/ndn-cpp/security/identity/identity-manager.hpp b/include/ndn-cpp/security/identity/identity-manager.hpp
index d461062..9028065 100644
--- a/include/ndn-cpp/security/identity/identity-manager.hpp
+++ b/include/ndn-cpp/security/identity/identity-manager.hpp
@@ -14,11 +14,11 @@
#include "../certificate/public-key.hpp"
#include "private-key-storage.hpp"
+namespace ndn {
+
// TODO: Implement Time values.
class Time;
-namespace ndn {
-
/**
* An IdentityManager is the interface of operations related to identity, keys, and certificates.
*/