Update CaConfig and ClientCaItem. Add INFO packet encoding and decoding.

Change-Id: I2118bfee05640ddbf20643fa07bf4c91eb7ebd06
diff --git a/tests/unit-tests/ca-config.t.cpp b/tests/unit-tests/ca-config.t.cpp
index 5b47505..0de626b 100644
--- a/tests/unit-tests/ca-config.t.cpp
+++ b/tests/unit-tests/ca-config.t.cpp
@@ -19,7 +19,7 @@
  */
 
 #include "ca-config.hpp"
-
+#include "protocol-detail/info.hpp"
 #include "identity-management-fixture.hpp"
 
 #include <ndn-cxx/security/transform/base64-encode.hpp>
@@ -36,11 +36,13 @@
 {
   CaConfig config;
   config.load("tests/unit-tests/ca.conf.test");
-  BOOST_CHECK_EQUAL(config.m_caName, "/ndn");
-  BOOST_CHECK_EQUAL(config.m_freshnessPeriod, time::seconds(720));
-  BOOST_CHECK_EQUAL(config.m_validityPeriod, time::days(360));
-  BOOST_CHECK_EQUAL(config.m_probe, "");
+  BOOST_CHECK_EQUAL(config.m_caPrefix, "/ndn");
   BOOST_CHECK_EQUAL(config.m_caInfo, "ndn testbed ca");
+  BOOST_CHECK_EQUAL(config.m_maxValidityPeriod, time::seconds(86400));
+  BOOST_CHECK_EQUAL(config.m_probeParameterKeys.size(), 1);
+  BOOST_CHECK_EQUAL(config.m_probeParameterKeys.front(), "full name");
+  BOOST_CHECK_EQUAL(config.m_supportedChallenges.size(), 1);
+  BOOST_CHECK_EQUAL(config.m_supportedChallenges.front(), "pin");
 }
 
 BOOST_AUTO_TEST_CASE(ReadNonexistConfigFile)
@@ -61,6 +63,23 @@
   BOOST_CHECK_THROW(config.load("tests/unit-tests/ca.conf.test3"), CaConfig::Error);
 }
 
+BOOST_AUTO_TEST_CASE(InfoContentEncodingDecoding)
+{
+  CaConfig config;
+  config.load("tests/unit-tests/ca.conf.test");
+
+  const auto& identity = addIdentity("/test");
+  const auto& cert = identity.getDefaultKey().getDefaultCertificate();
+  auto encoded = INFO::encodeContentFromCAConfig(config, cert);
+  auto decoded = INFO::decodeClientConfigFromContent(encoded);
+  BOOST_CHECK_EQUAL(config.m_caPrefix, decoded.m_caPrefix);
+  BOOST_CHECK_EQUAL(config.m_caInfo, decoded.m_caInfo);
+  BOOST_CHECK_EQUAL(config.m_maxValidityPeriod, decoded.m_maxValidityPeriod);
+  BOOST_CHECK_EQUAL(config.m_probeParameterKeys.size(), decoded.m_probeParameterKeys.size());
+  BOOST_CHECK_EQUAL(config.m_probeParameterKeys.front(), decoded.m_probeParameterKeys.front());
+  BOOST_CHECK_EQUAL(cert.wireEncode(), decoded.m_anchor.wireEncode());
+}
+
 BOOST_AUTO_TEST_SUITE_END() // TestCaConfig
 
 } // namespace tests
diff --git a/tests/unit-tests/ca.conf.test b/tests/unit-tests/ca.conf.test
index 8acd23c..f742a2b 100644
--- a/tests/unit-tests/ca.conf.test
+++ b/tests/unit-tests/ca.conf.test
@@ -1,10 +1,13 @@
 {
   "ca-prefix": "/ndn",
-  "issuing-freshness": "720",
-  "validity-period": "360",
+  "max-validity-period": "86400",
   "ca-info": "ndn testbed ca",
+  "probe-parameters":
+  [
+      { "probe-parameter-key": "full name" }
+  ],
   "supported-challenges":
   [
-      { "type": "PIN" }
+      { "challenge": "PIN" }
   ]
 }
\ No newline at end of file
diff --git a/tests/unit-tests/ca.conf.test2 b/tests/unit-tests/ca.conf.test2
index 17f058b..22cd83c 100644
--- a/tests/unit-tests/ca.conf.test2
+++ b/tests/unit-tests/ca.conf.test2
@@ -1,9 +1,8 @@
 {
-  "issuing-freshness": "720",
-  "validity-period": "360",
   "ca-info": "ndn testbed ca",
+  "max-validity-period": "86400",
   "supported-challenges":
   [
-      { "type": "PIN" }
+      { "challenge": "PIN" }
   ]
 }
\ No newline at end of file
diff --git a/tests/unit-tests/ca.conf.test3 b/tests/unit-tests/ca.conf.test3
index f12eabb..b330134 100644
--- a/tests/unit-tests/ca.conf.test3
+++ b/tests/unit-tests/ca.conf.test3
@@ -1,10 +1,9 @@
 {
   "ca-prefix": "/ndn",
-  "issuing-freshness": "720",
-  "validity-period": "360",
   "ca-info": "ndn testbed ca",
+  "max-validity-period": "86400",
   "supported-challenges":
   [
-      { "type": "PINN" }
+      { "challenge": "ABC" }
   ]
 }
\ No newline at end of file