**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/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: