security: Porting security elements to the updated framework

Change-Id: Ie9ad6ee34f94fc520b9d3c8adf871e2557eaa9b6
diff --git a/include/ndn-cpp/security/certificate/certificate.hpp b/include/ndn-cpp/security/certificate/certificate.hpp
index 0c7323b..c2fd95a 100644
--- a/include/ndn-cpp/security/certificate/certificate.hpp
+++ b/include/ndn-cpp/security/certificate/certificate.hpp
@@ -18,11 +18,13 @@
 
 namespace ndn {
 
-typedef std::vector<CertificateSubjectDescription> SubjectDescriptionList;
-typedef std::vector<CertificateExtension> ExtensionList;
-
 class Certificate : public Data {
 public:
+  struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} };
+
+  typedef std::vector<CertificateSubjectDescription> SubjectDescriptionList;
+  typedef std::vector<CertificateExtension> ExtensionList;
+
   /**
    * The default constructor.
    */
@@ -40,6 +42,9 @@
   virtual 
   ~Certificate();
 
+  inline void
+  wireDecode(const Block &wire);
+  
   /**
    * encode certificate info into content
    */
@@ -117,7 +122,7 @@
   isTooLate();
 
   void 
-  printCertificate();
+  printCertificate(std::ostream &os) const;
 
 protected:
   void
@@ -131,6 +136,21 @@
   ExtensionList extensionList_;
 };
 
+inline void
+Certificate::wireDecode(const Block &wire)
+{
+  Data::wireDecode(wire);
+  decode();
 }
 
+
+inline std::ostream&
+operator <<(std::ostream &os, const Certificate &cert)
+{
+  cert.printCertificate(os);
+  return os;
+}
+
+} // namespace ndn
+
 #endif