merge ca config and client config, remove old format of probe
Change-Id: I73500f532f166851d82c1bf1cc008c7ffc241ef3
diff --git a/src/client-module.cpp b/src/client-module.cpp
index 0fbd07b..0e7810e 100644
--- a/src/client-module.cpp
+++ b/src/client-module.cpp
@@ -68,10 +68,10 @@
ClientModule::verifyInfoResponse(const Data& reply)
{
// parse the ca item
- auto caItem = INFO::decodeClientConfigFromContent(reply.getContent());
+ auto caItem = INFO::decodeDataContentToCaProfile(reply.getContent());
// verify the probe Data's sig
- if (!security::verifySignature(reply, caItem.m_anchor)) {
+ if (!security::verifySignature(reply, *caItem.m_cert)) {
_LOG_ERROR("Cannot verify data signature from " << m_ca.m_caPrefix.toUri());
return false;
}
@@ -84,7 +84,7 @@
const Block& contentBlock = reply.getContent();
// parse the ca item
- auto caItem = INFO::decodeClientConfigFromContent(contentBlock);
+ auto caItem = INFO::decodeDataContentToCaProfile(contentBlock);
// update the local config
bool findItem = false;
@@ -100,15 +100,15 @@
}
shared_ptr<Interest>
-ClientModule::generateProbeInterest(const ClientCaItem& ca, const std::string& probeInfo)
+ClientModule::generateProbeInterest(const CaConfigItem& ca,
+ std::vector<std::tuple<std::string, std::string>>&& probeInfo)
{
Name interestName = ca.m_caPrefix;
interestName.append("CA").append("PROBE");
auto interest = make_shared<Interest>(interestName);
interest->setMustBeFresh(true);
interest->setCanBePrefix(false);
- interest->setApplicationParameters(
- PROBE::encodeApplicationParametersFromProbeInfo(ca, probeInfo));
+ interest->setApplicationParameters(PROBE::encodeApplicationParameters(std::move(probeInfo)));
// update local state
m_ca = ca;
@@ -118,7 +118,7 @@
void
ClientModule::onProbeResponse(const Data& reply)
{
- if (!security::verifySignature(reply, m_ca.m_anchor)) {
+ if (!security::verifySignature(reply, *m_ca.m_cert)) {
_LOG_ERROR("Cannot verify data signature from " << m_ca.m_caPrefix.toUri());
return;
}
@@ -213,7 +213,7 @@
std::list<std::string>
ClientModule::onNewRenewRevokeResponse(const Data& reply)
{
- if (!security::verifySignature(reply, m_ca.m_anchor)) {
+ if (!security::verifySignature(reply, *m_ca.m_cert)) {
_LOG_ERROR("Cannot verify data signature from " << m_ca.m_caPrefix.toUri());
return std::list<std::string>();
}
@@ -248,7 +248,7 @@
// Name requestedName = identityName;
bool findCa = false;
for (const auto& caItem : m_config.m_caItems) {
- if (caItem.m_caName.isPrefixOf(certificate.getName())) {
+ if (caItem.m_caPrefix.isPrefixOf(certificate.getName())) {
m_ca = caItem;
findCa = true;
}
@@ -296,7 +296,7 @@
void
ClientModule::onChallengeResponse(const Data& reply)
{
- if (!security::verifySignature(reply, m_ca.m_anchor)) {
+ if (!security::verifySignature(reply, *m_ca.m_cert)) {
_LOG_ERROR("Cannot verify data signature from " << m_ca.m_caPrefix.toUri());
return;
}
@@ -373,20 +373,5 @@
m_status = Status::ENDED;
}
-std::vector<std::string>
-ClientModule::parseProbeComponents(const std::string& probe)
-{
- std::vector<std::string> components;
- std::string delimiter = ":";
- size_t last = 0;
- size_t next = 0;
- while ((next = probe.find(delimiter, last)) != std::string::npos) {
- components.push_back(probe.substr(last, next - last));
- last = next + 1;
- }
- components.push_back(probe.substr(last));
- return components;
-}
-
} // namespace ndncert
} // namespace ndn