update profile fetching

Change-Id: I788ece8371f7e24c87918a57062673be1d866e5b
diff --git a/src/requester.cpp b/src/requester.cpp
index 6c147e9..fda2f4f 100644
--- a/src/requester.cpp
+++ b/src/requester.cpp
@@ -33,6 +33,7 @@
 #include <ndn-cxx/security/verification-helpers.hpp>
 #include <ndn-cxx/util/io.hpp>
 #include <ndn-cxx/util/random.hpp>
+#include <ndn-cxx/metadata-object.hpp>
 
 namespace ndn {
 namespace ndncert {
@@ -47,14 +48,22 @@
 }
 
 shared_ptr<Interest>
-Requester::genCaProfileInterest(const Name& caName)
+Requester::genCaProfileDiscoveryInterest(const Name& caName)
 {
-  Name interestName = caName;
+  Name contentName = caName;
   if (readString(caName.at(-1)) != "CA")
-    interestName.append("CA");
-  interestName.append("INFO");
-  auto interest = make_shared<Interest>(interestName);
-  interest->setMustBeFresh(true);
+    contentName.append("CA");
+  contentName.append("INFO");
+  return std::make_shared<Interest>(MetadataObject::makeDiscoveryInterest(contentName));
+}
+
+shared_ptr<Interest>
+Requester::genCaProfileInterestFromDiscoveryResponse(const Data& reply)
+{
+  auto metaData = MetadataObject(reply);
+  auto interestName= metaData.getVersionedName();
+  interestName.appendSegment(0);
+  auto interest = std::make_shared<Interest>(interestName);
   interest->setCanBePrefix(false);
   return interest;
 }