diff --git a/Makefile.am b/Makefile.am
index 8a6aaf2..0d7b1fb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -83,24 +83,8 @@
   src/encoding/binary-xml-structure-decoder.hpp \
   src/encoding/binary-xml-wire-format.cpp \
   src/encoding/block.cpp \
-  src/encoding/der/der-exception.cpp \
-  src/encoding/der/der-exception.hpp \
-  src/encoding/der/der.cpp \
-  src/encoding/der/der.hpp \
-  src/encoding/der/visitor/certificate-data-visitor.cpp \
-  src/encoding/der/visitor/certificate-data-visitor.hpp \
-  src/encoding/der/visitor/no-arguments-visitor.cpp \
-  src/encoding/der/visitor/no-arguments-visitor.hpp \
-  src/encoding/der/visitor/print-visitor.cpp \
-  src/encoding/der/visitor/print-visitor.hpp \
-  src/encoding/der/visitor/public-key-visitor.cpp \
-  src/encoding/der/visitor/public-key-visitor.hpp \
-  src/encoding/der/visitor/simple-visitor.cpp \
-  src/encoding/der/visitor/simple-visitor.hpp \
-  src/encoding/der/visitor/visitor.hpp \
-  src/encoding/der/visitor/void-no-arguments-visitor.hpp \
-  src/encoding/der/visitor/void-visitor.cpp \
-  src/encoding/der/visitor/void-visitor.hpp \
+  src/encoding/cryptopp/asn_ext.cpp \
+  src/encoding/cryptopp/asn_ext.hpp \
   src/encoding/element-listener.cpp \
   src/encoding/oid.cpp \
   src/encoding/wire-format.cpp \
diff --git a/include/ndn-cpp/encoding/oid.hpp b/include/ndn-cpp/encoding/oid.hpp
index f217889..f89339c 100644
--- a/include/ndn-cpp/encoding/oid.hpp
+++ b/include/ndn-cpp/encoding/oid.hpp
@@ -12,6 +12,8 @@
 #include <vector>
 #include <string>
 
+namespace CryptoPP { class BufferedTransformation; }
+
 namespace ndn {
 
 class OID {
@@ -50,6 +52,12 @@
   {
     return !equal(oid);
   }
+
+  void
+  encode(CryptoPP::BufferedTransformation &out) const;
+
+  void
+  decode(CryptoPP::BufferedTransformation &in);
   
 private:
   bool equal(const OID& oid) const;
diff --git a/include/ndn-cpp/security/certificate/certificate-extension.hpp b/include/ndn-cpp/security/certificate/certificate-extension.hpp
index b47b880..697993c 100644
--- a/include/ndn-cpp/security/certificate/certificate-extension.hpp
+++ b/include/ndn-cpp/security/certificate/certificate-extension.hpp
@@ -10,12 +10,12 @@
 #define NDN_CERTIFICATE_EXTENSION_HPP
 
 #include "../../common.hpp"
-#include "../../util/blob.hpp"
+#include "../../encoding/buffer.hpp"
 #include "../../encoding/oid.hpp"
 
-namespace ndn {
+namespace CryptoPP { class BufferedTransformation; }
 
-namespace der { class DerNode; }
+namespace ndn {
 
 /**
  * A CertificateExtension represents the Extension entry in a certificate.
@@ -23,13 +23,18 @@
 class CertificateExtension
 {
 public:
+  CertificateExtension(CryptoPP::BufferedTransformation &in)
+  {
+    decode(in);
+  }
+  
   /**
    * 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.
    */
-  CertificateExtension(const std::string& oid, const bool isCritical, const Blob& value)
+  CertificateExtension(const std::string& oid, const bool isCritical, const Buffer& value)
   : extensionId_(oid), isCritical_(isCritical), extensionValue_(value)
   {
   }
@@ -40,7 +45,7 @@
    * @param isCritical If true, the extension must be handled.
    * @param value The extension value.
    */
-  CertificateExtension(const OID& oid, const bool isCritical, const Blob& value)
+  CertificateExtension(const OID& oid, const bool isCritical, const Buffer& value)
   : extensionId_(oid), isCritical_(isCritical), extensionValue_(value)
   {
   }
@@ -51,29 +56,25 @@
   virtual
   ~CertificateExtension() {}
 
-  /**
-   * encode the object into DER syntax tree
-   * @return the encoded DER syntax tree
-   */
-  ptr_lib::shared_ptr<der::DerNode> 
-  toDer() const;
+  void
+  encode(CryptoPP::BufferedTransformation &out) const;
 
-  Blob
-  toDerBlob() const;
-
+  void
+  decode(CryptoPP::BufferedTransformation &in);
+  
   inline const OID& 
   getOid() const { return extensionId_; }
 
   inline const bool 
   getIsCritical() const { return isCritical_; }
 
-  inline const Blob& 
+  inline const Buffer& 
   getValue() const { return extensionValue_; }
     
 protected:
   OID extensionId_;
   bool isCritical_;
-  Blob extensionValue_;
+  Buffer extensionValue_;
 };
 
 }
diff --git a/include/ndn-cpp/security/certificate/certificate-subject-description.hpp b/include/ndn-cpp/security/certificate/certificate-subject-description.hpp
index 30af6bf..9576e0d 100644
--- a/include/ndn-cpp/security/certificate/certificate-subject-description.hpp
+++ b/include/ndn-cpp/security/certificate/certificate-subject-description.hpp
@@ -12,42 +12,46 @@
 #include "../../common.hpp"
 #include "../../encoding/oid.hpp"
 
+namespace CryptoPP { class BufferedTransformation; }
+
 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)
+  CertificateSubjectDescription(CryptoPP::BufferedTransformation &in)
   {
-  }
-
-  /**
-   * 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)
-  {
+    decode(in);
   }
   
   /**
-   * Encode the object into a DER syntax tree.
-   * @return The encoded DER syntax tree.
+   * Create a new CertificateSubjectDescription.
+   * @param oid The oid of the subject description entry.
+   * @param value The value of the subject description entry.
    */
-  ptr_lib::shared_ptr<der::DerNode> 
-  toDer() const;
+  CertificateSubjectDescription(const std::string &oid, const 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(const OID &oid, const std::string &value)
+  : oid_(oid), value_(value)
+  {
+  }
+
+  void
+  encode(CryptoPP::BufferedTransformation &out) const;
+
+  void
+  decode(CryptoPP::BufferedTransformation &in);
+  
   std::string
   getOidString() const
   {
diff --git a/include/ndn-cpp/security/certificate/certificate.hpp b/include/ndn-cpp/security/certificate/certificate.hpp
index 025e420..0c7323b 100644
--- a/include/ndn-cpp/security/certificate/certificate.hpp
+++ b/include/ndn-cpp/security/certificate/certificate.hpp
@@ -99,8 +99,8 @@
   const PublicKey& 
   getPublicKeyInfo() const { return key_; }
 
-  virtual Name 
-  getPublicKeyName() const = 0;
+  // virtual Name 
+  // getPublicKeyName() const = 0;
   
   /**
    * Check if the certificate is valid.
diff --git a/include/ndn-cpp/security/certificate/public-key.hpp b/include/ndn-cpp/security/certificate/public-key.hpp
index a2237fa..43e1223 100644
--- a/include/ndn-cpp/security/certificate/public-key.hpp
+++ b/include/ndn-cpp/security/certificate/public-key.hpp
@@ -9,64 +9,63 @@
 #ifndef NDN_PUBLIC_KEY_HPP
 #define NDN_PUBLIC_KEY_HPP
 
-#include "../../util/blob.hpp"
 #include "../../encoding/oid.hpp"
+#include "../../encoding/buffer.hpp"
 #include "../security-common.hpp"
 
 namespace ndn {
 
-  namespace der { class DerNode; }
-
 class PublicKey {
 public:    
+  struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} };
+
   /**
    * The default constructor.
    */
-  PublicKey() {}
+  PublicKey();
 
   /**
    * Create a new PublicKey with the given values.
    * @param algorithm The algorithm of the public key.
    * @param keyDer The blob of the PublicKeyInfo in terms of DER.
+   *
+   * @throws PublicKey::Error If algorithm is not supported or keyDer cannot be decoded
    */
-  PublicKey(const OID& algorithm, const Blob& keyDer)
-  : algorithm_(algorithm), keyDer_(keyDer)
+  PublicKey(const uint8_t *keyDerBuf, size_t keyDerSize);
+
+  const Buffer&
+  get() const
   {
+    return key_;
   }
 
-  /**
-   * Encode the public key into DER.
-   * @return the encoded DER syntax tree.
-   */
-  ptr_lib::shared_ptr<der::DerNode>
-  toDer();
+  void
+  set(const uint8_t *keyDerBuf, size_t keyDerSize)
+  {
+    Buffer buf(keyDerBuf, keyDerSize);
+    key_.swap(buf);
+  }
 
-  /**
-   * 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);
+  void
+  encode(CryptoPP::BufferedTransformation &out) const;
 
-  /*
-   * Get the digest of the public key.
-   * @param digestAlgorithm The digest algorithm. If omitted, use DIGEST_ALGORITHM_SHA256 by default.
-   */
-  Blob 
-  getDigest(DigestAlgorithm digestAlgorithm = DIGEST_ALGORITHM_SHA256) const;
+  void
+  decode(CryptoPP::BufferedTransformation &in);
 
-  /*
-   * Get the raw bytes of the public key in DER format.
-   */
-  const Blob& 
-  getKeyDer() const { return keyDer_; }
-    
+  // /*
+  //  * Get the digest of the public key.
+  //  * @param digestAlgorithm The digest algorithm. If omitted, use DIGEST_ALGORITHM_SHA256 by default.
+  //  */
+  // Blob 
+  // getDigest(DigestAlgorithm digestAlgorithm = DIGEST_ALGORITHM_SHA256) const;
+
 private:
-  OID algorithm_; /**< Algorithm */
-  Blob keyDer_;   /**< PublicKeyInfo in DER */
+  Buffer key_;
 };
 
+std::ostream &
+operator <<(std::ostream &os, const PublicKey &key);
+
 }
 
 #endif
diff --git a/src/encoding/cryptopp/asn_ext.cpp b/src/encoding/cryptopp/asn_ext.cpp
new file mode 100644
index 0000000..6698426
--- /dev/null
+++ b/src/encoding/cryptopp/asn_ext.cpp
@@ -0,0 +1,107 @@
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * @author: Jeff Thompson <jefft0@remap.ucla.edu>
+ * @author: Yingdi Yu <yingdi@cs.ucla.edu>
+ * @author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * See COPYING for copyright and distribution information.
+ */
+
+#include <ndn-cpp/ndn-cpp-config.h>
+#include "asn_ext.hpp"
+
+#if NDN_CPP_HAVE_TIME_H
+#include <time.h>
+#endif
+#if NDN_CPP_HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#include <boost/format.hpp>
+#include <boost/lexical_cast.hpp>
+
+using namespace CryptoPP;
+
+namespace ndn {
+
+size_t
+DEREncodeGeneralTime(CryptoPP::BufferedTransformation &bt, MillisecondsSince1970 time)
+{
+#ifndef NDN_CPP_HAVE_GMTIME_SUPPORT
+  throw Asn::Error("Time functions are not supported by the standard library");
+#endif
+
+  if (time < 0)
+    throw Asn::Error("Calendar time value out of range");
+  else if (time > 2e14)
+    // 2e14 is about the year 8300.  We don't want to go over a 4-digit year.
+    throw Asn::Error("Calendar time value out of range");
+  
+  time_t secondsSince1970 = time / 1000;
+  struct tm* gmt = gmtime(&secondsSince1970);
+
+  std::string asn1time ((boost::format("%04d%02d%02d%02d%02d%02d%sZ")
+                         % (1900 + gmt->tm_year)
+                         % (gmt->tm_mon + 1)
+                         % gmt->tm_mday
+                         % gmt->tm_hour
+                         % gmt->tm_min
+                         % gmt->tm_sec).str());
+   // = os.str();
+  
+  bt.Put(GENERALIZED_TIME);
+  size_t lengthBytes = DERLengthEncode(bt, asn1time.size());
+  bt.Put(reinterpret_cast<const uint8_t*>(asn1time.c_str()), asn1time.size());
+  return 1+lengthBytes+asn1time.size();
+}
+
+void
+BERDecodeTime(CryptoPP::BufferedTransformation &bt, MillisecondsSince1970 &time)
+{
+  byte b;
+  if (!bt.Get(b) || (b != GENERALIZED_TIME && b != UTC_TIME))
+    BERDecodeError();
+
+  size_t bc;
+  if (!BERLengthDecode(bt, bc))
+    BERDecodeError();
+
+  SecByteBlock time_str(bc);
+  if (bc != bt.Get(time_str, bc))
+    BERDecodeError();
+
+  std::vector<std::string> params;
+  std::string current;
+  std::locale cLocale("C");
+  
+  for(uint32_t j = 0; j != time_str.size(); ++j)
+    {
+      if(std::isdigit(reinterpret_cast<char&>(time_str[j]), cLocale))
+        current += time_str[j];
+      else
+        {
+          if(current != "")
+            params.push_back(current);
+          current.clear();
+        }
+    }
+  if(current != "")
+    params.push_back(current);
+  
+  if(params.size() < 3 || params.size() > 6)
+    throw Asn::Error("Invalid time specification " + std::string(time_str.begin(), time_str.end()));
+
+  struct tm gmt;
+  gmt.tm_year = boost::lexical_cast<int>(params[0]);
+  gmt.tm_mon  = boost::lexical_cast<int>(params[1]) - 1;
+  gmt.tm_mday = boost::lexical_cast<int>(params[2]);
+  gmt.tm_hour = (params.size() >= 4) ? boost::lexical_cast<int>(params[3]) : 0;
+  gmt.tm_min  = (params.size() >= 5) ? boost::lexical_cast<int>(params[4]) : 0;
+  gmt.tm_sec  = (params.size() == 6) ? boost::lexical_cast<int>(params[5]) : 0;
+
+  if (b == GENERALIZED_TIME)
+    gmt.tm_year -= 1900;
+
+  time = timegm(&gmt) * 1000;
+}
+
+} // namespace ndn
diff --git a/src/encoding/cryptopp/asn_ext.hpp b/src/encoding/cryptopp/asn_ext.hpp
new file mode 100644
index 0000000..a7be874
--- /dev/null
+++ b/src/encoding/cryptopp/asn_ext.hpp
@@ -0,0 +1,30 @@
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * @author: Jeff Thompson <jefft0@remap.ucla.edu>
+ * @author: Yingdi Yu <yingdi@cs.ucla.edu>
+ * @author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NDN_ASN_EXT_HPP
+#define NDN_ASN_EXT_HPP
+
+#include <ndn-cpp/common.hpp>
+#include <cryptopp/asn.h>
+
+namespace ndn {
+
+namespace Asn {
+struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} };
+}
+
+size_t
+DEREncodeGeneralTime(CryptoPP::BufferedTransformation &bt, MillisecondsSince1970 time);
+
+void
+BERDecodeTime(CryptoPP::BufferedTransformation &bt, MillisecondsSince1970 &time);
+
+} // namespace ndn
+
+#endif // NDN_ASN_EXT_HPP
+
diff --git a/src/encoding/der/der-exception.cpp b/src/encoding/der/der-exception.cpp
deleted file mode 100644
index 84ab5c1..0000000
--- a/src/encoding/der/der-exception.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/* -*- 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 "der-exception.hpp"
-
-using namespace std;
-
-namespace ndn {
-
-namespace der
-{
-  
-DerException::DerException(const string& errorMessage) throw()
-  : errorMessage_(errorMessage)
-{
-}
-
-DerException::~DerException() throw()
-{
-}
-  
-} // der
-
-}
diff --git a/src/encoding/der/der-exception.hpp b/src/encoding/der/der-exception.hpp
deleted file mode 100644
index 5016697..0000000
--- a/src/encoding/der/der-exception.hpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- 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_DER_EXCEPTION_HPP
-#define NDN_DER_EXCEPTION_HPP
-
-#include <stdexcept>
-#include <string>
-
-namespace ndn {
-
-namespace der {
-
-struct DerException : public std::runtime_error { DerException(const std::string &msg) : std::runtime_error(msg) {} };
-
-class NegativeLengthException : public DerException { NegativeLengthException(const std::string &msg) : DerException(msg) {} };
-
-class DerEncodingException : public DerException { DerEncodingException(const std::string &msg) : DerException(msg) {} };
-
-class DerDecodingException : public DerException { DerDecodingException(const std::string &msg) : DerException(msg) {} };
-
-} // der
-
-}
-
-#endif
diff --git a/src/encoding/der/der.cpp b/src/encoding/der/der.cpp
deleted file mode 100644
index 94578b4..0000000
--- a/src/encoding/der/der.cpp
+++ /dev/null
@@ -1,617 +0,0 @@
-/* -*- 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 <stdexcept>
-#include "der-exception.hpp"
-#include "../../util/logging.hpp"
-#include "../../c/util/time.h"
-#include "der.hpp"
-
-INIT_LOGGER("ndn.der.DER");
-
-using namespace std;
-
-namespace ndn {
-
-namespace der {
-
-/*
- * DerNode
- */
-DerNode::DerNode()
-  :parent_(0)
-{}
-
-DerNode::DerNode(DerType type)
-  :type_(type),
-   parent_(0)
-{}
-
-DerNode::DerNode(InputIterator& start)
-  :parent_(0)
-{
-  decode(start);
-}
-
-DerNode::~DerNode()
-{}
-
-void
-DerNode::encodeHeader(int size)
-{
-  header_.push_back((char)type_);
-
-  if (size >= 127) {
-    int val = size;
-    char buf[sizeof(val) + 1];
-    char *p = &(buf[sizeof(buf)-1]);
-    int n = 0;
-    int mask = (1 << 8) - 1;
-
-    while (val != 0) {
-      p[0] = (char)(val & mask);
-      p--;
-      n++;
-      val >>= 8;
-    }
-
-    p[0] = (char)((1<<7) | n);
-    n++;
-
-    header_.insert(header_.end(), p, p+n);
-  }
-  else if (size >= 0)
-    header_.push_back((char)size);
-  else
-    throw NegativeLengthException("Negative length");
-}
-
-int
-DerNode::decodeHeader(InputIterator& start)
-{
-  uint8_t type = start.ReadU8();
-  // char type = start.get();
-  header_.push_back(type);
-  type_ = static_cast<DerType>((int)type);
-
-  uint8_t sizeLen = start.ReadU8(); 
-  // char sizeLen = start.get();
-  header_.push_back(sizeLen);
-
-  bool longFormat = sizeLen & (1 << 7);
-
-  if (!longFormat) {
-    // _LOG_DEBUG("Short Format");
-    // _LOG_DEBUG("sizeLen: " << (int)sizeLen);
-    return (int)sizeLen;
-  }
-  else {
-    // _LOG_DEBUG("Long Format");
-    uint8_t byte;
-    // char byte;
-    int lenCount = sizeLen & ((1<<7) - 1);
-    // _LOG_DEBUG("sizeLen: " << (int)sizeLen);
-    // _LOG_DEBUG("mask: " << (int)((1<<7) - 1));
-    // _LOG_DEBUG("lenCount: " << (int)lenCount);
-    int size = 0;
-    do {
-      byte = start.ReadU8();
-      header_.push_back(byte);
-      size = size * 256 + (int)byte;
-      // _LOG_DEBUG("byte: " << (int)byte);
-      // _LOG_DEBUG("size: " << size);
-      lenCount--;
-    } while (lenCount > 0);
-
-    return size;
-  }
-}
-
-void
-DerNode::encode(OutputIterator& start)
-{
-  start.write((const char*)&header_[0], header_.size());
-  start.write((const char*)&payload_[0], payload_.size());
-}
-
-void 
-DerNode::decode(InputIterator& start)
-{
-  int payloadSize = decodeHeader(start);
-  // _LOG_DEBUG("payloadSize: " << payloadSize);
-  if (payloadSize > 0 ) {
-    char buf[payloadSize];
-    start.read(buf, payloadSize);
-    payload_.insert(payload_.end(), buf, buf + payloadSize);
-  }
-}
-
-ptr_lib::shared_ptr<DerNode>
-DerNode::parse(InputIterator& start)
-{
-  int type = ((uint8_t)start.PeekU8());
-
-  // _LOG_DEBUG("Type: " << hex << setw(2) << setfill('0') << type);
-  switch(type) {
-    case DER_BOOLEAN:
-      return ptr_lib::shared_ptr<DerBool>(new DerBool(start));
-    case DER_INTEGER:
-      return ptr_lib::shared_ptr<DerInteger>(new DerInteger(start));
-    case DER_BIT_STRING:
-      return ptr_lib::shared_ptr<DerBitString>(new DerBitString(start));
-    case DER_OCTET_STRING:
-      return ptr_lib::shared_ptr<DerOctetString>(new DerOctetString(start));
-    case DER_NULL:
-      return ptr_lib::shared_ptr<DerNull>(new DerNull(start));
-    case DER_OBJECT_IDENTIFIER:
-      return ptr_lib::shared_ptr<DerOid>(new DerOid(start));
-    case DER_SEQUENCE:
-      return ptr_lib::shared_ptr<DerSequence>(new DerSequence(start));
-    case DER_PRINTABLE_STRING:
-      return ptr_lib::shared_ptr<DerPrintableString>(new DerPrintableString(start));
-    case DER_GENERALIZED_TIME:
-      return ptr_lib::shared_ptr<DerGtime>(new DerGtime(start));
-    default:
-      throw DerDecodingException("Unimplemented DER type");
-  }
-}
-
-
-/*
- * DerComplex
- */
-DerComplex::DerComplex()
-  :DerNode(),
-   childChanged_(false),
-   size_(0)
-{}
-
-DerComplex::DerComplex(DerType type)
-  :DerNode(type),
-   childChanged_(false),
-   size_(0)
-{}
-
-DerComplex::DerComplex(InputIterator& start)
-  :DerNode(),
-   childChanged_(false),
-   size_(0)
-{
-  size_ = DerNode::decodeHeader(start);
-  // _LOG_DEBUG("Size: " << size_);
-
-  int accSize = 0;
-  
-  while (accSize < size_) {
-    // _LOG_DEBUG("accSize: " << accSize);
-    ptr_lib::shared_ptr<DerNode> nodePtr = DerNode::parse(start);
-    accSize += nodePtr->getSize();
-    addChild(nodePtr, false);
-  }
-}
-
-DerComplex::~DerComplex()
-{}
-
-int
-DerComplex::getSize()
-{
-  if (childChanged_) {
-    updateSize();
-    childChanged_ = false;
-  }
-
-  header_.clear();
-  DerNode::encodeHeader(size_);
-  return size_ + header_.size();
-}
-
-Blob
-DerComplex::getRaw()
-{
-  ptr_lib::shared_ptr<vector<uint8_t> > blob(new vector<uint8_t>());
-  blob->insert(blob->end(), header_.begin(), header_.end());
-
-  DerNodePtrList::iterator it = nodeList_.begin();
-  for (; it != nodeList_.end(); it++) {
-    Blob childBlob = (*it)->getRaw();
-    blob->insert(blob->end(), childBlob->begin(), childBlob->end());
-  }
-  return blob;
-}
-
-void
-DerComplex::updateSize()
-{
-  int newSize = 0;
-
-  DerNodePtrList::iterator it = nodeList_.begin();
-  for (; it != nodeList_.end(); it++) {
-    newSize += (*it)->getSize();
-  }
-  
-  size_ = newSize;
-  childChanged_ = false;
-}
-
-void
-DerComplex::addChild(ptr_lib::shared_ptr<DerNode> nodePtr, bool notifyParent)
-{
-  nodePtr->setParent(this);
-
-  nodeList_.push_back(nodePtr);
-
-  if (!notifyParent)
-    return;
-
-  if (childChanged_)
-    return;
-  else
-    childChanged_ = true;
-
-  if (0 != parent_)
-    parent_->setChildChanged();
-}
-
-void
-DerComplex::setChildChanged()
-{
-  if (0 != parent_ && !childChanged_) {
-    parent_->setChildChanged();
-    childChanged_ = true;
-  }
-  else
-    childChanged_ = true;
-}
-
-void
-DerComplex::encode(OutputIterator& start)
-{
-  updateSize();
-  header_.clear();
-
-  DerNode::encodeHeader(size_);
-
-  start.write((const char*)&header_[0], header_.size());
-
-  DerNodePtrList::iterator it = nodeList_.begin();
-  for (; it != nodeList_.end(); it++)
-    (*it)->encode(start);
-}
-
-
-/*
- * DerByteString
- */
-DerByteString::DerByteString(const string& str, DerType type)
-  :DerNode(type)
-{
-  payload_.insert(payload_.end(), str.begin(), str.end());
-
-  DerNode::encodeHeader(payload_.size());
-}
-
-DerByteString::DerByteString(const vector<uint8_t>& blob, DerType type)
-  :DerNode(type)
-{
-  payload_.insert(payload_.end(), blob.begin(), blob.end());
-
-  DerNode::encodeHeader(payload_.size());
-}
-
-DerByteString::DerByteString(InputIterator& start)
-  :DerNode(start)
-{}
-
-DerByteString::~DerByteString()
-{}
-
-
-/*
- * DerBool
- */
-DerBool::DerBool(bool value)
-  :DerNode(DER_BOOLEAN)
-
-{ 
-  char payload = (value ? 0xFF : 0x00);
-  payload_.push_back(payload);
-
-  DerNode::encodeHeader(payload_.size());
-}
-
-DerBool::DerBool(InputIterator& start)
-  :DerNode(start)
-{}
-
-DerBool::~DerBool()
-{}
-
-
-/*
- * DerInteger
- */
-DerInteger::DerInteger(const vector<uint8_t>& blob)
-  :DerNode(DER_INTEGER)
-{
-  payload_.insert(payload_.end(), blob.begin(), blob.end());
-
-  DerNode::encodeHeader(payload_.size());
-}
-
-DerInteger::DerInteger(InputIterator& start)
-  :DerNode(start)
-{}
-
-DerInteger::~DerInteger()
-{}
-
-
-/*
- * DerBitString
- */
-DerBitString::DerBitString(const vector<uint8_t>& blob, uint8_t paddingLen)
-  :DerNode(DER_BIT_STRING)
-{     
-  payload_.push_back((char)paddingLen);
-  payload_.insert(payload_.end(), blob.begin(), blob.end());
-
-  DerNode::encodeHeader(payload_.size());
-}
-
-DerBitString::DerBitString(InputIterator& start)
-  :DerNode(start)
-{}
-
-DerBitString::~DerBitString()
-{}
-
-
-/*
- * DerOctetString
- */
-DerOctetString::DerOctetString(const string& str)
-  :DerByteString(str, DER_OCTET_STRING)
-{}
-
-DerOctetString::DerOctetString(const vector<uint8_t>& blob)
-  :DerByteString(blob, DER_OCTET_STRING)
-{}
-
-DerOctetString::DerOctetString(InputIterator& start)
-  :DerByteString(start)
-{}
-
-DerOctetString::~DerOctetString()
-{}
-
-
-/*
- * DerNull
- */
-DerNull::DerNull()
-  :DerNode(DER_NULL)
-{
-  DerNode::encodeHeader(0);
-}
-
-DerNull::DerNull(InputIterator& start)
-  :DerNode(start)
-{}
-  
-DerNull::~DerNull()
-{}
-
-
-/*
- * DerOid
- */
-DerOid::DerOid(const OID& oid)
-  :DerNode(DER_OBJECT_IDENTIFIER)
-{
-  prepareEncoding(oid.getIntegerList());
-}
-
-
-DerOid::DerOid(const string& oidStr)
-  :DerNode(DER_OBJECT_IDENTIFIER)
-{
-  vector<int> value;
-
-  string str = oidStr + ".";
-
-  size_t pos = 0;
-  size_t ppos = 0;
-
-  while (string::npos != pos) {
-    ppos = pos;
-
-    pos = str.find_first_of('.', pos);
-    if (string::npos == pos)
-      break;
-
-    value.push_back(atoi(str.substr(ppos, pos - ppos).c_str()));
-
-    pos++;
-  }
-
-  prepareEncoding(value);
-}
-
-DerOid::DerOid(const vector<int>& value)
-  :DerNode(DER_OBJECT_IDENTIFIER)
-{
-  prepareEncoding(value);
-}
-
-DerOid::DerOid(InputIterator& start)
-  :DerNode(start)
-{}
-  
-DerOid::~DerOid()
-{}
-
-void
-DerOid::prepareEncoding(const vector<int>& value)
-{
-  ostringstream os;
-
-  int firstNumber = 0;
-  
-  if (value.size() >= 1) {
-    if (0 <= value[0] && 2 >= value[0])
-      firstNumber = value[0] * 40;
-    else
-      throw DerEncodingException("first integer of oid is out of range");
-  }
-  else
-    throw DerEncodingException("no integer in oid");
-
-  if (value.size() >= 2) {
-    if (0 <= value[1] && 39 >= value[1])
-      firstNumber += value[1];
-    else
-      throw DerEncodingException("second integer of oid is out of range");
-  }
-  
-  encode128(firstNumber, os);
-
-  if (value.size() > 2) {
-    int i = 2;
-    for (; i < value.size(); i++)
-      encode128(value[i], os);
-  }
-
-  string output = os.str();
-  DerNode::encodeHeader(output.size());
-
-  payload_.insert(payload_.end(), output.begin(), output.end());
-}
-  
-void
-DerOid::encode128(int value, ostringstream& os)
-{
-  int mask = (1 << 7) - 1;
-
-  if (128 > value) {
-    uint8_t singleByte = (uint8_t) mask & value;
-    os.write((char *)&singleByte, 1);
-  }
-  else {
-    uint8_t buf[(sizeof(value)*8 + 6)/7 + 1];
-    uint8_t *p = &(buf[sizeof(buf)-1]);
-    int n = 1;
-
-    p[0] = (uint8_t)(value & mask);
-    value >>= 7;
-
-    while (value != 0) {
-      (--p)[0] = (uint8_t)((value & mask) | (1 << 7));
-      n++;
-      value >>= 7;
-    }
-    
-    os.write((char *)p, n);
-  }
-}
-
-int
-DerOid::decode128(int & offset)
-{
-  uint8_t flagMask = 0x80;
-  int result = 0;
-  while (payload_[offset] & flagMask) {
-    result = 128 * result + (uint8_t) payload_[offset] - 128;
-    offset++;
-  }
-
-  result = result * 128 + payload_[offset];
-  offset++;
-
-  return result;
-}
-
-
-/*
- * DerSequence
- */
-DerSequence::DerSequence()
-  :DerComplex(DER_SEQUENCE)
-{}
-
-DerSequence::DerSequence(InputIterator& start)
-  :DerComplex(start)
-{}
-
-DerSequence::~DerSequence() 
-{}
-
-
-/*
- * DerPrintableString
- */
-DerPrintableString::DerPrintableString(const string& str)
-  :DerByteString(str, DER_PRINTABLE_STRING)
-{}
-
-DerPrintableString::DerPrintableString(const vector<uint8_t>& blob)
-  :DerByteString(blob, DER_PRINTABLE_STRING)
-{}
-
-DerPrintableString::DerPrintableString(InputIterator& start)
-  :DerByteString(start)
-{}
-
-DerPrintableString::~DerPrintableString()
-{}
-
-
-/*
- * DerGtime
- */
-DerGtime::DerGtime(const MillisecondsSince1970& time)
-  :DerNode(DER_GENERALIZED_TIME)
-{
-  string pTimeStr = toIsoString(time);
-  int index = pTimeStr.find_first_of('T');
-  string derTime = pTimeStr.substr(0, index) + pTimeStr.substr(index+1, pTimeStr.size() - index -1) + "Z";
-  payload_.insert(payload_.end(), derTime.begin(), derTime.end());
-
-  DerNode::encodeHeader(payload_.size());
-}
-
-DerGtime::DerGtime(InputIterator& start)
-  :DerNode(start)
-{}
-  
-DerGtime::~DerGtime()
-{}
-
-string DerGtime::toIsoString(const MillisecondsSince1970& time)
-{
-  char isoString[25];
-  ndn_Error error;
-  if ((error = ndn_toIsoString(time, isoString)))
-    throw runtime_error(ndn_getErrorString(error));
-  
-  return isoString;
-}
-
-MillisecondsSince1970 DerGtime::fromIsoString(const string& isoString)
-{
-  MillisecondsSince1970 milliseconds;
-  ndn_Error error;
-  if ((error = ndn_fromIsoString(isoString.c_str(), &milliseconds)))
-    throw runtime_error(ndn_getErrorString(error));
-  
-  return milliseconds;
-}
-
-} // der
-
-}
diff --git a/src/encoding/der/der.hpp b/src/encoding/der/der.hpp
deleted file mode 100644
index d8753be..0000000
--- a/src/encoding/der/der.hpp
+++ /dev/null
@@ -1,407 +0,0 @@
-/* -*- 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_DER_HPP
-#define NDN_DER_HPP
-
-#include <vector>
-#include <string>
-#include <istream>
-#include <ostream>
-#include <sstream>
-
-#include <ndn-cpp/common.hpp>
-#include <ndn-cpp/encoding/oid.hpp>
-#include <ndn-cpp/util/blob.hpp>
-
-#include "visitor/visitor.hpp"
-#include "visitor/void-visitor.hpp"
-#include "visitor/no-arguments-visitor.hpp"
-#include "visitor/void-no-arguments-visitor.hpp"
-
-namespace ndn {
-
-namespace der {
-
-enum DerType {
-  DER_EOC = 0,
-  DER_BOOLEAN = 1,
-  DER_INTEGER = 2,
-  DER_BIT_STRING = 3,
-  DER_OCTET_STRING = 4,
-  DER_NULL = 5,
-  DER_OBJECT_IDENTIFIER = 6,
-  DER_OBJECT_DESCRIPTOR = 7,
-  DER_EXTERNAL = 40,
-  DER_REAL = 9,
-  DER_ENUMERATED = 10,
-  DER_EMBEDDED_PDV = 43,
-  DER_UTF8_STRING = 12,
-  DER_RELATIVE_OID = 13,
-  DER_SEQUENCE = 48,
-  DER_SET = 49,
-  DER_NUMERIC_STRING = 18,
-  DER_PRINTABLE_STRING = 19,
-  DER_T61_STRING = 20,
-  DER_VIDEOTEX_STRING = 21,
-  DER_IA5_STRING = 22,
-  DER_UTC_TIME = 23,
-  DER_GENERALIZED_TIME = 24,
-  DER_GRAPHIC_STRING = 25,
-  DER_VISIBLE_STRING = 26,
-  DER_GENERAL_STRING = 27,
-  DER_UNIVERSAL_STRING = 28,
-  DER_CHARACTER_STRING = 29,
-  DER_BMP_STRING = 30,
-};
-
-class InputIterator : public std::istream
-{
-public:
-  uint8_t ReadU8() { return static_cast<uint8_t> (get()); }
-  uint8_t PeekU8() { return static_cast<uint8_t> (peek()); }
-  bool IsEnd() const { return eof(); }
-  void Prev() { seekg(-1, std::ios_base::cur); }
-};
-
-class OutputIterator : public std::ostream
-{
-public:
-  void Write(const uint8_t * s, uint32_t n) { write (reinterpret_cast<const char*>(s),n); }
-  void WriteU8(const uint8_t s) { put (s); }
-  void WriteU8(const uint8_t s, uint32_t n) { for (uint32_t i = 0; i < n; i++) { put(s); } }
-};
-
-class DerComplex;
-
-class DerNode
-{
-public:
-  DerNode();
-
-  DerNode(DerType type);
-
-  DerNode(InputIterator& start);
-
-  virtual
-  ~DerNode();
-
-  virtual int
-  getSize() { return header_.size() + payload_.size(); }
-
-  virtual void 
-  encode(OutputIterator& start);
-  
-  void
-  setParent(DerComplex * parent) { parent_ = parent; }
-
-  static ptr_lib::shared_ptr<DerNode>
-  parse(InputIterator& start);
-
-  const std::vector<uint8_t>& 
-  getHeader() const { return header_; }
-
-  std::vector<uint8_t>& 
-  getHeader() { return header_; }
-
-  const std::vector<uint8_t>& 
-  getPayload() const { return payload_; }
-  
-  std::vector<uint8_t>& 
-  getPayload() { return payload_; }
-
-  const DerType& 
-  getType() { return type_; }
-
-  virtual Blob
-  getRaw()
-  { 
-    ptr_lib::shared_ptr<std::vector<uint8_t> > blob(new std::vector<uint8_t>());
-    blob->insert(blob->end(), header_.begin(), header_.end());
-    blob->insert(blob->end(), payload_.begin(), payload_.end());
-
-    return blob;
-  }
-
-  virtual void accept(VoidNoArgumentsVisitor& visitor) = 0;
-  virtual void accept(VoidVisitor& visitor, ndnboost::any param) = 0;
-  virtual ndnboost::any accept(NoArgumentsVisitor& visitor) = 0;
-  virtual ndnboost::any accept(Visitor& visitor, ndnboost::any param) = 0;
-  
-protected:
-  void
-  decode(InputIterator& start);
-
-  void
-  encodeHeader(int size);
-
-  int 
-  decodeHeader(InputIterator& start);
-
-protected:
-  DerType type_;
-  std::vector<uint8_t> header_;
-  std::vector<uint8_t> payload_;
-  DerComplex * parent_;
-};
-
-
-typedef std::vector<ptr_lib::shared_ptr<DerNode> > DerNodePtrList;
-
-class DerComplex : public DerNode
-{
-public:
-  DerComplex();
-  
-  DerComplex(DerType type);
-
-  DerComplex(InputIterator& start);
-
-  virtual 
-  ~DerComplex();
-
-  virtual int
-  getSize();
-
-  void 
-  addChild(ptr_lib::shared_ptr<DerNode> nodePtr, bool notifyParent = true);
-
-  virtual void
-  encode(OutputIterator& start);
-
-  const DerNodePtrList& 
-  getChildren() const { return nodeList_; }
-
-  DerNodePtrList& 
-  getChildren() { return nodeList_; }
-
-  virtual Blob
-  getRaw();
-
-private:
-  void
-  updateSize();
-
-  void
-  setChildChanged();
-
-private:
-  bool childChanged_;
-  int size_;
-  DerNodePtrList nodeList_;
-};
-
-
-
-class DerByteString : public DerNode
-{
-public:
-  DerByteString(const std::string& str, DerType type);
-
-  DerByteString(const std::vector<uint8_t>& blob, DerType type);
-
-  DerByteString(InputIterator& start);
-
-  virtual
-  ~DerByteString();
-};
-
-
-//0x01  
-class DerBool : public DerNode
-{
-public:
-  DerBool(bool value);
-
-  DerBool(InputIterator& start);
-
-  virtual
-  ~DerBool();
-
-  virtual void accept(VoidNoArgumentsVisitor& visitor)                {        visitor.visit(*this);        }
-  virtual void accept(VoidVisitor& visitor, ndnboost::any param)      {        visitor.visit(*this, param); }
-  virtual ndnboost::any accept(NoArgumentsVisitor& visitor)           { return visitor.visit(*this);        }
-  virtual ndnboost::any accept(Visitor& visitor, ndnboost::any param) { return visitor.visit(*this, param); }
-};
-
-//0x02  
-class DerInteger : public DerNode
-{
-public:
-  DerInteger(const std::vector<uint8_t>& blob);
-
-  DerInteger(InputIterator& start);
-
-  virtual 
-  ~DerInteger();
-
-  virtual void accept(VoidNoArgumentsVisitor& visitor)                {        visitor.visit(*this);        }
-  virtual void accept(VoidVisitor& visitor, ndnboost::any param)      {        visitor.visit(*this, param); }
-  virtual ndnboost::any accept(NoArgumentsVisitor& visitor)           { return visitor.visit(*this);        }
-  virtual ndnboost::any accept(Visitor& visitor, ndnboost::any param) { return visitor.visit(*this, param); }
-};
-
-//0x03
-class DerBitString : public DerNode
-{
-public:
-  DerBitString(const std::vector<uint8_t>& blob, uint8_t paddingLen);
-
-  DerBitString(InputIterator& start);
-  
-  virtual
-  ~DerBitString();
-
-  virtual void accept(VoidNoArgumentsVisitor& visitor)                {        visitor.visit(*this);        }
-  virtual void accept(VoidVisitor& visitor, ndnboost::any param)      {        visitor.visit(*this, param); }
-  virtual ndnboost::any accept(NoArgumentsVisitor& visitor)           { return visitor.visit(*this);        }
-  virtual ndnboost::any accept(Visitor& visitor, ndnboost::any param) { return visitor.visit(*this, param); }
-};
-
-//0x04
-class DerOctetString : public DerByteString
-{
-public:
-  DerOctetString(const std::string& str);
-  
-  DerOctetString(const std::vector<uint8_t>& blob);
-
-  DerOctetString(InputIterator& start);
-
-  virtual
-  ~DerOctetString();
-
-  virtual void accept(VoidNoArgumentsVisitor& visitor)                {        visitor.visit(*this);        }
-  virtual void accept(VoidVisitor& visitor, ndnboost::any param)      {        visitor.visit(*this, param); }
-  virtual ndnboost::any accept(NoArgumentsVisitor& visitor)           { return visitor.visit(*this);        }
-  virtual ndnboost::any accept(Visitor& visitor, ndnboost::any param) { return visitor.visit(*this, param); }
-};
-
-
-//0x05
-class DerNull : public DerNode
-{
-public:
-  DerNull();
-
-  DerNull(InputIterator& start);
-  
-  virtual
-  ~DerNull();
-
-  virtual void accept(VoidNoArgumentsVisitor& visitor)                {        visitor.visit(*this);        }
-  virtual void accept(VoidVisitor& visitor, ndnboost::any param)      {        visitor.visit(*this, param); }
-  virtual ndnboost::any accept(NoArgumentsVisitor& visitor)           { return visitor.visit(*this);        }
-  virtual ndnboost::any accept(Visitor& visitor, ndnboost::any param) { return visitor.visit(*this, param); }
-};
-
-
-//0x06
-class DerOid : public DerNode
-{
-public:
-  DerOid(const OID& oid);
-  
-  DerOid(const std::string& oidStr);
-
-  DerOid(const std::vector<int>& value);
-
-  DerOid(InputIterator& start);
-  
-  virtual
-  ~DerOid();
-  
-  virtual void accept(VoidNoArgumentsVisitor& visitor)                {        visitor.visit(*this);        }
-  virtual void accept(VoidVisitor& visitor, ndnboost::any param)      {        visitor.visit(*this, param); }
-  virtual ndnboost::any accept(NoArgumentsVisitor& visitor)           { return visitor.visit(*this);        }
-  virtual ndnboost::any accept(Visitor& visitor, ndnboost::any param) { return visitor.visit(*this, param); }
-
-  int 
-  decode128(int& offset);
-
-private:
-  void 
-  prepareEncoding(const std::vector<int>& value);
-
-  void 
-  encode128(int value, std::ostringstream& os);    
-};
-
-
-//0x10
-class DerSequence : public DerComplex
-{
-public:
-  DerSequence();
-
-  DerSequence(InputIterator& start);
-  
-  virtual
-  ~DerSequence();
-
-  virtual void accept(VoidNoArgumentsVisitor& visitor)                {        visitor.visit(*this);        }
-  virtual void accept(VoidVisitor& visitor, ndnboost::any param)      {        visitor.visit(*this, param); }
-  virtual ndnboost::any accept(NoArgumentsVisitor& visitor)           { return visitor.visit(*this);        }
-  virtual ndnboost::any accept(Visitor& visitor, ndnboost::any param) { return visitor.visit(*this, param); }
-};
-
-//0x13
-class DerPrintableString : public DerByteString
-{
-public:
-  DerPrintableString(const std::string& str);
-
-  DerPrintableString(const std::vector<uint8_t>& blob);
-
-  DerPrintableString(InputIterator& start);
-
-  virtual 
-  ~DerPrintableString();
-
-  virtual void accept(VoidNoArgumentsVisitor& visitor)                {        visitor.visit(*this);        }
-  virtual void accept(VoidVisitor& visitor, ndnboost::any param)      {        visitor.visit(*this, param); }
-  virtual ndnboost::any accept(NoArgumentsVisitor& visitor)           { return visitor.visit(*this);        }
-  virtual ndnboost::any accept(Visitor& visitor, ndnboost::any param) { return visitor.visit(*this, param); }
-};
-
-//0x1b
-class DerGtime : public DerNode
-{
-public:
-  DerGtime(const MillisecondsSince1970& time);
-
-  DerGtime(InputIterator& start);
-  
-  virtual 
-  ~DerGtime();
-
-  virtual void accept(VoidNoArgumentsVisitor& visitor)                {        visitor.visit(*this);        }
-  virtual void accept(VoidVisitor& visitor, ndnboost::any param)      {        visitor.visit(*this, param); }
-  virtual ndnboost::any accept(NoArgumentsVisitor& visitor)           { return visitor.visit(*this);        }
-  virtual ndnboost::any accept(Visitor& visitor, ndnboost::any param) { return visitor.visit(*this, param); }
-
-  /**
-   * Convert to the ISO string representation of the time.
-   * @param time Milliseconds since 1/1/1970.
-   * @return The ISO string.
-   */
-  static std::string toIsoString(const MillisecondsSince1970& time);
-  
-  /**
-   * Convert from the ISO string representation to the internal time format.
-   * @param isoString The ISO time formatted string. 
-   * @return The time in milliseconds since 1/1/1970.
-   */
-  static MillisecondsSince1970 fromIsoString(const std::string& isoString);
-};
- 
-} // der
-
-}
-
-#endif
diff --git a/src/encoding/der/visitor/certificate-data-visitor.cpp b/src/encoding/der/visitor/certificate-data-visitor.cpp
deleted file mode 100644
index 7edf794..0000000
--- a/src/encoding/der/visitor/certificate-data-visitor.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/* -*- 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 "simple-visitor.hpp"
-#include "public-key-visitor.hpp"
-#include "../der.hpp"
-
-#include <ndn-cpp/security/certificate/certificate.hpp>
-#include <ndn-cpp/security/certificate/certificate-subject-description.hpp>
-#include <ndn-cpp/security/certificate/certificate-extension.hpp>
-
-#include "../../../util/logging.hpp"
-#include "certificate-data-visitor.hpp"
-
-using namespace std;
-
-INIT_LOGGER("ndn.der.CertificateDataVisitor");
-
-namespace ndn {
-
-namespace der {
-  
-/*
- * CertificateDataVisitor
- */
-void 
-CertificateDataVisitor::visit(DerSequence& derSeq, ndnboost::any param)
-{
-  // _LOG_DEBUG("CertificateDataVisitor::visit");
-
-  DerNodePtrList& children = derSeq.getChildren();
-  CertificateValidityVisitor validityVisitor;
-  children[0]->accept(validityVisitor, param);
-  CertificateSubjectVisitor subjectVisitor;
-  children[1]->accept(subjectVisitor, param);
-  PublicKeyVisitor pubkeyVisitor;
-  Certificate* certData = ndnboost::any_cast<Certificate*>(param);
-  certData->setPublicKeyInfo(*ndnboost::any_cast<ptr_lib::shared_ptr<PublicKey> >(children[2]->accept(pubkeyVisitor)));
-      
-  if(children.size() > 3)
-    {
-      CertificateExtensionVisitor extnVisitor;
-      children[3]->accept(extnVisitor, param);
-    }
-}
-
-/*
- * CertValidityVisitor
- */
-void 
-CertificateValidityVisitor::visit(DerSequence& derSeq, ndnboost::any param)
-{
-  // _LOG_DEBUG("CertValidityVisitor::visit");
-  
-  Certificate* certData = ndnboost::any_cast<Certificate*>(param); 
-
-  DerNodePtrList& children = derSeq.getChildren();
-  
-  SimpleVisitor simpleVisitor;
-
-  MillisecondsSince1970 notBefore = ndnboost::any_cast<MillisecondsSince1970>(children[0]->accept(simpleVisitor));
-  MillisecondsSince1970 notAfter = ndnboost::any_cast<MillisecondsSince1970>(children[1]->accept(simpleVisitor));
-
-  // _LOG_DEBUG("parsed notBefore: " << notBefore);
-  // _LOG_DEBUG("parsed notAfter: " << notAfter);
-
-  certData->setNotBefore(notBefore);
-  certData->setNotAfter(notAfter);
-}
-
-/*
- * CertSubDescryptVisitor
- */
-void
-CertificateSubjectDescriptionVisitor::visit(DerSequence& derSeq, ndnboost::any param)
-{
-  Certificate* certData = ndnboost::any_cast<Certificate*>(param); 
-  
-  DerNodePtrList& children = derSeq.getChildren();
-  
-  SimpleVisitor simpleVisitor;
-
-  OID oid = ndnboost::any_cast<OID>(children[0]->accept(simpleVisitor));
-  string value = ndnboost::any_cast<string>(children[1]->accept(simpleVisitor));
-
-  CertificateSubjectDescription subDescrypt(oid, value);
-
-  certData->addSubjectDescription(subDescrypt);
-}
-
-/*
- * CertSubjectVisitor
- */
-void 
-CertificateSubjectVisitor::visit(DerSequence& derSeq, ndnboost::any param)
-{
-  // _LOG_DEBUG("CertSubjectVisitor::visit");
-
-  DerNodePtrList& children = derSeq.getChildren();
-  
-  CertificateSubjectDescriptionVisitor descryptVisitor;
-
-  DerNodePtrList::iterator it = children.begin();
-
-  while(it != children.end()) {
-    (*it)->accept(descryptVisitor, param);
-    it++;
-  }
-}
-
-/*
- * CertExtnEntryVisitor
- */
-void 
-CertificateExtensionEntryVisitor::visit(DerSequence& derSeq, ndnboost::any param)
-{
-  Certificate* certData = ndnboost::any_cast<Certificate*>(param); 
-  
-  DerNodePtrList& children = derSeq.getChildren();
-  
-  SimpleVisitor simpleVisitor;
-
-  OID oid = ndnboost::any_cast<OID>(children[0]->accept(simpleVisitor));
-  bool critical = ndnboost::any_cast<bool>(children[1]->accept(simpleVisitor));
-  const vector<uint8_t>& value = ndnboost::any_cast<const vector<uint8_t>&>(children[2]->accept(simpleVisitor));
-
-  CertificateExtension extension(oid, critical, value);
-
-  certData->addExtension(extension);
-}
-
-/*
- * CertExtensionVisitor
- */
-void 
-CertificateExtensionVisitor::visit(DerSequence& derSeq, ndnboost::any param)
-{
-  DerNodePtrList& children = derSeq.getChildren();
-  
-  CertificateExtensionEntryVisitor extnEntryVisitor;
-
-  DerNodePtrList::iterator it = children.begin();
-
-  while(it != children.end()) {
-    (*it)->accept(extnEntryVisitor, param);
-    it++;
-  }
-}
-
-} // der
-
-}
diff --git a/src/encoding/der/visitor/certificate-data-visitor.hpp b/src/encoding/der/visitor/certificate-data-visitor.hpp
deleted file mode 100644
index ec73bd7..0000000
--- a/src/encoding/der/visitor/certificate-data-visitor.hpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- 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_DATA_VISITOR_HPP
-#define NDN_CERTIFICATE_DATA_VISITOR_HPP
-
-#include "void-visitor.hpp"
-
-namespace ndn {
-
-namespace der {
-  
-class CertificateDataVisitor : public VoidVisitor {
-  virtual void visit(DerSequence&,         ndnboost::any);
-};
-
-class CertificateValidityVisitor : public VoidVisitor {
-public:
-  virtual void visit(DerSequence&,         ndnboost::any);
-};
-
-class CertificateSubjectDescriptionVisitor : public VoidVisitor {
-public:
-  virtual void visit(DerSequence&,         ndnboost::any);
-};
-
-class CertificateSubjectVisitor : public VoidVisitor {
-public:
-  virtual void visit(DerSequence&,         ndnboost::any);
-};
-
-class CertificateExtensionEntryVisitor : public VoidVisitor {
-public:
-  virtual void visit(DerSequence&,         ndnboost::any);
-};
-
-class CertificateExtensionVisitor : public VoidVisitor {
-public:
-  virtual void visit(DerSequence&,         ndnboost::any);
-};
-
-} // der
-
-}
-
-#endif
diff --git a/src/encoding/der/visitor/no-arguments-visitor.cpp b/src/encoding/der/visitor/no-arguments-visitor.cpp
deleted file mode 100644
index 06f2157..0000000
--- a/src/encoding/der/visitor/no-arguments-visitor.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- 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 "no-arguments-visitor.hpp"
-
-namespace ndn {
-
-namespace der
-{
-ndnboost::any
-NoArgumentsVisitor::visit(DerBool& derBool)
-{ return  ndnboost::any(0); }
-
-ndnboost::any 
-NoArgumentsVisitor::visit(DerInteger& derInteger)
-{ return  ndnboost::any(0); }
-
-ndnboost::any 
-NoArgumentsVisitor::visit(DerPrintableString& derPStr)
-{ return  ndnboost::any(0); }
-
-ndnboost::any 
-NoArgumentsVisitor::visit(DerBitString& derBStr)
-{ return  ndnboost::any(0); }
-
-ndnboost::any 
-NoArgumentsVisitor::visit(DerNull& derNull)
-{ return  ndnboost::any(0); }
-
-ndnboost::any 
-NoArgumentsVisitor::visit(DerOctetString& derOStr)
-{ return  ndnboost::any(0); }
-
-ndnboost::any 
-NoArgumentsVisitor::visit(DerOid& derOid)
-{ return  ndnboost::any(0); }
-
-ndnboost::any 
-NoArgumentsVisitor::visit(DerSequence& derSeq)
-{ return  ndnboost::any(0); }
-
-ndnboost::any 
-NoArgumentsVisitor::visit(DerGtime& derGtime)
-{ return  ndnboost::any(0); }
-
-} // der
-
-}
diff --git a/src/encoding/der/visitor/no-arguments-visitor.hpp b/src/encoding/der/visitor/no-arguments-visitor.hpp
deleted file mode 100644
index 09c24c1..0000000
--- a/src/encoding/der/visitor/no-arguments-visitor.hpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- 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_DER_NO_ARGUMENTS_VISITOR_HPP
-#define NDN_DER_NO_ARGUMENTS_VISITOR_HPP
-
-#include "visitor.hpp"
-
-namespace ndn {
-
-namespace der {
-
-class NoArgumentsVisitor
-{
-public:
-  virtual ndnboost::any visit(DerBool&           );
-  virtual ndnboost::any visit(DerInteger&        );
-  virtual ndnboost::any visit(DerPrintableString&);
-  virtual ndnboost::any visit(DerBitString&      );
-  virtual ndnboost::any visit(DerNull&           );
-  virtual ndnboost::any visit(DerOctetString&    );
-  virtual ndnboost::any visit(DerOid&            );
-  virtual ndnboost::any visit(DerSequence&       );
-  virtual ndnboost::any visit(DerGtime&          );
-};
-
-} // der
-
-}
-
-#endif
diff --git a/src/encoding/der/visitor/print-visitor.cpp b/src/encoding/der/visitor/print-visitor.cpp
deleted file mode 100644
index 80a4f5d..0000000
--- a/src/encoding/der/visitor/print-visitor.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/* -*- 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 "print-visitor.hpp"
-#include "../der.hpp"
-#include <iostream>
-#include <iomanip>
-
-using namespace std;
-
-namespace ndn {
-
-namespace der {
-
-void 
-PrintVisitor::visit(DerBool& derBool, ndnboost::any param)
-{
-  const string& indent = ndnboost::any_cast<const string&>(param);
-      
-  printData(derBool.getHeader(), indent);
-  printData(derBool.getPayload(), indent + "   ");
-}
-
-void
-PrintVisitor::visit(DerInteger& derInteger, ndnboost::any param)
-{
-  const string& indent = ndnboost::any_cast<const string&>(param);
-      
-  printData(derInteger.getHeader(), indent);
-  printData(derInteger.getPayload(), indent + "   ");
-}
-  
-void
-PrintVisitor::visit(DerPrintableString& derPStr, ndnboost::any param)
-{
-  const string& indent = ndnboost::any_cast<const string&>(param);
-      
-  printData(derPStr.getHeader(), indent);
-  printData(derPStr.getPayload(), indent + "   ");
-}
-
-void 
-PrintVisitor::visit(DerBitString& derBStr, ndnboost::any param)
-{
-  const string& indent = ndnboost::any_cast<const string&>(param);
-      
-  printData(derBStr.getHeader(), indent);
-  const vector<uint8_t>& payload = derBStr.getPayload();
-  cout << indent << "   " << " " << hex << setw(2) << setfill('0') << (int)(uint8_t)payload[0] << endl;
-  printData(payload, indent + "   ", 1);
-}
-
-void 
-PrintVisitor::visit(DerNull& derNull, ndnboost::any param)
-{
-  const string& indent = ndnboost::any_cast<const string&>(param);
-      
-  printData(derNull.getHeader(), indent);
-  printData(derNull.getPayload(), indent + "   ");
-
-}
-
-void 
-PrintVisitor::visit(DerOctetString& derOStr, ndnboost::any param)
-{
-  const string& indent = ndnboost::any_cast<const string&>(param);
-      
-  printData(derOStr.getHeader(), indent);
-  printData(derOStr.getPayload(), indent + "   ");
-}
-
-void 
-PrintVisitor::visit(DerOid& derOid, ndnboost::any param)
-{
-  const string& indent = ndnboost::any_cast<const string&>(param);
-  
-  printData(derOid.getHeader(), indent);
-  printData(derOid.getPayload(), indent + "   ");
-
-}
-
-void 
-PrintVisitor::visit(DerGtime& derGtime, ndnboost::any param)
-{
-  const string& indent = ndnboost::any_cast<const string&>(param);
-  
-  printData(derGtime.getHeader(), indent);
-  printData(derGtime.getPayload(), indent + "   ");
-}
-
-void 
-PrintVisitor::visit(DerSequence& derSequence, ndnboost::any param)
-{
-  const string& indent = ndnboost::any_cast<const string&>(param);
-  
-  printData(derSequence.getHeader(), indent);
-
-  DerNodePtrList& children = derSequence.getChildren();
-  DerNodePtrList::iterator it = children.begin();
-  for(; it != children.end(); it++)
-  (*it)->accept(*this, indent + " | ");
-}
-
-
-void 
-PrintVisitor::printData(const vector<uint8_t>& blob, const string& indent, int offset)
-{
-  cout << indent;
-
-  int count = 0;
-  for(int i = offset; i < blob.size(); i++)
-    {
-      cout << " " << hex << setw(2) << setfill('0') << (int)blob[i];
-      count++;
-      if(8 == count)
-        {
-          count = 0;
-          cout << "\n" << indent;
-        }
-    }
-  cout << endl;
-}
-
-} // der
-
-}
diff --git a/src/encoding/der/visitor/print-visitor.hpp b/src/encoding/der/visitor/print-visitor.hpp
deleted file mode 100644
index 45d0bfd..0000000
--- a/src/encoding/der/visitor/print-visitor.hpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- 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_PRINT_VISITOR_HPP
-#define NDN_PRINT_VISITOR_HPP
-
-#include <vector>
-#include <string>
-#include "void-visitor.hpp"
-
-namespace ndn {
-
-namespace der {
-
-class PrintVisitor : public VoidVisitor {
-public:
-  virtual void visit(DerBool&,             ndnboost::any);
-  virtual void visit(DerInteger&,          ndnboost::any);
-  virtual void visit(DerPrintableString&,  ndnboost::any);
-  virtual void visit(DerBitString&,        ndnboost::any);
-  virtual void visit(DerNull&,             ndnboost::any);
-  virtual void visit(DerOctetString&,      ndnboost::any);
-  virtual void visit(DerOid&,              ndnboost::any);
-  virtual void visit(DerSequence&,         ndnboost::any);
-  virtual void visit(DerGtime&,            ndnboost::any);
-
-private:
-  static void printData(const std::vector<uint8_t>& blob, const std::string& indent, int offset = 0);
-};
-
-} // der
-
-}
-
-#endif
diff --git a/src/encoding/der/visitor/public-key-visitor.cpp b/src/encoding/der/visitor/public-key-visitor.cpp
deleted file mode 100644
index a5f5542..0000000
--- a/src/encoding/der/visitor/public-key-visitor.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- 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 "simple-visitor.hpp"
-#include <ndn-cpp/security/certificate/public-key.hpp>
-#include "../der.hpp"
-#include "public-key-visitor.hpp"
-
-using namespace std;
-
-namespace ndn {
-
-namespace der {
-  
-ndnboost::any 
-PublicKeyVisitor::visit(DerSequence& derSeq)
-{
-  DerNodePtrList& children = derSeq.getChildren();
-
-  SimpleVisitor simpleVisitor;
-  ptr_lib::shared_ptr<DerSequence> algoSeq = ptr_lib::dynamic_pointer_cast<DerSequence>(children[0]); 
-  OID algorithm = ndnboost::any_cast<OID>(algoSeq->getChildren()[0]->accept(simpleVisitor));  
-  Blob raw = derSeq.getRaw();   
-  return ndnboost::any(ptr_lib::shared_ptr<PublicKey>(new PublicKey(algorithm, raw)));    
-}
-
-} // der
-
-}
diff --git a/src/encoding/der/visitor/public-key-visitor.hpp b/src/encoding/der/visitor/public-key-visitor.hpp
deleted file mode 100644
index 54dfb66..0000000
--- a/src/encoding/der/visitor/public-key-visitor.hpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/* -*- 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_VISITOR_HPP
-#define NDN_PUBLIC_KEY_VISITOR_HPP
-
-#include "no-arguments-visitor.hpp"
-
-namespace ndn {
-
-namespace der {
-
-class PublicKeyVisitor : public NoArgumentsVisitor {
-  public:
-    virtual ndnboost::any visit(DerSequence&       );
-};
-
-} // der
-
-}
-
-#endif
diff --git a/src/encoding/der/visitor/simple-visitor.cpp b/src/encoding/der/visitor/simple-visitor.cpp
deleted file mode 100644
index c56f999..0000000
--- a/src/encoding/der/visitor/simple-visitor.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/* -*- 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 "simple-visitor.hpp"
-#include "../der.hpp"
-#include <ndn-cpp/encoding/oid.hpp>
-
-using namespace std;
-
-namespace ndn {
-
-namespace der
-{
-  
-ndnboost::any 
-SimpleVisitor::visit(DerBool& derBool)
-{
-  bool result = true;
-  
-  if(0 == derBool.getPayload()[0])
-    result = false;
-  
-  return ndnboost::any(result);
-}
-
-ndnboost::any 
-SimpleVisitor::visit(DerInteger& derInteger)
-{
-  return ndnboost::any(derInteger.getPayload());
-}
-
-ndnboost::any 
-SimpleVisitor::visit(DerPrintableString& derPStr)
-{
-  return ndnboost::any(string((const char*)&derPStr.getPayload()[0], derPStr.getPayload().size()));
-}
-
-ndnboost::any 
-SimpleVisitor::visit(DerBitString& derBStr)
-{
-  return ndnboost::any(derBStr.getPayload());
-}
-
-ndnboost::any 
-SimpleVisitor::visit(DerNull& derNull)
-{
-  return ndnboost::any();
-}
-
-ndnboost::any 
-SimpleVisitor::visit(DerOctetString& derOStr)
-{
-  vector<uint8_t> result(derOStr.getPayload());
-  return ndnboost::any(result);
-}
-
-ndnboost::any 
-SimpleVisitor::visit(DerOid& derOid)
-{
-  vector<int> intList;
-  int offset = 0;
-
-  vector<uint8_t>& blob = derOid.getPayload();
-    
-  int first = blob[offset];
-  
-  intList.push_back(first / 40);
-  intList.push_back(first % 40);
-
-  offset++;
-  
-  while(offset < blob.size()){
-    intList.push_back(derOid.decode128(offset));
-  }
-  
-  return ndnboost::any(OID(intList));
-}
-
-ndnboost::any 
-SimpleVisitor::visit(DerSequence& derSeq)
-{
-  return ndnboost::any();
-}
-
-ndnboost::any 
-SimpleVisitor::visit(DerGtime& derGtime)
-{
-  string str((const char*)&derGtime.getPayload()[0], derGtime.getPayload().size());
-  return ndnboost::any(DerGtime::fromIsoString(str.substr(0, 8) + "T" + str.substr(8, 6)));
-}
-
-} // der
-
-}
diff --git a/src/encoding/der/visitor/simple-visitor.hpp b/src/encoding/der/visitor/simple-visitor.hpp
deleted file mode 100644
index 3f0584e..0000000
--- a/src/encoding/der/visitor/simple-visitor.hpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- 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_DER_SIMPLE_VISITOR_HPP
-#define NDN_DER_SIMPLE_VISITOR_HPP
-
-#include "no-arguments-visitor.hpp"
-
-namespace ndn {
-
-namespace der {
-
-class SimpleVisitor : public NoArgumentsVisitor
-{
-public:
-  virtual ndnboost::any visit(DerBool&           );
-  virtual ndnboost::any visit(DerInteger&        );
-  virtual ndnboost::any visit(DerPrintableString&);
-  virtual ndnboost::any visit(DerBitString&      );
-  virtual ndnboost::any visit(DerNull&           );
-  virtual ndnboost::any visit(DerOctetString&    );
-  virtual ndnboost::any visit(DerOid&            );
-  virtual ndnboost::any visit(DerSequence&       );
-  virtual ndnboost::any visit(DerGtime&          );
-};
-
-} // der
-
-}
-
-#endif
diff --git a/src/encoding/der/visitor/visitor.hpp b/src/encoding/der/visitor/visitor.hpp
deleted file mode 100644
index 06c469f..0000000
--- a/src/encoding/der/visitor/visitor.hpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- 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_DER_VISITOR_HPP
-#define NDN_DER_VISITOR_HPP
-
-#include <ndn-cpp/common.hpp>
-
-#if NDN_CPP_USE_SYSTEM_BOOST
-#include <boost/any.hpp>
-namespace ndnboost = boost;
-#else
-// We can use ndnboost::any because this is an internal header and will not conflict with the application if it uses boost::any.
-#include <ndnboost/any.hpp>
-#endif
-
-namespace ndn {
-
-namespace der {
-  
-class DerBool;
-class DerInteger;
-class DerPrintableString;
-class DerBitString;
-class DerNull;
-class DerOctetString;
-class DerOid;
-class DerSequence;
-class DerGtime;
-
-class Visitor
-{
-public:
-  virtual ndnboost::any visit(DerBool&,             ndnboost::any) = 0;
-  virtual ndnboost::any visit(DerInteger&,          ndnboost::any) = 0;
-  virtual ndnboost::any visit(DerPrintableString&,  ndnboost::any) = 0;
-  virtual ndnboost::any visit(DerBitString&,        ndnboost::any) = 0;
-  virtual ndnboost::any visit(DerNull&,             ndnboost::any) = 0;
-  virtual ndnboost::any visit(DerOctetString&,      ndnboost::any) = 0;
-  virtual ndnboost::any visit(DerOid&,              ndnboost::any) = 0;
-  virtual ndnboost::any visit(DerSequence&,         ndnboost::any) = 0;
-  virtual ndnboost::any visit(DerGtime&,            ndnboost::any) = 0;
-};
-
-} // der
-
-}
-
-#endif
diff --git a/src/encoding/der/visitor/void-no-arguments-visitor.hpp b/src/encoding/der/visitor/void-no-arguments-visitor.hpp
deleted file mode 100644
index 7e60d38..0000000
--- a/src/encoding/der/visitor/void-no-arguments-visitor.hpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- 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_DER_VOID_NO_ARGUMENTS_VISITOR_HPP
-#define NDN_DER_VOID_NO_ARGUMENTS_VISITOR_HPP
-
-#include "visitor.hpp"
-
-namespace ndn {
-
-namespace der {
-
-class VoidNoArgumentsVisitor
-{
-public:
-  virtual void visit(DerBool&           ) = 0;
-  virtual void visit(DerInteger&        ) = 0;
-  virtual void visit(DerPrintableString&) = 0;
-  virtual void visit(DerBitString&      ) = 0;
-  virtual void visit(DerNull&           ) = 0;
-  virtual void visit(DerOctetString&    ) = 0;
-  virtual void visit(DerOid&            ) = 0;
-  virtual void visit(DerSequence&       ) = 0;
-  virtual void visit(DerGtime&          ) = 0;
-};
-
-} // der
-
-}
-
-#endif
diff --git a/src/encoding/der/visitor/void-visitor.cpp b/src/encoding/der/visitor/void-visitor.cpp
deleted file mode 100644
index dd8217a..0000000
--- a/src/encoding/der/visitor/void-visitor.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- 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 "void-visitor.hpp"
-
-namespace ndn {
-
-namespace der {
-
-void 
-VoidVisitor::visit(DerBool& derBool, ndnboost::any)
-{}
-
-void
-VoidVisitor::visit(DerInteger& derInteger, ndnboost::any)
-{}
-
-void 
-VoidVisitor::visit(DerPrintableString& derPStr, ndnboost::any)
-{}
-
-void 
-VoidVisitor::visit(DerBitString& derBStr, ndnboost::any)
-{}
-
-void
-VoidVisitor::visit(DerNull& derNull, ndnboost::any)
-{}
-
-void 
-VoidVisitor::visit(DerOctetString& derOStr, ndnboost::any)
-{}
-
-void
-VoidVisitor::visit(DerOid& derOid, ndnboost::any)
-{}
-
-void 
-VoidVisitor::visit(DerSequence& derSequence, ndnboost::any)
-{}
-
-void 
-VoidVisitor::visit(DerGtime& derGtime, ndnboost::any)
-{}
-
-} // der
-
-}
diff --git a/src/encoding/der/visitor/void-visitor.hpp b/src/encoding/der/visitor/void-visitor.hpp
deleted file mode 100644
index e853ee6..0000000
--- a/src/encoding/der/visitor/void-visitor.hpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- 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_DER_VOID_VISITOR_HPP
-#define NDN_DER_VOID_VISITOR_HPP
-
-#include "visitor.hpp"
-
-namespace ndn {
-
-namespace der {
-
-class VoidVisitor
-{
-public:
-  virtual void visit(DerBool&,             ndnboost::any);
-  virtual void visit(DerInteger&,          ndnboost::any);
-  virtual void visit(DerPrintableString&,  ndnboost::any);
-  virtual void visit(DerBitString&,        ndnboost::any);
-  virtual void visit(DerNull&,             ndnboost::any);
-  virtual void visit(DerOctetString&,      ndnboost::any);
-  virtual void visit(DerOid&,              ndnboost::any);
-  virtual void visit(DerSequence&,         ndnboost::any);
-  virtual void visit(DerGtime&,            ndnboost::any);
-};
-
-} // der
-
-}
-
-#endif
diff --git a/src/encoding/oid.cpp b/src/encoding/oid.cpp
index 633d1cf..2db72f7 100644
--- a/src/encoding/oid.cpp
+++ b/src/encoding/oid.cpp
@@ -9,8 +9,10 @@
 #include <sstream>
 
 #include <ndn-cpp/encoding/oid.hpp>
+#include <cryptopp/asn.h>
 
 using namespace std;
+using namespace CryptoPP;
 
 namespace ndn {
 
@@ -48,7 +50,8 @@
   return convert.str();
 }
 
-bool OID::equal(const OID& oid) const
+bool
+OID::equal(const OID& oid) const
 {
   vector<int>::const_iterator i = oid_.begin();
   vector<int>::const_iterator j = oid.oid_.begin();
@@ -64,4 +67,75 @@
     return false;
 }
 
+inline void
+EncodeValue(BufferedTransformation &bt, word32 v)
+{
+  for (unsigned int i=RoundUpToMultipleOf(STDMAX(7U,BitPrecision(v)), 7U)-7; i != 0; i-=7)
+    bt.Put((byte)(0x80 | ((v >> i) & 0x7f)));
+  bt.Put((byte)(v & 0x7f));
+}
+
+inline size_t
+DecodeValue(BufferedTransformation &bt, word32 &v)
+{
+  byte b;
+  size_t i=0;
+  v = 0;
+  while (true)
+    {
+      if (!bt.Get(b))
+        BERDecodeError();
+      i++;
+      if (v >> (8*sizeof(v)-7))	// v about to overflow
+        BERDecodeError();
+      v <<= 7;
+      v += b & 0x7f;
+      if (!(b & 0x80))
+        return i;
+    }
+}
+
+void
+OID::encode(CryptoPP::BufferedTransformation &out) const
+{
+  assert(oid_.size() >= 2);
+  ByteQueue temp;
+  temp.Put(byte(oid_[0] * 40 + oid_[1]));
+  for (size_t i=2; i<oid_.size(); i++)
+    EncodeValue(temp, oid_[i]);
+  out.Put(OBJECT_IDENTIFIER);
+  DERLengthEncode(out, temp.CurrentSize());
+  temp.TransferTo(out);
+}
+
+void
+OID::decode(CryptoPP::BufferedTransformation &in)
+{
+  byte b;
+  if (!in.Get(b) || b != OBJECT_IDENTIFIER)
+    BERDecodeError();
+
+  size_t length;
+  if (!BERLengthDecode(in, length) || length < 1)
+    BERDecodeError();
+
+  if (!in.Get(b))
+    BERDecodeError();
+	
+  length--;
+  oid_.resize(2);
+  oid_[0] = b / 40;
+  oid_[1] = b % 40;
+
+  while (length > 0)
+    {
+      word32 v;
+      size_t valueLen = DecodeValue(in, v);
+      if (valueLen > length)
+        BERDecodeError();
+      oid_.push_back(v);
+      length -= valueLen;
+    }
+}
+
 }
diff --git a/src/security/certificate/certificate-extension.cpp b/src/security/certificate/certificate-extension.cpp
index d9297a9..51c29ed 100644
--- a/src/security/certificate/certificate-extension.cpp
+++ b/src/security/certificate/certificate-extension.cpp
@@ -6,42 +6,51 @@
  * See COPYING for copyright and distribution information.
  */
 
-#include "../../encoding/der/der.hpp"
-#include "../../util/blob-stream.hpp"
 #include <ndn-cpp/security/certificate/certificate-extension.hpp>
+#include <cryptopp/asn.h>
 
 using namespace std;
+using namespace CryptoPP;
 
 namespace ndn {
 
-ptr_lib::shared_ptr<der::DerNode> 
-CertificateExtension::toDer() const
+void
+CertificateExtension::encode(CryptoPP::BufferedTransformation &out) const
 {
-  ptr_lib::shared_ptr<der::DerSequence> root(new der::DerSequence);
-    
-  ptr_lib::shared_ptr<der::DerOid> extensionId(new der::DerOid(extensionId_));
-  ptr_lib::shared_ptr<der::DerBool> isCritical(new der::DerBool(isCritical_));
-  ptr_lib::shared_ptr<der::DerOctetString> extensionValue(new der::DerOctetString(*extensionValue_));
+  // Extension ::= SEQUENCE {
+  //        extnID      OBJECT IDENTIFIER,
+  //        critical    BOOLEAN DEFAULT FALSE,
+  //        extnValue   OCTET STRING  }
 
-  root->addChild(extensionId);
-  root->addChild(isCritical);
-  root->addChild(extensionValue);
-
-  root->getSize();
-
-  return root;
+  DERSequenceEncoder extension(out);
+  {
+    extensionId_.encode(extension);
+    DEREncodeUnsigned(extension, isCritical_, BOOLEAN);
+    DEREncodeOctetString(extension, extensionValue_.buf(), extensionValue_.size());
+  }
+  extension.MessageEnd();
 }
 
-Blob
-CertificateExtension::toDerBlob() const
+void
+CertificateExtension::decode(CryptoPP::BufferedTransformation &in)
 {
-  blob_stream blobStream;
-  der::OutputIterator& start = reinterpret_cast<der::OutputIterator&>(blobStream);
+  // Extension ::= SEQUENCE {
+  //        extnID      OBJECT IDENTIFIER,
+  //        critical    BOOLEAN DEFAULT FALSE,
+  //        extnValue   OCTET STRING  }
 
-  toDer()->encode(start);
+  BERSequenceDecoder extension(in);
+  {
+    extensionId_.decode(extension);
+    BERDecodeUnsigned(extension, isCritical_, BOOLEAN);
 
-  return blobStream.buf();
+    // the extra copy operation can be optimized, but not trivial,
+    // since the length is not known in advance
+    SecByteBlock tmpBlock;
+    BERDecodeOctetString(extension, tmpBlock);
+    extensionValue_.assign(tmpBlock.begin(), tmpBlock.end());
+  }
+  extension.MessageEnd();
 }
-
-
+ 
 }
diff --git a/src/security/certificate/certificate-subject-description.cpp b/src/security/certificate/certificate-subject-description.cpp
index 3571f7f..472b30e 100644
--- a/src/security/certificate/certificate-subject-description.cpp
+++ b/src/security/certificate/certificate-subject-description.cpp
@@ -6,25 +6,58 @@
  * See COPYING for copyright and distribution information.
  */
 
-#include "../../encoding/der/der.hpp"
 #include <ndn-cpp/security/certificate/certificate-subject-description.hpp>
+#include <cryptopp/asn.h>
 
 using namespace std;
+using namespace CryptoPP;
 
 namespace ndn {
 
-ptr_lib::shared_ptr<der::DerNode> 
-CertificateSubjectDescription::toDer() const
+void
+CertificateSubjectDescription::encode(CryptoPP::BufferedTransformation &out) const
 {
-  ptr_lib::shared_ptr<der::DerSequence> root(new der::DerSequence());
+  // RelativeDistinguishedName ::=
+  //     SET OF AttributeTypeAndValue
+  // 
+  // AttributeTypeAndValue ::= SEQUENCE {
+  //     type     AttributeType,
+  //     value    AttributeValue   }
+  // 
+  // AttributeType ::= OBJECT IDENTIFIER
+  // 
+  // AttributeValue ::= ANY DEFINED BY AttributeType
+  DERSequenceEncoder attributeTypeAndValue(out);
+  {
+    oid_.encode(attributeTypeAndValue);
+    DEREncodeTextString(attributeTypeAndValue, value_, PRINTABLE_STRING);
+  }
+  attributeTypeAndValue.MessageEnd();
+}
 
-  ptr_lib::shared_ptr<der::DerOid> oid(new der::DerOid(oid_));
-  ptr_lib::shared_ptr<der::DerPrintableString> value(new der::DerPrintableString(value_));
+void
+CertificateSubjectDescription::decode(CryptoPP::BufferedTransformation &in)
+{
+  // RelativeDistinguishedName ::=
+  //     SET OF AttributeTypeAndValue
+  // 
+  // AttributeTypeAndValue ::= SEQUENCE {
+  //     type     AttributeType,
+  //     value    AttributeValue   }
+  // 
+  // AttributeType ::= OBJECT IDENTIFIER
+  // 
+  // AttributeValue ::= ANY DEFINED BY AttributeType
 
-  root->addChild(oid);
-  root->addChild(value);
+  BERSequenceDecoder attributeTypeAndValue(in);
+  {
+    oid_.decode(attributeTypeAndValue);
 
-  return root;
+    /// @todo May be add more intelligent processing, since the following
+    ///       may fail if somebody encoded attribute that uses non PRINTABLE_STRING as value
+    BERDecodeTextString(attributeTypeAndValue, value_, PRINTABLE_STRING);
+  }
+  attributeTypeAndValue.MessageEnd();
 }
 
 }
diff --git a/src/security/certificate/certificate.cpp b/src/security/certificate/certificate.cpp
index 3275ac5..da88444 100644
--- a/src/security/certificate/certificate.cpp
+++ b/src/security/certificate/certificate.cpp
@@ -8,7 +8,7 @@
 
 #include <ndn-cpp/common.hpp>
 
-#include <float.h>
+#include "certificate.hpp"
 
 #if NDN_CPP_USE_SYSTEM_BOOST
 #include <boost/iostreams/stream.hpp>
@@ -20,14 +20,16 @@
 #include <ndnboost/iostreams/device/array.hpp>
 #endif
 
-#include <ndn-cpp/sha256-with-rsa-signature.hpp>
-#include "../../encoding/der/der.hpp"
-#include "../../encoding/der/visitor/certificate-data-visitor.hpp"
-#include "../../encoding/der/visitor/print-visitor.hpp"
 #include "../../util/logging.hpp"
-#include "../../util/blob-stream.hpp"
-#include "../../c/util/time.h"
-#include <ndn-cpp/security/certificate/certificate.hpp>
+// #include "../../util/blob-stream.hpp"
+// #include <ndn-cpp/security/certificate/certificate.hpp>
+#include "../../util/time.hpp"
+
+#include <cryptopp/asn.h>
+#include <cryptopp/base64.h>
+#include <cryptopp/files.h>
+
+#include "../../encoding/cryptopp/asn_ext.hpp"
 
 INIT_LOGGER("ndn.security.Certificate");
 
@@ -36,8 +38,8 @@
 namespace ndn {
 
 Certificate::Certificate()
-  : notBefore_(DBL_MAX)
-  , notAfter_(-DBL_MAX)
+  : notBefore_(std::numeric_limits<MillisecondsSince1970>::max())
+  , notAfter_(std::numeric_limits<MillisecondsSince1970>::min())
 {}
 
 Certificate::Certificate(const Data& data)
@@ -77,80 +79,202 @@
 void
 Certificate::encode()
 {
-  ptr_lib::shared_ptr<der::DerSequence> root(new der::DerSequence());
+  // Name
+  //    <key_name>/ID-CERT/<id#>
+  // Content
+  // DER encoded idCert:
+  //
+  // 	idCert ::= SEQUENCE {
+  //        validity            Validity,
+  // 	    subject             Name,
+  // 	    subjectPubKeyInfo   SubjectPublicKeyInfo,
+  // 	    extension           Extensions OPTIONAL   }
+  //
+  // 	Validity ::= SEQUENCE {
+  //        notBefore           Time,
+  //        notAfter            Time   }
+  //
+  //    Name ::= CHOICE {
+  //        RDNSequence   }
+  //
+  //    RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
+  //
+  //    RelativeDistinguishedName ::=
+  //        SET OF AttributeTypeAndValue
+  //
+  // 	SubjectPublicKeyInfo ::= SEQUENCE {
+  //        algorithm           AlgorithmIdentifier
+  //        keybits             BIT STRING   }
+  //
+  //    Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
+  //
+  // (see http://www.ietf.org/rfc/rfc3280.txt for more detail)
+  //
+  // KeyLocator
+  //    issuer’s certificate name
+  // Signature
+
+  using namespace CryptoPP;
+
+  OBufferStream os;
+  CryptoPP::FileSink sink(os);
   
-  ptr_lib::shared_ptr<der::DerSequence> validity(new der::DerSequence());
-  ptr_lib::shared_ptr<der::DerGtime> notBefore(new der::DerGtime(notBefore_));
-  ptr_lib::shared_ptr<der::DerGtime> notAfter(new der::DerGtime(notAfter_));
-  validity->addChild(notBefore);
-  validity->addChild(notAfter);
-  root->addChild(validity);
-
-  ptr_lib::shared_ptr<der::DerSequence> subjectList(new der::DerSequence());
-  SubjectDescriptionList::iterator it = subjectDescriptionList_.begin();
-  for(; it != subjectDescriptionList_.end(); it++)
+  // idCert ::= SEQUENCE {
+  //     validity            Validity,
+  //     subject             Name,
+  //     subjectPubKeyInfo   SubjectPublicKeyInfo,
+  //     extension           Extensions OPTIONAL   }
+  DERSequenceEncoder idCert(sink);
+  {
+    // Validity ::= SEQUENCE {
+    //       notBefore           Time,
+    //       notAfter            Time   }
+    DERSequenceEncoder validity(idCert);
     {
-      ptr_lib::shared_ptr<der::DerNode> child = it->toDer();
-      subjectList->addChild(child);
+      DEREncodeGeneralTime(validity, notBefore_);
+      DEREncodeGeneralTime(validity, notAfter_);
     }
-  root->addChild(subjectList);
+    validity.MessageEnd();
 
-  root->addChild(key_.toDer());
-
-  if(!extensionList_.empty())
+    // Name ::= CHOICE {
+    //     RDNSequence   }
+    // 
+    // RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
+    DERSequenceEncoder name(idCert);
     {
-      ptr_lib::shared_ptr<der::DerSequence> extnList(new der::DerSequence());
-      ExtensionList::iterator it = extensionList_.begin();
-      for(; it != extensionList_.end(); it++)
-        extnList->addChild(it->toDer());
-      root->addChild(extnList);
+      for(SubjectDescriptionList::iterator it = subjectDescriptionList_.begin();
+          it != subjectDescriptionList_.end(); ++it)
+        {
+          it->encode(name);
+        }
     }
+    name.MessageEnd();
+  
+    // SubjectPublicKeyInfo
+    key_.encode(idCert);
 
-  blob_stream blobStream;
-  der::OutputIterator& start = reinterpret_cast<der::OutputIterator&>(blobStream);
+    // Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
+    //
+    // Extension ::= SEQUENCE {
+    //        extnID      OBJECT IDENTIFIER,
+    //        critical    BOOLEAN DEFAULT FALSE,
+    //        extnValue   OCTET STRING  }
+    if(!extensionList_.empty())
+      {
+        DERSequenceEncoder extensions(idCert);
+        {
+          
+          for(ExtensionList::iterator it = extensionList_.begin();
+              it != extensionList_.end(); ++it)
+            {
+              it->encode(extensions);
+            }
+        }
+        extensions.MessageEnd();
+      }
+  }
 
-  root->encode(start);
+  idCert.MessageEnd();
 
-  ptr_lib::shared_ptr<vector<uint8_t> > blob = blobStream.buf();
-  setContent(blob);
-  getMetaInfo().setType(ndn_ContentType_KEY);
+  setContent(os.buf());
+  setContentType(MetaInfo::TYPE_KEY);
 }
 
 void 
 Certificate::decode()
 {
-  Blob blob = getContent();
+  using namespace CryptoPP;
 
-  ndnboost::iostreams::stream<ndnboost::iostreams::array_source> is((const char*)blob.buf(), blob.size());
+  OBufferStream os;
+  CryptoPP::StringSource source(getContent().value(), getContent().value_size(), true);
+  
+  // idCert ::= SEQUENCE {
+  //     validity            Validity,
+  //     subject             Name,
+  //     subjectPubKeyInfo   SubjectPublicKeyInfo,
+  //     extension           Extensions OPTIONAL   }
+  BERSequenceDecoder idCert(source);
+  {
+    // Validity ::= SEQUENCE {
+    //       notBefore           Time,
+    //       notAfter            Time   }
+    BERSequenceDecoder validity(idCert);
+    {
+      BERDecodeTime(validity, notBefore_);
+      BERDecodeTime(validity, notAfter_);
+    }
+    validity.MessageEnd();
 
-  ptr_lib::shared_ptr<der::DerNode> node = der::DerNode::parse(reinterpret_cast<der::InputIterator&>(is));
+    // Name ::= CHOICE {
+    //     RDNSequence   }
+    // 
+    // RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
+    subjectDescriptionList_.clear();
+    BERSequenceDecoder name(idCert);
+    {
+      while(!name.EndReached())
+        {
+          subjectDescriptionList_.push_back(CertificateSubjectDescription(name));
+        }
+    }
+    name.MessageEnd();
+  
+    // SubjectPublicKeyInfo ::= SEQUENCE {
+    //     algorithm           AlgorithmIdentifier
+    //     keybits             BIT STRING   }
+    key_.decode(idCert);
 
-  // der::PrintVisitor printVisitor;
-  // node->accept(printVisitor, string(""));
+    // Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
+    //
+    // Extension ::= SEQUENCE {
+    //        extnID      OBJECT IDENTIFIER,
+    //        critical    BOOLEAN DEFAULT FALSE,
+    //        extnValue   OCTET STRING  }
+    extensionList_.clear();
+    if(!idCert.EndReached())
+      {
+        BERSequenceDecoder extensions(idCert);
+        {
+          while(!extensions.EndReached())
+            {
+              extensionList_.push_back(CertificateExtension(extensions));
+            }
+        }
+        extensions.MessageEnd();
+      }
+  }
 
-  der::CertificateDataVisitor certDataVisitor;
-  node->accept(certDataVisitor, this);
+  idCert.MessageEnd();
 }
 
 void 
-Certificate::printCertificate()
+Certificate::printCertificate(std::ostream &os) const
 {
-  cout << "Validity:" << endl;
-  cout << der::DerGtime::toIsoString(notBefore_) << endl;
-  cout << der::DerGtime::toIsoString(notAfter_) << endl;
-
-  cout << "Subject Info:" << endl;  
-  vector<CertificateSubjectDescription>::iterator it = subjectDescriptionList_.begin();
-  for(; it < subjectDescriptionList_.end(); it++){
-    cout << it->getOidString() << "\t" << it->getValue() << endl;
+  os << "Certificate name: " << endl;
+  os << "  " << getName() << endl;
+  os << "Validity:" << endl;
+  {
+    os << "  NotBefore: " << toIsoString(notBefore_) << endl;
+    os << "  NotAfter: "  << toIsoString(notAfter_)  << endl;
   }
 
-  ndnboost::iostreams::stream<ndnboost::iostreams::array_source> is((const char*)key_.getKeyDer().buf(), key_.getKeyDer().size());
+  os << "Subject Description:" << endl;  
+  for(SubjectDescriptionList::const_iterator it = subjectDescriptionList_.begin();
+      it != subjectDescriptionList_.end(); ++it)
+    {
+      os << "  " << it->getOidString() << ": " << it->getValue() << endl;
+    }
 
-  ptr_lib::shared_ptr<der::DerNode> keyRoot = der::DerNode::parse(reinterpret_cast<der::InputIterator&> (is));
+  os << "Public key bits: " << endl;
+  CryptoPP::Base64Encoder encoder(new CryptoPP::FileSink(os), true, 64);
+  key_.encode(encoder);
+  
+  // ndnboost::iostreams::stream<ndnboost::iostreams::array_source> is((const char*)key_.getKeyDer().buf(), key_.getKeyDer().size());
 
-  der::PrintVisitor printVisitor;
-  keyRoot->accept(printVisitor, string(""));
+  // ptr_lib::shared_ptr<der::DerNode> keyRoot = der::DerNode::parse(reinterpret_cast<der::InputIterator&> (is));
+
+  // der::PrintVisitor printVisitor;
+  // keyRoot->accept(printVisitor, string(""));
 }
 
 }
diff --git a/src/security/certificate/public-key.cpp b/src/security/certificate/public-key.cpp
index fc41a94..131e3c1 100644
--- a/src/security/certificate/public-key.cpp
+++ b/src/security/certificate/public-key.cpp
@@ -8,6 +8,8 @@
 
 #include <ndn-cpp/common.hpp>
 
+#include "public-key.hpp"
+
 #if NDN_CPP_USE_SYSTEM_BOOST
 #include <boost/iostreams/stream.hpp>
 #include <boost/iostreams/device/array.hpp>
@@ -18,49 +20,109 @@
 #include <ndnboost/iostreams/device/array.hpp>
 #endif
 
-#include <ndn-cpp/security/security-exception.hpp>
-#include "../../c/util/crypto.h"
-#include "../../encoding/der/der.hpp"
-#include <ndn-cpp/security/certificate/public-key.hpp>
+#include <cryptopp/rsa.h>
+#include <cryptopp/base64.h>
+#include <cryptopp/files.h>
 
 using namespace std;
+using namespace CryptoPP;
 
 namespace ndn {
 
-ptr_lib::shared_ptr<der::DerNode>
-PublicKey::toDer()
-{
-  ndnboost::iostreams::stream<ndnboost::iostreams::array_source> is((const char*)keyDer_.buf (), keyDer_.size ());
+static OID RSA_OID("1.2.840.113549.1.1.1");
 
-  return der::DerNode::parse(reinterpret_cast<der::InputIterator&> (is));
+PublicKey::PublicKey()
+{
 }
 
-static int RSA_OID[] = { 1, 2, 840, 113549, 1, 1, 1 };
-
-ptr_lib::shared_ptr<PublicKey>
-PublicKey::fromDer(const Blob& keyDer)
+/**
+ * Create a new PublicKey with the given values.
+ * @param algorithm The algorithm of the public key.
+ * @param keyDer The blob of the PublicKeyInfo in terms of DER.
+ */
+PublicKey::PublicKey(const uint8_t *keyDerBuf, size_t keyDerSize)
 {
-  // Use a temporary pointer since d2i updates it.
-  const uint8_t *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 ptr_lib::shared_ptr<PublicKey>(new PublicKey(OID(vector<int>(RSA_OID, RSA_OID + sizeof(RSA_OID))), keyDer));
+  StringSource src(keyDerBuf, keyDerSize, true);
+  decode(src);
 }
 
-Blob
-PublicKey::getDigest(DigestAlgorithm digestAlgorithm) const
+void
+PublicKey::encode(CryptoPP::BufferedTransformation &out) const
 {
-  if (digestAlgorithm == DIGEST_ALGORITHM_SHA256) {
-    uint8_t digest[SHA256_DIGEST_LENGTH];
-    ndn_digestSha256(keyDer_.buf(), keyDer_.size(), digest);
-    
-    return Blob(digest, sizeof(digest));
+  // SubjectPublicKeyInfo ::= SEQUENCE {
+  //     algorithm           AlgorithmIdentifier
+  //     keybits             BIT STRING   }
+
+  out.Put(key_.buf(), key_.size());
+}
+
+void
+PublicKey::decode(CryptoPP::BufferedTransformation &in)
+{
+  // SubjectPublicKeyInfo ::= SEQUENCE {
+  //     algorithm           AlgorithmIdentifier
+  //     keybits             BIT STRING   }
+
+  try {
+    std::string out;
+    StringSink sink(out);
+
+    ////////////////////////
+    // part 1: copy as is //
+    ////////////////////////
+    BERSequenceDecoder decoder(in);
+    {
+      assert (decoder.IsDefiniteLength());
+
+      DERSequenceEncoder encoder(sink);
+      decoder.TransferTo(encoder, decoder.RemainingLength());
+      encoder.MessageEnd();
+    }
+    decoder.MessageEnd();
+
+    ////////////////////////
+    // part 2: check if the key is RSA (since it is the only supported for now)
+    ////////////////////////
+    StringSource checkedSource(out, true);
+    BERSequenceDecoder subjectPublicKeyInfo(checkedSource);
+    {
+      BERSequenceDecoder algorithmInfo(subjectPublicKeyInfo);
+      {
+        OID algorithm;
+        algorithm.decode(algorithmInfo);
+
+        if (algorithm != RSA_OID)
+          throw Error("Only RSA public keys are supported for now (" + algorithm.toString() + " requested");
+      }
+    }
+
+    key_.assign(out.begin(), out.end());
   }
-  else
-    throw UnrecognizedDigestAlgorithmException("Wrong format!");
+  catch (CryptoPP::BERDecodeErr &err) {
+    throw Error("PublicKey decoding error");
+  }
+}
+
+// Blob
+// PublicKey::getDigest(DigestAlgorithm digestAlgorithm) const
+// {
+//   if (digestAlgorithm == DIGEST_ALGORITHM_SHA256) {
+//     uint8_t digest[SHA256_DIGEST_LENGTH];
+//     ndn_digestSha256(keyDer_.buf(), keyDer_.size(), digest);
+    
+//     return Blob(digest, sizeof(digest));
+//   }
+//   else
+//     throw UnrecognizedDigestAlgorithmException("Wrong format!");
+// }
+
+std::ostream &
+operator <<(std::ostream &os, const PublicKey &key)
+{
+  CryptoPP::StringSource(key.get().buf(), key.get().size(), true,
+                         new CryptoPP::Base64Encoder(new CryptoPP::FileSink(os), true, 64));
+
+  return os;
 }
 
 }
diff --git a/tests_boost/test-encode-decode-certificate.cpp b/tests_boost/test-encode-decode-certificate.cpp
new file mode 100644
index 0000000..41405c0
--- /dev/null
+++ b/tests_boost/test-encode-decode-certificate.cpp
@@ -0,0 +1,127 @@
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * @author: Jeff Thompson <jefft0@remap.ucla.edu>
+ * See COPYING for copyright and distribution information.
+ */
+
+#include <boost/test/unit_test.hpp>
+
+#include <ndn-cpp/security/certificate/certificate.hpp>
+#include <ndn-cpp/security/certificate/public-key.hpp>
+
+#include <cryptopp/cryptlib.h>
+#include <cryptopp/rsa.h>
+#include <cryptopp/files.h>
+
+#include <fstream>
+
+using namespace std;
+using namespace ndn;
+
+using namespace CryptoPP;
+
+BOOST_AUTO_TEST_SUITE(TestCertificate)
+
+const uint8_t CertificateRaw[] = {
+};
+
+const unsigned char PRIVATE_KEY_DER[] = {
+0x30, 0x82, 0x02, 0x74, 0x02, 0x01, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01,
+0x05, 0x00, 0x04, 0x82, 0x02, 0x5e, 0x30, 0x82, 0x02, 0x5a, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0x9e, 0x06, 0x3e,
+0x47, 0x85, 0xb2, 0x34, 0x37, 0xaa, 0x85, 0x47, 0xac, 0x03, 0x24, 0x83, 0xb5, 0x9c, 0xa8, 0x05, 0x3a, 0x24, 0x1e, 0xeb,
+0x89, 0x01, 0xbb, 0xe9, 0x9b, 0xb2, 0xc3, 0x22, 0xac, 0x68, 0xe3, 0xf0, 0x6c, 0x02, 0xce, 0x68, 0xa6, 0xc4, 0xd0, 0xa7,
+0x06, 0x90, 0x9c, 0xaa, 0x1b, 0x08, 0x1d, 0x8b, 0x43, 0x9a, 0x33, 0x67, 0x44, 0x6d, 0x21, 0xa3, 0x1b, 0x88, 0x9a, 0x97,
+0x5e, 0x59, 0xc4, 0x15, 0x0b, 0xd9, 0x2c, 0xbd, 0x51, 0x07, 0x61, 0x82, 0xad, 0xc1, 0xb8, 0xd7, 0xbf, 0x9b, 0xcf, 0x7d,
+0x24, 0xc2, 0x63, 0xf3, 0x97, 0x17, 0xeb, 0xfe, 0x62, 0x25, 0xba, 0x5b, 0x4d, 0x8a, 0xc2, 0x7a, 0xbd, 0x43, 0x8a, 0x8f,
+0xb8, 0xf2, 0xf1, 0xc5, 0x6a, 0x30, 0xd3, 0x50, 0x8c, 0xc8, 0x9a, 0xdf, 0xef, 0xed, 0x35, 0xe7, 0x7a, 0x62, 0xea, 0x76,
+0x7c, 0xbb, 0x08, 0x26, 0xc7, 0x02, 0x01, 0x11, 0x02, 0x81, 0x80, 0x04, 0xa5, 0xd4, 0xa7, 0xc0, 0x2a, 0xe3, 0x6b, 0x0c,
+0x8b, 0x73, 0x0c, 0x96, 0xae, 0x40, 0x1b, 0xee, 0x04, 0xf1, 0x18, 0x4c, 0x5b, 0x43, 0x29, 0xad, 0x3a, 0x3b, 0x93, 0xa3,
+0x60, 0x17, 0x9b, 0xa8, 0xbb, 0x68, 0xf4, 0x1e, 0x33, 0x3f, 0x50, 0x32, 0xf7, 0x13, 0xf8, 0xa9, 0xe6, 0x7d, 0x79, 0x44,
+0x00, 0xde, 0x72, 0xed, 0xf2, 0x73, 0xfa, 0x7b, 0xae, 0x2a, 0x71, 0xc0, 0x40, 0xc8, 0x37, 0x6f, 0x38, 0xb2, 0x69, 0x1f,
+0xa8, 0x83, 0x7b, 0x42, 0x00, 0x73, 0x46, 0xe6, 0x4c, 0x91, 0x7f, 0x13, 0x06, 0x69, 0x06, 0xd8, 0x3f, 0x22, 0x15, 0x75,
+0xf6, 0xde, 0xcd, 0xb0, 0xbc, 0x66, 0x61, 0x91, 0x08, 0x9b, 0x2b, 0xb2, 0x00, 0xa9, 0x67, 0x05, 0x39, 0x40, 0xb9, 0x37,
+0x85, 0x88, 0x4f, 0x76, 0x79, 0x63, 0xc0, 0x88, 0x3c, 0x86, 0xa8, 0x12, 0x94, 0x5f, 0xe4, 0x36, 0x3d, 0xea, 0xb9, 0x02,
+0x41, 0x00, 0xb6, 0x2e, 0xbb, 0xcd, 0x2f, 0x3a, 0x99, 0xe0, 0xa1, 0xa5, 0x44, 0x77, 0xea, 0x0b, 0xbe, 0x16, 0x95, 0x0e,
+0x64, 0xa7, 0x68, 0xd7, 0x4b, 0x15, 0x15, 0x23, 0xe2, 0x1e, 0x4e, 0x00, 0x2c, 0x22, 0x97, 0xae, 0xb0, 0x74, 0xa6, 0x99,
+0xd0, 0x5d, 0xb7, 0x1b, 0x10, 0x34, 0x13, 0xd2, 0x5f, 0x6e, 0x56, 0xad, 0x85, 0x4a, 0xdb, 0xf0, 0x78, 0xbd, 0xf4, 0x8c,
+0xb7, 0x9a, 0x3e, 0x99, 0xef, 0xb9, 0x02, 0x41, 0x00, 0xde, 0x0d, 0xa7, 0x48, 0x75, 0x90, 0xad, 0x11, 0xa1, 0xac, 0xee,
+0xcb, 0x41, 0x81, 0xc6, 0xc8, 0x7f, 0xe7, 0x25, 0x94, 0xa1, 0x2a, 0x21, 0xa8, 0x57, 0xfe, 0x84, 0xf2, 0x5e, 0xb4, 0x96,
+0x35, 0xaf, 0xef, 0x2e, 0x7a, 0xf8, 0xda, 0x3f, 0xac, 0x8a, 0x3c, 0x1c, 0x9c, 0xbd, 0x44, 0xd6, 0x90, 0xb5, 0xce, 0x1b,
+0x12, 0xf9, 0x3b, 0x8c, 0x69, 0xf6, 0xa9, 0x02, 0x93, 0x48, 0x35, 0x0a, 0x7f, 0x02, 0x40, 0x6b, 0x2a, 0x8c, 0x96, 0xd0,
+0x7c, 0xd2, 0xfc, 0x9b, 0x52, 0x28, 0x46, 0x89, 0xac, 0x8d, 0xef, 0x2a, 0x80, 0xef, 0xea, 0x01, 0x6f, 0x95, 0x93, 0xee,
+0x51, 0x57, 0xd5, 0x97, 0x4b, 0x65, 0x41, 0x86, 0x66, 0xc2, 0x26, 0x80, 0x1e, 0x3e, 0x55, 0x3e, 0x88, 0x63, 0xe2, 0x66,
+0x03, 0x47, 0x31, 0xd8, 0xa2, 0x4e, 0x68, 0x45, 0x24, 0x0a, 0xca, 0x17, 0x61, 0xd5, 0x69, 0xca, 0x78, 0xab, 0x21, 0x02,
+0x41, 0x00, 0x8f, 0xae, 0x7b, 0x4d, 0x00, 0xc7, 0x06, 0x92, 0xf0, 0x24, 0x9a, 0x83, 0x84, 0xbd, 0x62, 0x81, 0xbc, 0x2c,
+0x27, 0x60, 0x2c, 0x0c, 0x33, 0xe5, 0x66, 0x1d, 0x28, 0xd9, 0x10, 0x1a, 0x7f, 0x4f, 0xea, 0x4f, 0x78, 0x6d, 0xb0, 0x14,
+0xbf, 0xc9, 0xff, 0x17, 0xd6, 0x47, 0x4d, 0x4a, 0xa8, 0xf4, 0x39, 0x67, 0x3e, 0xb1, 0xec, 0x8f, 0xf1, 0x71, 0xbd, 0xb8,
+0xa7, 0x50, 0x3d, 0xc7, 0xf7, 0xbb, 0x02, 0x40, 0x0d, 0x85, 0x32, 0x73, 0x9f, 0x0a, 0x33, 0x2f, 0x4b, 0xa2, 0xbd, 0xd1,
+0xb1, 0x42, 0xf0, 0x72, 0xa8, 0x7a, 0xc8, 0x15, 0x37, 0x1b, 0xde, 0x76, 0x70, 0xce, 0xfd, 0x69, 0x20, 0x00, 0x4d, 0xc9,
+0x4f, 0x35, 0x6f, 0xd1, 0x35, 0xa1, 0x04, 0x95, 0x30, 0xe8, 0x3b, 0xd5, 0x03, 0x5a, 0x50, 0x21, 0x6d, 0xa0, 0x84, 0x39,
+0xe9, 0x2e, 0x1e, 0xfc, 0xe4, 0x82, 0x43, 0x20, 0x46, 0x7d, 0x0a, 0xb6
+};
+
+const uint8_t PUBLIC_KEY[] = {
+0x30, 0x81, 0x9d, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81,
+0x8b, 0x00, 0x30, 0x81, 0x87, 0x02, 0x81, 0x81, 0x00, 0x9e, 0x06, 0x3e, 0x47, 0x85, 0xb2, 0x34, 0x37, 0xaa, 0x85, 0x47,
+0xac, 0x03, 0x24, 0x83, 0xb5, 0x9c, 0xa8, 0x05, 0x3a, 0x24, 0x1e, 0xeb, 0x89, 0x01, 0xbb, 0xe9, 0x9b, 0xb2, 0xc3, 0x22,
+0xac, 0x68, 0xe3, 0xf0, 0x6c, 0x02, 0xce, 0x68, 0xa6, 0xc4, 0xd0, 0xa7, 0x06, 0x90, 0x9c, 0xaa, 0x1b, 0x08, 0x1d, 0x8b,
+0x43, 0x9a, 0x33, 0x67, 0x44, 0x6d, 0x21, 0xa3, 0x1b, 0x88, 0x9a, 0x97, 0x5e, 0x59, 0xc4, 0x15, 0x0b, 0xd9, 0x2c, 0xbd,
+0x51, 0x07, 0x61, 0x82, 0xad, 0xc1, 0xb8, 0xd7, 0xbf, 0x9b, 0xcf, 0x7d, 0x24, 0xc2, 0x63, 0xf3, 0x97, 0x17, 0xeb, 0xfe,
+0x62, 0x25, 0xba, 0x5b, 0x4d, 0x8a, 0xc2, 0x7a, 0xbd, 0x43, 0x8a, 0x8f, 0xb8, 0xf2, 0xf1, 0xc5, 0x6a, 0x30, 0xd3, 0x50,
+0x8c, 0xc8, 0x9a, 0xdf, 0xef, 0xed, 0x35, 0xe7, 0x7a, 0x62, 0xea, 0x76, 0x7c, 0xbb, 0x08, 0x26, 0xc7, 0x02, 0x01, 0x11
+};
+
+const uint8_t T[] = {
+0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xac, 0x72, 0x2e, 0x1e, 0x18, 0xea, 0x25, 0x9b, 0x32, 0xea, 0xee, 0xa8, 0x15, 0x04, 0xba, 0xdf, 0x9c, 0x24, 0xb3, 0xde, 0x56, 0x17, 0xf1, 0xee, 0x99, 0xba, 0x34, 0x01, 0x08, 0x6f, 0x6c, 0xb5, 0x56, 0x30, 0xbf, 0x90, 0xa9, 0x36, 0xaa, 0xd1, 0x10, 0x8b, 0x9a, 0x30, 0xfb, 0x35, 0x38, 0x21, 0x42, 0x70, 0xed, 0xe6, 0x33, 0x9c, 0xfa, 0x50, 0x6d, 0x85, 0x96, 0x60, 0x7e, 0x5b, 0xa9, 0x81, 0xb3, 0x24, 0xb7, 0xe9, 0xfc, 0xaf, 0xb5, 0xf7, 0x81, 0x7c, 0x19, 0xf1, 0xb6, 0x24, 0xbd, 0x05, 0xeb, 0x4a, 0x11, 0x68, 0xd7, 0xae, 0xc4, 0x13, 0x70, 0x7c, 0x85, 0x13, 0x78, 0x61, 0x2a, 0xf8, 0xa6, 0xa3, 0x0a, 0x33, 0x4a, 0x7d, 0xb1, 0xd9, 0x07, 0x3b, 0x01, 0x02, 0xd4, 0x50, 0x0b, 0x02, 0xfc, 0xcd, 0x7e, 0xe6, 0x5a, 0xcf, 0x72, 0x74, 0xd7, 0x96, 0xc1, 0x28, 0xbb, 0xcd, 0x1c, 0xc9, 0x38, 0xd8, 0x77, 0x23, 0x6f, 0x98, 0xdc, 0x98, 0x3d, 0xde, 0x15, 0x5e, 0x43, 0xb5, 0x80, 0xa7, 0xca, 0xdb, 0xec, 0xc5, 0xc3, 0x0d, 0x15, 0xa6, 0x45, 0x81, 0x91, 0xd2, 0x8c, 0x4a, 0xc0, 0xab, 0x46, 0x64, 0xfc, 0xfb, 0x67, 0x4c, 0x02, 0x88, 0x6f, 0x06, 0xfc, 0xb1, 0x3c, 0x3a, 0x24, 0x67, 0xcf, 0x5b, 0x74, 0x71, 0x6e, 0xcf, 0x9b, 0x88, 0xca, 0xe6, 0xb6, 0x9e, 0xf7, 0x1a, 0x9a, 0xd8, 0x36, 0x3c, 0xf2, 0x26, 0x06, 0x15, 0x86, 0x9b, 0xc9, 0x04, 0xa6, 0x99, 0xc2, 0xf2, 0xbf, 0xbc, 0xb2, 0xe0, 0x4e, 0xa8, 0x46, 0xc5, 0x8c, 0x06, 0xff, 0x82, 0x1f, 0xfc, 0xff, 0xfc, 0xab, 0x88, 0x6e, 0xfe, 0x8e, 0x39, 0xa6, 0xe4, 0xfa, 0x46, 0x5b, 0x11, 0xc2, 0x7c, 0x9d, 0xb4, 0x73, 0xe3, 0x04, 0x64, 0xd6, 0xd4, 0x38, 0x84, 0xef, 0x68, 0x2b, 0x93, 0x24, 0x4c, 0x62, 0x84, 0x41, 0x15, 0x02, 0x03, 0x01, 0x00, 0x01
+};
+
+BOOST_AUTO_TEST_CASE (Encode)
+{
+  ndn::Certificate c;
+
+  c.setNotBefore(1388100174000); // 12/26/2013 @ 11:22pm
+  c.setNotAfter(1388100174000); // 12/26/2013 @ 11:22pm
+
+  // RSA::PrivateKey privateKey_;
+  // StringSource source(DEFAULT_PRIVATE_KEY_DER, sizeof(DEFAULT_PRIVATE_KEY_DER), true);
+  // privateKey_.Load(source);
+  
+  // RSA::PublicKey publicKey_(privateKey_);
+  // std::string x;
+  // CryptoPP::StringSink sink(x);
+  // publicKey_.Save(sink);
+
+  // std::ofstream of("pubkey.key");
+  // of.write(x.c_str(), x.size());
+
+  ndn::PublicKey key(PUBLIC_KEY, sizeof(PUBLIC_KEY));
+  CryptoPP::FileSink sink("pub2.key");
+  key.encode(sink);
+
+  // RSA::PublicKey p;
+  // StringSource source(T, sizeof(T), true);
+  // p.Load(source);
+  
+  // const Block &wire = i.wireEncode();
+  // BOOST_CHECK_EQUAL_COLLECTIONS(Interest1, Interest1+sizeof(Interest1),
+  //                              wire.begin(), wire.end());
+}
+
+// BOOST_AUTO_TEST_CASE (Decode)
+// {
+//   Block interestBlock(Interest1, sizeof(Interest1));
+  
+//   ndn::Interest i;
+//   BOOST_CHECK_NO_THROW(i.wireDecode(interestBlock));
+
+//   BOOST_CHECK_EQUAL(i.getName().toUri(), "/local/ndn/prefix");
+//   BOOST_CHECK_EQUAL(i.getScope(), 1);
+//   BOOST_CHECK_EQUAL(i.getInterestLifetime(), 1000);
+//   BOOST_CHECK_EQUAL(i.getMinSuffixComponents(), 1);
+//   BOOST_CHECK_EQUAL(i.getMaxSuffixComponents(), 1);
+//   BOOST_CHECK_EQUAL(i.getChildSelector(), 1);
+//   BOOST_CHECK_EQUAL(i.getMustBeFresh(), false);
+//   BOOST_CHECK_EQUAL(i.getExclude().toUri(), "alex,xxxx,*,yyyy");
+// }
+
+BOOST_AUTO_TEST_SUITE_END()
