remove probeToken

Change-Id: I8364a9db6c525eb7f6420d4a5520e28e3635449b
diff --git a/src/ca-detail/ca-sqlite.cpp b/src/ca-detail/ca-sqlite.cpp
index e5bca2f..941b8b0 100644
--- a/src/ca-detail/ca-sqlite.cpp
+++ b/src/ca-detail/ca-sqlite.cpp
@@ -137,10 +137,6 @@
     CertificateRequest request(caName, requestId, requestType, status, challengeStatus, challengeType,
                               challengeTp, remainingTime, remainingTries,
                               convertString2Json(challengeSecrets), cert);
-    if (statement.getSize(13) != 0) {
-      shared_ptr<Data> probeToken = make_shared<Data>(statement.getBlock(13));
-      request.setProbeToken(probeToken);
-    }
     return request;
   }
   else {
@@ -169,56 +165,28 @@
     return;
   }
 
-  if (request.m_probeToken != nullptr) {
-    Sqlite3Statement statement(
-        m_database,
-        R"_SQLTEXT_(INSERT INTO CertRequests (request_id, ca_name, status,
-                    challenge_status, cert_key_name, cert_request, challenge_type, challenge_secrets,
-                    challenge_tp, remaining_tries, remaining_time, request_type, probe_token)
-                    values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?))_SQLTEXT_");
-    statement.bind(1, request.m_requestId, SQLITE_TRANSIENT);
-    statement.bind(2, request.m_caPrefix.wireEncode(), SQLITE_TRANSIENT);
-    statement.bind(3, static_cast<int>(request.m_status));
-    statement.bind(4, request.m_challengeStatus, SQLITE_TRANSIENT);
-    statement.bind(5, request.m_cert.getKeyName().wireEncode(),
-                   SQLITE_TRANSIENT);
-    statement.bind(6, request.m_cert.wireEncode(), SQLITE_TRANSIENT);
-    statement.bind(7, request.m_challengeType, SQLITE_TRANSIENT);
-    statement.bind(8, convertJson2String(request.m_challengeSecrets),
-                   SQLITE_TRANSIENT);
-    statement.bind(9, request.m_challengeTp, SQLITE_TRANSIENT);
-    statement.bind(10, request.m_remainingTries);
-    statement.bind(11, request.m_remainingTime);
-    statement.bind(12, static_cast<int>(request.m_requestType));
-    statement.bind(13, request.m_probeToken->wireEncode(), SQLITE_TRANSIENT);
-    if (statement.step() != SQLITE_DONE) {
-      BOOST_THROW_EXCEPTION(Error("Request " + request.m_requestId + " cannot be added to database"));
-    }
-  }
-  else {
-    Sqlite3Statement statement(
-        m_database,
-        R"_SQLTEXT_(INSERT INTO CertRequests (request_id, ca_name, status,
-                    challenge_status, cert_key_name, cert_request, challenge_type, challenge_secrets,
-                    challenge_tp, remaining_tries, remaining_time, request_type)
-                    values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?))_SQLTEXT_");
-    statement.bind(1, request.m_requestId, SQLITE_TRANSIENT);
-    statement.bind(2, request.m_caPrefix.wireEncode(), SQLITE_TRANSIENT);
-    statement.bind(3, static_cast<int>(request.m_status));
-    statement.bind(4, request.m_challengeStatus, SQLITE_TRANSIENT);
-    statement.bind(5, request.m_cert.getKeyName().wireEncode(),
-                   SQLITE_TRANSIENT);
-    statement.bind(6, request.m_cert.wireEncode(), SQLITE_TRANSIENT);
-    statement.bind(7, request.m_challengeType, SQLITE_TRANSIENT);
-    statement.bind(8, convertJson2String(request.m_challengeSecrets),
-                   SQLITE_TRANSIENT);
-    statement.bind(9, request.m_challengeTp, SQLITE_TRANSIENT);
-    statement.bind(10, request.m_remainingTries);
-    statement.bind(11, request.m_remainingTime);
-    statement.bind(12, static_cast<int>(request.m_requestType));
-    if (statement.step() != SQLITE_DONE) {
-      BOOST_THROW_EXCEPTION(Error("Request " + request.m_requestId + " cannot be added to database"));
-    }
+  Sqlite3Statement statement(
+      m_database,
+      R"_SQLTEXT_(INSERT INTO CertRequests (request_id, ca_name, status,
+                  challenge_status, cert_key_name, cert_request, challenge_type, challenge_secrets,
+                  challenge_tp, remaining_tries, remaining_time, request_type)
+                  values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?))_SQLTEXT_");
+  statement.bind(1, request.m_requestId, SQLITE_TRANSIENT);
+  statement.bind(2, request.m_caPrefix.wireEncode(), SQLITE_TRANSIENT);
+  statement.bind(3, static_cast<int>(request.m_status));
+  statement.bind(4, request.m_challengeStatus, SQLITE_TRANSIENT);
+  statement.bind(5, request.m_cert.getKeyName().wireEncode(),
+                  SQLITE_TRANSIENT);
+  statement.bind(6, request.m_cert.wireEncode(), SQLITE_TRANSIENT);
+  statement.bind(7, request.m_challengeType, SQLITE_TRANSIENT);
+  statement.bind(8, convertJson2String(request.m_challengeSecrets),
+                  SQLITE_TRANSIENT);
+  statement.bind(9, request.m_challengeTp, SQLITE_TRANSIENT);
+  statement.bind(10, request.m_remainingTries);
+  statement.bind(11, request.m_remainingTime);
+  statement.bind(12, static_cast<int>(request.m_requestType));
+  if (statement.step() != SQLITE_DONE) {
+    BOOST_THROW_EXCEPTION(Error("Request " + request.m_requestId + " cannot be added to database"));
   }
 }
 
diff --git a/src/certificate-request.cpp b/src/certificate-request.cpp
index 15b1fb2..be1ccb5 100644
--- a/src/certificate-request.cpp
+++ b/src/certificate-request.cpp
@@ -54,12 +54,6 @@
 {
 }
 
-void
-CertificateRequest::setProbeToken(const shared_ptr<Data>& probeToken)
-{
-  m_probeToken = probeToken;
-}
-
 std::ostream&
 operator<<(std::ostream& os, const CertificateRequest& request)
 {
diff --git a/src/certificate-request.hpp b/src/certificate-request.hpp
index 55b90c8..b377587 100644
--- a/src/certificate-request.hpp
+++ b/src/certificate-request.hpp
@@ -49,16 +49,12 @@
                      const std::string& challengeTp, int remainingTime, int remainingTries,
                      const JsonSection& challengeSecrets, const security::v2::Certificate& cert);
 
-  void
-  setProbeToken(const std::shared_ptr<Data>& probeToken);
-
 public:
   Name m_caPrefix;
   std::string m_requestId = "";
   RequestType m_requestType = RequestType::NOTINITIALIZED;
   Status m_status = Status::NOT_STARTED;
   security::v2::Certificate m_cert;
-  std::shared_ptr<Data> m_probeToken = nullptr;
 
   std::string m_challengeStatus = "";
   std::string m_challengeType = "";
diff --git a/src/client-module.cpp b/src/client-module.cpp
index 96d4dfe..e83e8cb 100644
--- a/src/client-module.cpp
+++ b/src/client-module.cpp
@@ -141,7 +141,7 @@
 shared_ptr<Interest>
 ClientModule::generateNewInterest(const time::system_clock::TimePoint& notBefore,
                                   const time::system_clock::TimePoint& notAfter,
-                                  const Name& identityName, const shared_ptr<Data>& probeToken)
+                                  const Name& identityName)
 {
   // Name requestedName = identityName;
   if (!identityName.empty()) {  // if identityName is not empty, find the corresponding CA
@@ -204,7 +204,7 @@
   interest->setMustBeFresh(true);
   interest->setCanBePrefix(false);
   interest->setApplicationParameters(
-      NEW::encodeApplicationParameters(m_ecdh.getBase64PubKey(), certRequest, probeToken));
+      NEW::encodeApplicationParameters(m_ecdh.getBase64PubKey(), certRequest));
 
   // sign the Interest packet
   m_keyChain.sign(*interest, signingByKey(m_key.getName()));
diff --git a/src/client-module.hpp b/src/client-module.hpp
index e75e190..47a5f63 100644
--- a/src/client-module.hpp
+++ b/src/client-module.hpp
@@ -91,7 +91,7 @@
   shared_ptr<Interest>
   generateNewInterest(const time::system_clock::TimePoint& notBefore,
                       const time::system_clock::TimePoint& notAfter,
-                      const Name& identityName = Name(), const shared_ptr<Data>& probeToken = nullptr);
+                      const Name& identityName = Name());
 
   shared_ptr<Interest>
   generateRevokeInterest(const security::v2::Certificate& certificate);
diff --git a/src/protocol-detail/new.cpp b/src/protocol-detail/new.cpp
index 0c33ba8..05c7f5c 100644
--- a/src/protocol-detail/new.cpp
+++ b/src/protocol-detail/new.cpp
@@ -33,8 +33,7 @@
 _LOG_INIT(ndncert.client);
 
 Block
-NEW::encodeApplicationParameters(const std::string& ecdhPub, const security::v2::Certificate& certRequest,
-                                const shared_ptr<Data>& probeToken)
+NEW::encodeApplicationParameters(const std::string& ecdhPub, const security::v2::Certificate& certRequest)
 {
   Block request = makeEmptyBlock(tlv::ApplicationParameters);
   std::stringstream ss;
diff --git a/src/protocol-detail/new.hpp b/src/protocol-detail/new.hpp
index ee141d7..63bec73 100644
--- a/src/protocol-detail/new.hpp
+++ b/src/protocol-detail/new.hpp
@@ -36,8 +36,7 @@
    * For client side use.
    */
   static Block
-  encodeApplicationParameters(const std::string& ecdhPub, const security::v2::Certificate& certRequest,
-                              const shared_ptr<Data>& probeToken);
+  encodeApplicationParameters(const std::string& ecdhPub, const security::v2::Certificate& certRequest);
 
   /**
    * Encode CA's response of NEW Interest into a content TLV for NEW Data packet.
diff --git a/tests/unit-tests/ca-module.t.cpp b/tests/unit-tests/ca-module.t.cpp
index ec4c779..7a7d3dd 100644
--- a/tests/unit-tests/ca-module.t.cpp
+++ b/tests/unit-tests/ca-module.t.cpp
@@ -247,40 +247,6 @@
   advanceClocks(time::milliseconds(20), 60);
 }
 
-BOOST_AUTO_TEST_CASE(HandleNewWithProbeToken)
-{
-  auto identity = addIdentity(Name("/ndn"));
-  auto key = identity.getDefaultKey();
-  auto cert = key.getDefaultCertificate();
-
-  util::DummyClientFace face(io, m_keyChain, {true, true});
-  CaModule ca(face, m_keyChain, "tests/unit-tests/ca.conf.test", "ca-storage-memory");
-  advanceClocks(time::milliseconds(20), 60);
-
-  ClientModule client(m_keyChain);
-  ClientCaItem item;
-  item.m_caPrefix = Name("/ndn");
-  item.m_anchor = cert;
-  client.getClientConf().m_caItems.push_back(item);
-
-  auto data = make_shared<Data>(Name("/ndn/CA/PROBE/123"));
-  m_keyChain.sign(*data, signingByIdentity(ca.m_config.m_caPrefix));
-
-  auto interest = client.generateNewInterest(time::system_clock::now(),
-                                             time::system_clock::now() + time::days(1),
-                                             Name("/ndn/zhiyi"), data);
-
-  int count = 0;
-  face.onSendData.connect([&](const Data& response) {
-    count++;
-    BOOST_CHECK(security::verifySignature(response, cert));
-  });
-  face.receive(*interest);
-
-  advanceClocks(time::milliseconds(20), 60);
-  BOOST_CHECK_EQUAL(count, 1);
-}
-
 BOOST_AUTO_TEST_CASE(HandleNewWithLongSuffix)
 {
   auto identity = addIdentity(Name("/ndn"));
diff --git a/tools/ndncert-client.cpp b/tools/ndncert-client.cpp
index 2266a25..73ae8c3 100644
--- a/tools/ndncert-client.cpp
+++ b/tools/ndncert-client.cpp
@@ -235,10 +235,9 @@
     std::cerr << "Invalid period time. Exit." << std::endl;
     return;
   }
-  auto probeToken = make_shared<Data>(reply);
   auto now = time::system_clock::now();
   std::cerr << "The validity period of your certificate will be: " << validityPeriod << " hours" << std::endl;
-  auto interest = client.generateNewInterest(now, now + time::hours(validityPeriod), Name(), probeToken);
+  auto interest = client.generateNewInterest(now, now + time::hours(validityPeriod), Name());
   if (interest != nullptr) {
     face.expressInterest(*interest, bind(&newCb, _2), bind(&onNackCb), bind(&timeoutCb));
   }