diff --git a/src/ca-module.cpp b/src/ca-module.cpp
index 275e1f8..4398de7 100644
--- a/src/ca-module.cpp
+++ b/src/ca-module.cpp
@@ -149,12 +149,12 @@
   // process PROBE requests: find an available name
   std::string availableId;
   const auto& parameterTLV = request.getApplicationParameters();
+  parameterTLV.parse();
   if (!parameterTLV.hasValue()) {
     _LOG_ERROR("Empty TLV obtained from the Interest parameter.");
     return;
   }
   //std::string probeInfoStr = parameterJson.get(JSON_CLIENT_PROBE_INFO, "");
-  // TODO: m_probeHandler is never set
   if (m_config.m_probeHandler) {
     try {
       availableId = m_config.m_probeHandler(parameterTLV);
@@ -171,6 +171,7 @@
   Name newIdentityName = m_config.m_caName;
   newIdentityName.append(availableId);
   _LOG_TRACE("Handle PROBE: generate an identity " << newIdentityName);
+
   Block contentTLV = PROBE::encodeDataContent(newIdentityName.toUri(), m_config.m_probe, parameterTLV);
 
   Data result;
@@ -311,22 +312,20 @@
     return;
   }
 
-  // TODO: any simpler method?
-  bool isSucess;
-  Block paramTLV;
-  std::tie<bool, Block>(isSucess, paramTLV) =  Block::fromBuffer(paramTLVPayload.data(), paramTLVPayload.size());
+  Block paramTLV = makeBinaryBlock(tlv_encrypted_payload, paramTLVPayload.data(), paramTLVPayload.size());
+  paramTLV.parse();
 
   // load the corresponding challenge module
   std::string challengeType = readString(paramTLV.get(tlv_selected_challenge));
   auto challenge = ChallengeModule::createChallengeModule(challengeType);
 
-  Block contentTLV;
+  Block payload;
 
   if (challenge == nullptr) {
     _LOG_TRACE("Unrecognized challenge type " << challengeType);
     certRequest.m_status = STATUS_FAILURE;
     certRequest.m_challengeStatus = CHALLENGE_STATUS_UNKNOWN_CHALLENGE;
-    contentTLV = CHALLENGE::encodeDataPayload(certRequest);
+    payload = CHALLENGE::encodeDataPayload(certRequest);
   }
   else {
     _LOG_TRACE("CHALLENGE module to be load: " << challengeType);
@@ -335,7 +334,7 @@
     if (certRequest.m_status == STATUS_FAILURE) {
       // if challenge failed
       m_storage->deleteRequest(certRequest.m_requestId);
-      contentTLV = CHALLENGE::encodeDataPayload(certRequest);
+      payload = CHALLENGE::encodeDataPayload(certRequest);
       _LOG_TRACE("Challenge failed");
     }
     else if (certRequest.m_status == STATUS_PENDING) {
@@ -356,9 +355,10 @@
         m_config.m_statusUpdateCallback(certRequest);
       }
 
-      contentTLV = CHALLENGE::encodeDataPayload(certRequest);
-      contentTLV.push_back(makeNestedBlock(tlv_issued_cert_name, issuedCert.getName()));
-      contentTLV.parse();
+      payload = CHALLENGE::encodeDataPayload(certRequest);
+      payload.parse();
+      payload.push_back(makeNestedBlock(tlv_issued_cert_name, issuedCert.getName()));
+      payload.encode();
 
       //contentJson.add(JSON_CA_CERT_ID, readString(issuedCert.getName().at(-1)));
       _LOG_TRACE("Challenge succeeded. Certificate has been issued");
@@ -371,7 +371,7 @@
         _LOG_TRACE("Cannot update request instance: " << e.what());
         return;
       }
-      contentTLV = CHALLENGE::encodeDataPayload(certRequest);
+      payload = CHALLENGE::encodeDataPayload(certRequest);
       _LOG_TRACE("No failure no success. Challenge moves on");
     }
   }
@@ -381,9 +381,9 @@
   result.setFreshnessPeriod(DEFAULT_DATA_FRESHNESS_PERIOD);
 
   // encrypt the content
-  auto payload = contentTLV.getBuffer();
-  auto contentBlock = encodeBlockWithAesGcm128(tlv::Content, m_aesKey, payload->data(),
-                                               payload->size(), (uint8_t*)"test", strlen("test"));
+  auto payloadBuffer = payload.getBuffer();
+  auto contentBlock = encodeBlockWithAesGcm128(tlv::Content, m_aesKey, payloadBuffer->data(),
+                                               payloadBuffer->size(), (uint8_t*)"test", strlen("test"));
   result.setContent(contentBlock);
   m_keyChain.sign(result, signingByIdentity(m_config.m_caName));
   m_face.put(result);
diff --git a/src/challenge-module/challenge-credential.cpp b/src/challenge-module/challenge-credential.cpp
index a4ca557..16724bc 100644
--- a/src/challenge-module/challenge-credential.cpp
+++ b/src/challenge-module/challenge-credential.cpp
@@ -80,6 +80,7 @@
 void
 ChallengeCredential::handleChallengeRequest(const Block& params, CertificateRequest& request)
 {
+  params.parse();
   if (m_trustAnchors.empty()) {
     parseConfigFile();
   }
@@ -174,10 +175,8 @@
   else {
     _LOG_ERROR("Client's status and challenge status are wrong");
   }
-  request.parse();
+  request.encode();
   return request;
 }
-
-
 } // namespace ndncert
 } // namespace ndn
diff --git a/src/challenge-module/challenge-email.cpp b/src/challenge-module/challenge-email.cpp
index db069c8..4ec3c6f 100644
--- a/src/challenge-module/challenge-email.cpp
+++ b/src/challenge-module/challenge-email.cpp
@@ -50,6 +50,7 @@
 void
 ChallengeEmail::handleChallengeRequest(const Block& params, CertificateRequest& request)
 {
+  params.parse();
   auto currentTime = time::system_clock::now();
   if (request.m_challengeStatus == "") {
     // for the first time, init the challenge
@@ -200,7 +201,7 @@
   else {
     _LOG_ERROR("Client's status and challenge status are wrong");
   }
-  request.parse();
+  request.encode();
   return request;
 }
 
diff --git a/src/challenge-module/challenge-pin.cpp b/src/challenge-module/challenge-pin.cpp
index f31ca77..e809213 100644
--- a/src/challenge-module/challenge-pin.cpp
+++ b/src/challenge-module/challenge-pin.cpp
@@ -44,6 +44,7 @@
 void
 ChallengePin::handleChallengeRequest(const Block& params, CertificateRequest& request)
 {
+  params.parse();
   auto currentTime = time::system_clock::now();
   if (request.m_challengeStatus == "") {
     _LOG_TRACE("Challenge Interest arrives. Init the challenge");
@@ -172,7 +173,7 @@
   else {
     _LOG_ERROR("Client's status and challenge status are wrong");
   }
-  request.parse();
+  request.encode();
   return request;
 }
 } // namespace ndncert
diff --git a/src/client-config.cpp b/src/client-config.cpp
index 47115bb..2aab26c 100644
--- a/src/client-config.cpp
+++ b/src/client-config.cpp
@@ -102,28 +102,6 @@
   return item;
 }
 
-ClientCaItem
-ClientConfig::extractCaItem(const Block& contentBlock)
-{
-  ClientCaItem item;
-  item.m_caName = Name(readString(contentBlock.get(tlv_ca_prefix)));
-  if (item.m_caName.empty()) {
-    BOOST_THROW_EXCEPTION(Error("Cannot read ca-prefix from the config file"));
-  }
-  item.m_caInfo = readString(contentBlock.get(tlv_ca_info));
-  // item.m_probe = configSection.get("probe", "");
-
-  if (!contentBlock.get(tlv_ca_certificate).hasValue()) {
-    BOOST_THROW_EXCEPTION(Error("Cannot load the certificate from config file"));
-  }
-
-  security::v2::Certificate anchor;
-  anchor.wireDecode(contentBlock.get(tlv_ca_certificate));
-  item.m_anchor = anchor;
-
-  return item;
-}
-
 void
 ClientConfig::removeCaItem(const Name& caName)
 {
diff --git a/src/client-config.hpp b/src/client-config.hpp
index 876535d..0195c48 100644
--- a/src/client-config.hpp
+++ b/src/client-config.hpp
@@ -106,9 +106,6 @@
   static ClientCaItem
   extractCaItem(const JsonSection& configSection);
 
-  static ClientCaItem
-  extractCaItem(const Block& configSection);
-
 public:
   std::list<ClientCaItem> m_caItems;
   std::string m_localNdncertAnchor;
diff --git a/src/client-module.cpp b/src/client-module.cpp
index 7049961..adad5d9 100644
--- a/src/client-module.cpp
+++ b/src/client-module.cpp
@@ -123,6 +123,7 @@
   }
 
   auto contentTLV = reply.getContent();
+  contentTLV.parse();
 
   // read the available name and put it into the state
   if (contentTLV.get(tlv_probe_response).hasValue()) {
@@ -216,6 +217,7 @@
     return std::list<std::string>();
   }
   auto contentTLV = reply.getContent();
+  contentTLV.parse();
 
   // ECDH
   const auto& peerKeyBase64Str = readString(contentTLV.get(tlv_ecdh_pub));  
@@ -242,8 +244,9 @@
 shared_ptr<Interest>
 ClientModule::generateChallengeInterest(const Block& challengeRequest)
 {
+  challengeRequest.parse();
   m_challengeType = readString(challengeRequest.get(tlv_selected_challenge));
-  
+
   Name interestName = m_ca.m_caName;
   interestName.append("CA").append("CHALLENGE").append(m_requestId);
   auto interest = make_shared<Interest>(interestName);
@@ -251,8 +254,8 @@
   interest->setCanBePrefix(false);
 
   // encrypt the Interest parameters
-  auto payload = challengeRequest.getBuffer();
-  auto paramBlock = encodeBlockWithAesGcm128(tlv::ApplicationParameters, m_aesKey,
+  auto payload = challengeRequest.get(tlv_encrypted_payload).getBuffer();
+  auto paramBlock = encodeBlockWithAesGcm128(tlv_encrypted_payload, m_aesKey,
                                              payload->data(), payload->size(), (const uint8_t*)"test", strlen("test"));
   interest->setApplicationParameters(paramBlock);
 
@@ -268,10 +271,9 @@
     return;
   }
   auto result = decodeBlockWithAesGcm128(reply.getContent(), m_aesKey, (const uint8_t*)"test", strlen("test"));
-  bool isSuccess;
-  Block contentTLV;
 
-  std::tie<bool, Block>(isSuccess, contentTLV) = Block::fromBuffer(result.data(), result.size());
+  Block contentTLV = makeBinaryBlock(tlv_encrypted_payload, result.data(), result.size());
+  contentTLV.parse();
 
   // update state
   m_status = readNonNegativeInteger(contentTLV.get(tlv_status));
diff --git a/src/protocol-detail/challenge.cpp b/src/protocol-detail/challenge.cpp
index f1fed27..273e631 100644
--- a/src/protocol-detail/challenge.cpp
+++ b/src/protocol-detail/challenge.cpp
@@ -33,7 +33,7 @@
   makeStringBlock(tlv_challenge_status, request.m_challengeStatus);
   makeNonNegativeIntegerBlock(tlv_remaining_tries, request.m_remainingTries);
   makeNonNegativeIntegerBlock(tlv_remaining_time, request.m_remainingTime);
-  response.parse();
+  response.encode();
   return response;
 }
 
diff --git a/src/protocol-detail/info.cpp b/src/protocol-detail/info.cpp
index 1463e04..fb2cce5 100644
--- a/src/protocol-detail/info.cpp
+++ b/src/protocol-detail/info.cpp
@@ -41,7 +41,7 @@
   }
   content.push_back(makeNonNegativeIntegerBlock(tlv_max_validity_period, caConfig.m_maxValidityPeriod.count()));
   content.push_back(makeNestedBlock(tlv_ca_certificate, certificate));
-  content.parse();
+  content.encode();
   return content;
 }
 
diff --git a/src/protocol-detail/new.cpp b/src/protocol-detail/new.cpp
index 27bbf0a..20eaafb 100644
--- a/src/protocol-detail/new.cpp
+++ b/src/protocol-detail/new.cpp
@@ -50,7 +50,7 @@
 
   request.push_back(makeStringBlock(tlv_ecdh_pub, ecdhPub));
   request.push_back(makeNestedBlock(tlv_cert_request, certRequest));
-  request.parse();
+  request.encode();
   return request;
 }
 
@@ -67,7 +67,7 @@
   for (const auto& entry: challenges) {
     response.push_back(makeStringBlock(tlv_challenge, entry));
   }
-  response.parse();
+  response.encode();
   return response;
 }
 
diff --git a/src/protocol-detail/probe.cpp b/src/protocol-detail/probe.cpp
index b8034b1..f8a561d 100644
--- a/src/protocol-detail/probe.cpp
+++ b/src/protocol-detail/probe.cpp
@@ -62,7 +62,7 @@
         makeStringBlock(tlv_parameter_value, arguments.at(i))
       );
   }
-  content.parse();
+  content.encode();
   return content;
 }
 
@@ -91,7 +91,7 @@
 
   // TODO: Must be determined based on CA config
   content.push_back(makeEmptyBlock(tlv_allow_longer_name));
-  content.parse();
+  content.encode();
   return content;
 }
 
diff --git a/tests/unit-tests/ca-module.t.cpp b/tests/unit-tests/ca-module.t.cpp
index 81a5916..13abf4b 100644
--- a/tests/unit-tests/ca-module.t.cpp
+++ b/tests/unit-tests/ca-module.t.cpp
@@ -40,7 +40,7 @@
 {
   util::DummyClientFace face(io, {true, true});
   CaModule ca(face, m_keyChain, "tests/unit-tests/ca.conf.test", "ca-storage-memory");
-  BOOST_CHECK_EQUAL(ca.getCaConf().m_caName, "/ndn");
+  BOOST_CHECK_EQUAL(ca.getCaConf().m_caPrefix, "/ndn");
 
   auto identity = addIdentity(Name("/ndn/site2"));
   auto key = identity.getDefaultKey();
@@ -61,23 +61,27 @@
 
   util::DummyClientFace face(io, {true, true});
   CaModule ca(face, m_keyChain, "tests/unit-tests/ca.conf.test", "ca-storage-memory");
-  ca.setProbeHandler([&] (const JsonSection& probeInfo) {
+  ca.setProbeHandler([&] (const Block& probeInfo) {
       return "example";
     });
   advanceClocks(time::milliseconds(20), 60);
 
   Interest interest("/ndn/CA/PROBE");
   interest.setCanBePrefix(false);
-  JsonSection paramJson;
-  paramJson.add(JSON_CLIENT_PROBE_INFO, "zhiyi");
-  interest.setApplicationParameters(ClientModule::paramFromJson(paramJson));
+
+  Block paramTLV = makeEmptyBlock(tlv::ApplicationParameters);
+  paramTLV.push_back(makeStringBlock(tlv_parameter_key, JSON_CLIENT_PROBE_INFO));
+  paramTLV.push_back(makeStringBlock(tlv_parameter_value, "zhiyi"));
+  paramTLV.encode();
+  interest.setApplicationParameters(paramTLV);
 
   int count = 0;
   face.onSendData.connect([&] (const Data& response) {
       count++;
       BOOST_CHECK(security::verifySignature(response, cert));
-      auto contentJson = ClientModule::getJsonFromData(response);
-      BOOST_CHECK_EQUAL(contentJson.get<std::string>(JSON_CA_NAME), "/ndn/example");
+      Block contentBlock = response.getContent();
+      contentBlock.parse();
+      BOOST_CHECK_EQUAL(readString(contentBlock.get(tlv_ca_prefix)), "/ndn/example");
     });
   face.receive(interest);
 
@@ -93,7 +97,7 @@
 
   util::DummyClientFace face(io, {true, true});
   CaModule ca(face, m_keyChain, "tests/unit-tests/ca.conf.test", "ca-storage-memory");
-  ca.setProbeHandler([&] (const JsonSection& probeInfo) {
+  ca.setProbeHandler([&] (const Block& probeInfo) {
       return "example";
     });
   advanceClocks(time::milliseconds(20), 60);
@@ -287,7 +291,7 @@
       auto contentJson = ClientModule::getJsonFromData(response);
       client.onNewResponse(response);
       auto paramJson = pinChallenge.getRequirementForChallenge(client.m_status, client.m_challengeStatus);
-      challengeInterest = client.generateChallengeInterest(pinChallenge.genChallengeRequestJson(client.m_status,
+      challengeInterest = client.generateChallengeInterest(pinChallenge.genChallengeRequestTLV(client.m_status,
                                                                                                 client.m_challengeStatus,
                                                                                                 paramJson));
     }
@@ -300,7 +304,7 @@
       BOOST_CHECK_EQUAL(client.m_challengeStatus, ChallengePin::NEED_CODE);
 
       auto paramJson = pinChallenge.getRequirementForChallenge(client.m_status, client.m_challengeStatus);
-      challengeInterest2 = client.generateChallengeInterest(pinChallenge.genChallengeRequestJson(client.m_status,
+      challengeInterest2 = client.generateChallengeInterest(pinChallenge.genChallengeRequestTLV(client.m_status,
                                                                                                  client.m_challengeStatus,
                                                                                                  paramJson));
     }
@@ -319,7 +323,7 @@
         if (i.first == ChallengePin::JSON_PIN_CODE)
           i.second.put("", secret);
       }
-      challengeInterest3 = client.generateChallengeInterest(pinChallenge.genChallengeRequestJson(client.m_status,
+      challengeInterest3 = client.generateChallengeInterest(pinChallenge.genChallengeRequestTLV(client.m_status,
                                                                                                  client.m_challengeStatus,
                                                                                                  paramJson));
     }
diff --git a/tests/unit-tests/challenge-credential.t.cpp b/tests/unit-tests/challenge-credential.t.cpp
index 2455e73..9072fa0 100644
--- a/tests/unit-tests/challenge-credential.t.cpp
+++ b/tests/unit-tests/challenge-credential.t.cpp
@@ -78,19 +78,22 @@
   ss.str("");
   ss.clear();
 
-  JsonSection params;
   io::save<security::v2::Certificate>(selfSigned, ss);
   std::string selfSignedStr = ss.str();
-  params.add(ChallengeCredential::JSON_CREDENTIAL_SELF, selfSignedStr);
   ss.str("");
   ss.clear();
 
   io::save<security::v2::Certificate>(certB, ss);
   std::string credentialStr = ss.str();
-  params.add(ChallengeCredential::JSON_CREDENTIAL_CERT, credentialStr);
   ss.str("");
   ss.clear();
 
+  Block params = makeEmptyBlock(tlv_encrypted_payload);
+  params.push_back(makeStringBlock(tlv_parameter_key, ChallengeCredential::JSON_CREDENTIAL_SELF));
+  params.push_back(makeStringBlock(tlv_parameter_value, selfSignedStr));
+  params.push_back(makeStringBlock(tlv_parameter_key, ChallengeCredential::JSON_CREDENTIAL_CERT));
+  params.push_back(makeStringBlock(tlv_parameter_value, credentialStr));
+
   challenge.handleChallengeRequest(params, request);
   BOOST_CHECK_EQUAL(request.m_status, STATUS_PENDING);
   BOOST_CHECK_EQUAL(request.m_challengeStatus, CHALLENGE_STATUS_SUCCESS);
diff --git a/tests/unit-tests/challenge-email.t.cpp b/tests/unit-tests/challenge-email.t.cpp
index 398df97..834411d 100644
--- a/tests/unit-tests/challenge-email.t.cpp
+++ b/tests/unit-tests/challenge-email.t.cpp
@@ -48,11 +48,12 @@
   auto cert = key.getDefaultCertificate();
   CertificateRequest request(Name("/ndn/site1"), "123", STATUS_BEFORE_CHALLENGE, cert);
 
-  JsonSection emailJson;
-  emailJson.put(ChallengeEmail::JSON_EMAIL, "zhiyi@cs.ucla.edu");
+  Block paramTLV = makeEmptyBlock(tlv_encrypted_payload);
+  paramTLV.push_back(makeStringBlock(tlv_parameter_key, ChallengeEmail::JSON_EMAIL));
+  paramTLV.push_back(makeStringBlock(tlv_parameter_value, "zhiyi@cs.ucla.edu"));
 
   ChallengeEmail challenge("./tests/unit-tests/test-send-email.sh");
-  challenge.handleChallengeRequest(emailJson, request);
+  challenge.handleChallengeRequest(paramTLV, request);
 
   BOOST_CHECK_EQUAL(request.m_status, STATUS_CHALLENGE);
   BOOST_CHECK_EQUAL(request.m_challengeStatus, ChallengeEmail::NEED_CODE);
@@ -97,11 +98,12 @@
   auto cert = key.getDefaultCertificate();
   CertificateRequest request(Name("/ndn/site1"), "123", STATUS_BEFORE_CHALLENGE, cert);
 
-  JsonSection emailJson;
-  emailJson.put(ChallengeEmail::JSON_EMAIL, "zhiyi@cs");
+  Block paramTLV = makeEmptyBlock(tlv_encrypted_payload);
+  paramTLV.push_back(makeStringBlock(tlv_parameter_key, ChallengeEmail::JSON_EMAIL));
+  paramTLV.push_back(makeStringBlock(tlv_parameter_value, "zhiyi@cs"));
 
   ChallengeEmail challenge;
-  challenge.handleChallengeRequest(emailJson, request);
+  challenge.handleChallengeRequest(paramTLV, request);
 
   BOOST_CHECK_EQUAL(request.m_challengeStatus, ChallengeEmail::FAILURE_INVALID_EMAIL);
   BOOST_CHECK_EQUAL(request.m_status, STATUS_FAILURE);
@@ -117,11 +119,12 @@
   CertificateRequest request(Name("/ndn/site1"), "123", STATUS_CHALLENGE, ChallengeEmail::NEED_CODE,
                              "Email", time::toIsoString(time::system_clock::now()), 3600, 3, json, cert);
 
-  JsonSection requestJson;
-  requestJson.put(ChallengeEmail::JSON_CODE, "4567");
+  Block paramTLV = makeEmptyBlock(tlv_encrypted_payload);
+  paramTLV.push_back(makeStringBlock(tlv_parameter_key, ChallengeEmail::JSON_CODE));
+  paramTLV.push_back(makeStringBlock(tlv_parameter_value, "4567"));
 
   ChallengeEmail challenge;
-  challenge.handleChallengeRequest(requestJson, request);
+  challenge.handleChallengeRequest(paramTLV, request);
 
   BOOST_CHECK_EQUAL(request.m_challengeStatus, CHALLENGE_STATUS_SUCCESS);
   BOOST_CHECK_EQUAL(request.m_status, STATUS_PENDING);
@@ -138,11 +141,12 @@
   CertificateRequest request(Name("/ndn/site1"), "123", STATUS_CHALLENGE, ChallengeEmail::NEED_CODE,
                              "email", time::toIsoString(time::system_clock::now()), 3600, 3, json, cert);
 
-  JsonSection requestJson;
-  requestJson.put(ChallengeEmail::JSON_CODE, "7890");
+  Block paramTLV = makeEmptyBlock(tlv_encrypted_payload);
+  paramTLV.push_back(makeStringBlock(tlv_parameter_key, ChallengeEmail::JSON_CODE));
+  paramTLV.push_back(makeStringBlock(tlv_parameter_value, "7890"));
 
   ChallengeEmail challenge;
-  challenge.handleChallengeRequest(requestJson, request);
+  challenge.handleChallengeRequest(paramTLV, request);
 
   BOOST_CHECK_EQUAL(request.m_challengeStatus, ChallengeEmail::WRONG_CODE);
   BOOST_CHECK_EQUAL(request.m_status, STATUS_CHALLENGE);
diff --git a/tests/unit-tests/challenge-pin.t.cpp b/tests/unit-tests/challenge-pin.t.cpp
index adac6b9..81ee1e1 100644
--- a/tests/unit-tests/challenge-pin.t.cpp
+++ b/tests/unit-tests/challenge-pin.t.cpp
@@ -42,7 +42,7 @@
   CertificateRequest request(Name("/ndn/site1"), "123", STATUS_BEFORE_CHALLENGE, cert);
 
   ChallengePin challenge;
-  challenge.handleChallengeRequest(JsonSection(), request);
+  challenge.handleChallengeRequest(makeEmptyBlock(tlv_encrypted_payload), request);
 
   BOOST_CHECK_EQUAL(request.m_status, STATUS_CHALLENGE);
   BOOST_CHECK_EQUAL(request.m_challengeStatus, ChallengePin::NEED_CODE);
@@ -59,11 +59,12 @@
   CertificateRequest request(Name("/ndn/site1"), "123", STATUS_CHALLENGE, ChallengePin::NEED_CODE, "pin",
                              time::toIsoString(time::system_clock::now()), 3600, 3, secret, cert);
 
-  JsonSection paramJson;
-  paramJson.put(ChallengePin::JSON_PIN_CODE, "12345");
+  Block paramTLV = makeEmptyBlock(tlv_encrypted_payload);
+  paramTLV.push_back(makeStringBlock(tlv_parameter_key, ChallengePin::JSON_PIN_CODE));
+  paramTLV.push_back(makeStringBlock(tlv_parameter_value, "12345"));
 
   ChallengePin challenge;
-  challenge.handleChallengeRequest(paramJson, request);
+  challenge.handleChallengeRequest(paramTLV, request);
 
   BOOST_CHECK_EQUAL(request.m_status, STATUS_PENDING);
   BOOST_CHECK_EQUAL(request.m_challengeStatus, CHALLENGE_STATUS_SUCCESS);
@@ -80,11 +81,12 @@
   CertificateRequest request(Name("/ndn/site1"), "123", STATUS_CHALLENGE, ChallengePin::NEED_CODE, "pin",
                              time::toIsoString(time::system_clock::now()), 3600, 3, secret, cert);
 
-  JsonSection paramJson;
-  paramJson.put(ChallengePin::JSON_PIN_CODE, "45678");
+  Block paramTLV = makeEmptyBlock(tlv_encrypted_payload);
+  paramTLV.push_back(makeStringBlock(tlv_parameter_key, ChallengePin::JSON_PIN_CODE));
+  paramTLV.push_back(makeStringBlock(tlv_parameter_value, "45678"));
 
   ChallengePin challenge;
-  challenge.handleChallengeRequest(paramJson, request);
+  challenge.handleChallengeRequest(paramTLV, request);
 
   BOOST_CHECK_EQUAL(request.m_status, STATUS_CHALLENGE);
   BOOST_CHECK_EQUAL(request.m_challengeStatus, ChallengePin::WRONG_CODE);
