**breaking change**: Switch Face and related classes to v2::KeyChain
security::v2::KeyChain is now exposed as ndn::KeyChain, which should
ensure that dependent code can be mostly compiled. However, expect code
that explicitly uses the old KeyChain interface to be broken.
Change-Id: I7330d0250d92f3f0f2570ab6d0214ab3dfdd18cc
Refs: #3098
diff --git a/src/mgmt/dispatcher.cpp b/src/mgmt/dispatcher.cpp
index 62f9114..3220864 100644
--- a/src/mgmt/dispatcher.cpp
+++ b/src/mgmt/dispatcher.cpp
@@ -42,7 +42,7 @@
};
}
-Dispatcher::Dispatcher(Face& face, security::v1::KeyChain& keyChain,
+Dispatcher::Dispatcher(Face& face, KeyChain& keyChain,
const security::SigningInfo& signingInfo,
size_t imsCapacity)
: m_face(face)
diff --git a/src/mgmt/dispatcher.hpp b/src/mgmt/dispatcher.hpp
index a8b30b4..b3c9967 100644
--- a/src/mgmt/dispatcher.hpp
+++ b/src/mgmt/dispatcher.hpp
@@ -145,7 +145,7 @@
* \param signingInfo signing parameters to sign Data with \p keyChain
* \param imsCapacity capacity of the internal InMemoryStorage used by dispatcher
*/
- Dispatcher(Face& face, security::v1::KeyChain& keyChain,
+ Dispatcher(Face& face, KeyChain& keyChain,
const security::SigningInfo& signingInfo = security::SigningInfo(),
size_t imsCapacity = 256);
@@ -462,7 +462,7 @@
std::unordered_map<Name, TopPrefixEntry> m_topLevelPrefixes;
Face& m_face;
- security::v1::KeyChain& m_keyChain;
+ KeyChain& m_keyChain;
security::SigningInfo m_signingInfo;
typedef std::unordered_map<PartialName, InterestHandler> HandlerMap;
diff --git a/src/mgmt/nfd/controller.cpp b/src/mgmt/nfd/controller.cpp
index 4ccb895..bfb0843 100644
--- a/src/mgmt/nfd/controller.cpp
+++ b/src/mgmt/nfd/controller.cpp
@@ -36,9 +36,10 @@
const uint32_t Controller::ERROR_LBOUND = 400;
ValidatorNull Controller::s_validatorNull;
-Controller::Controller(Face& face, security::v1::KeyChain& keyChain, Validator& validator)
+Controller::Controller(Face& face, KeyChain& keyChain, Validator& validator)
: m_face(face)
, m_keyChain(keyChain)
+ , m_signer(keyChain)
, m_validator(validator)
{
}
@@ -56,9 +57,8 @@
onFailure1 : [] (const ControlResponse&) {};
Name requestName = command->getRequestName(options.getPrefix(), parameters);
- Interest interest(requestName);
+ Interest interest = m_signer.makeCommandInterest(requestName, options.getSigningInfo());
interest.setInterestLifetime(options.getTimeout());
- m_keyChain.sign(interest, options.getSigningInfo());
m_face.expressInterest(interest,
[=] (const Interest&, const Data& data) {
diff --git a/src/mgmt/nfd/controller.hpp b/src/mgmt/nfd/controller.hpp
index aa4b285..d9bfa1f 100644
--- a/src/mgmt/nfd/controller.hpp
+++ b/src/mgmt/nfd/controller.hpp
@@ -28,6 +28,7 @@
#include "command-options.hpp"
#include "../../security/validator-null.hpp"
#include "../../security/key-chain.hpp"
+#include "../../security/command-interest-signer.hpp"
namespace ndn {
@@ -66,7 +67,7 @@
/** \brief construct a Controller that uses face for transport,
* and uses the passed KeyChain to sign commands
*/
- Controller(Face& face, security::v1::KeyChain& keyChain, security::Validator& validator = s_validatorNull);
+ Controller(Face& face, KeyChain& keyChain, security::Validator& validator = s_validatorNull);
/** \brief start command execution
*/
@@ -170,7 +171,8 @@
protected:
Face& m_face;
- security::v1::KeyChain& m_keyChain;
+ KeyChain& m_keyChain;
+ security::CommandInterestSigner m_signer;
security::Validator& m_validator;
private: