working on TLV encoding
diff --git a/src/ca-module.cpp b/src/ca-module.cpp
index 56ab7e2..be44e11 100644
--- a/src/ca-module.cpp
+++ b/src/ca-module.cpp
@@ -22,6 +22,7 @@
 #include "challenge-module.hpp"
 #include "logging.hpp"
 #include "crypto-support/enc-tlv.hpp"
+#include "tlv.hpp"
 #include <ndn-cxx/util/io.hpp>
 #include <ndn-cxx/security/verification-helpers.hpp>
 #include <ndn-cxx/security/signing-helpers.hpp>
@@ -119,11 +120,11 @@
 CaModule::onInfo(const Interest& request)
 {
   _LOG_TRACE("Received INFO request");
-  JsonSection contentJson = genInfoResponseJson();
+  Block contentTLV = genInfoResponseTLV();
   Data result;
 
   result.setName(request.getName());
-  result.setContent(dataContentFromJson(contentJson));
+  result.setContent(contentTLV);
   result.setFreshnessPeriod(DEFAULT_DATA_FRESHNESS_PERIOD);
 
   m_keyChain.sign(result, signingByIdentity(m_config.m_caName));
@@ -551,6 +552,46 @@
   return root;
 }
 
+Block
+CaModule::genInfoResponseTLV()
+{
+  Block response;
+  // ca-prefix
+  Name caName = m_config.m_caName;
+  // response = makeStringBlock(CAPrefix, caName.toUri());
+  response = makeNestedBlock(CAPrefix, caName);
+
+  // ca-info
+  const auto& pib = m_keyChain.getPib();
+  const auto& identity = pib.getIdentity(m_config.m_caName);
+  const auto& cert = identity.getDefaultKey().getDefaultCertificate();
+  std::string caInfo = "";
+  if (m_config.m_caInfo == "") {
+    caInfo = "Issued by " + cert.getSignature().getKeyLocator().getName().toUri();
+  }
+  else {
+    caInfo = m_config.m_caInfo;
+  }
+
+  response.push_back(makeStringBlock(CAInfo, caInfo));
+
+
+  // parameter-key (Not implemented yet)
+  for() {
+    response.push_back(makeStringBlock(ParameterKey, ""));
+  }
+
+  // TODO: need to convert from days to seconds
+  response.push_back(makeNonNegativeIntegerBlock(MaxValidityPeriod, m_validityPeriod));
+
+  // certificate
+  response.push_back(makeNestedBlock(CACertificate, cert));
+  response.parse();
+
+  return response;
+}
+
+
 JsonSection
 CaModule::genNewResponseJson(const std::string& ecdhKey, const std::string& salt,
                              const CertificateRequest& request,
diff --git a/src/client-config.cpp b/src/client-config.cpp
index 589cd49..9273760 100644
--- a/src/client-config.cpp
+++ b/src/client-config.cpp
@@ -19,6 +19,7 @@
  */
 
 #include "client-config.hpp"
+#include "tlv.hpp"
 
 #include <ndn-cxx/util/io.hpp>
 #include <fstream>
@@ -83,17 +84,21 @@
 }
 
 ClientCaItem
-ClientConfig::extractCaItem(const JsonSection& configSection)
+ClientConfig::extractCaItem(const Block& contentBlock)
 {
   ClientCaItem item;
-  item.m_caName = Name(configSection.get("ca-prefix", ""));
+  item.m_caName = Name(readString(contentBlock.get(CAPrefix)));
   if (item.m_caName.empty()) {
     BOOST_THROW_EXCEPTION(Error("Cannot read ca-prefix from the config file"));
   }
-  item.m_caInfo = configSection.get("ca-info", "");
-  item.m_probe = configSection.get("probe", "");
-  std::istringstream ss(configSection.get("certificate", ""));
-  auto anchor = io::load<security::v2::Certificate>(ss);
+  item.m_caInfo = readString(contentBlock.get(CAInfo));
+  // item.m_probe = configSection.get("probe", "");
+
+  security::v2::Certificate anchor = contentBlock.get(CACertificate);
+
+  //std::istringstream ss(configSection.get("certificate", ""));
+  //auto anchor = io::load<security::v2::Certificate>(ss);
+
   if (anchor == nullptr) {
     BOOST_THROW_EXCEPTION(Error("Cannot load the certificate from config file"));
   }
diff --git a/src/client-module.cpp b/src/client-module.cpp
index bf0ce20..1789632 100644
--- a/src/client-module.cpp
+++ b/src/client-module.cpp
@@ -59,11 +59,10 @@
 }
 
 bool
-ClientModule::verifyProbeInfoResponse(const Data& reply)
+ClientModule::verifyProbeInfoResponse(const Block& contentBlock)
 {
   // parse the ca item
-  auto contentJson = getJsonFromData(reply);
-  auto caItem = ClientConfig::extractCaItem(contentJson);
+  auto caItem = ClientConfig::extractCaItem(contentBlock);
 
   // verify the probe Data's sig
   if (!security::verifySignature(reply, caItem.m_anchor)) {
@@ -76,9 +75,10 @@
 void
 ClientModule::addCaFromProbeInfoResponse(const Data& reply)
 {
+  const Block& contentBlock = reply.getContent();
+
   // parse the ca item
-  auto contentJson = getJsonFromData(reply);
-  auto caItem = ClientConfig::extractCaItem(contentJson);
+  auto caItem = ClientConfig::extractCaItem(contentBlock);
 
   // update the local config
   bool findItem = false;