Use InterestSigner instead of deprecated CommandInterestSigner

Change-Id: Idb2f1ee7fe99981c229b4a587ebcf671b876e624
This commit is contained in:
Davide Pesavento committed 2021-05-17 02:28:03 -04:00
1 parent e63b7fa7dc
commit 6184c2088b
3 files changed
+17 -24

No files matched your search

+8 -10
View File
@@ -26,7 +26,7 @@
#include "tests/test-common.hpp"
#include <ndn-cxx/mgmt/nfd/control-response.hpp>
#include <ndn-cxx/security/command-interest-signer.hpp>
#include <ndn-cxx/security/interest-signer.hpp>
#include <ndn-cxx/security/pib/identity.hpp>
#include <ndn-cxx/security/signing-helpers.hpp>
@@ -163,13 +163,12 @@ BOOST_AUTO_TEST_CASE(Basic)
// append /<control-parameters>
advertiseCommand.append(parameters.wireEncode());
ndn::security::CommandInterestSigner cis(m_keyChain);
ndn::security::InterestSigner signer(m_keyChain);
// CommandInterestSigner::makeCommandInterest() will append the last
// InterestSigner::makeCommandInterest() will append the last
// three components: (<timestamp>/<random-value>/<signed-interests-components>)
ndn::Interest advertiseInterest =
cis.makeCommandInterest(advertiseCommand,
ndn::security::signingByIdentity(opIdentity));
auto advertiseInterest = signer.makeCommandInterest(advertiseCommand,
ndn::security::signingByIdentity(opIdentity));
face.receive(advertiseInterest);
@@ -185,13 +184,12 @@ BOOST_AUTO_TEST_CASE(Basic)
face.sentData.clear();
nameLsaSeqNoBeforeInterest = nlsr.m_lsdb.m_sequencingManager.getNameLsaSeq();
//Withdraw
// Withdraw
ndn::Name withdrawCommand("/localhost/nlsr/prefix-update/withdraw");
withdrawCommand.append(parameters.wireEncode());
ndn::Interest withdrawInterest
= cis.makeCommandInterest(withdrawCommand,
ndn::security::signingByIdentity(opIdentity));
auto withdrawInterest= signer.makeCommandInterest(withdrawCommand,
ndn::security::signingByIdentity(opIdentity));
face.receive(withdrawInterest);
this->advanceClocks(ndn::time::milliseconds(10));
+5 -6
View File
@@ -27,7 +27,7 @@
#include "conf-parameter.hpp"
#include <ndn-cxx/mgmt/nfd/control-response.hpp>
#include <ndn-cxx/security/command-interest-signer.hpp>
#include <ndn-cxx/security/interest-signer.hpp>
#include <ndn-cxx/security/pib/identity.hpp>
#include <ndn-cxx/security/signing-helpers.hpp>
@@ -138,21 +138,20 @@ public:
{
ndn::nfd::ControlParameters parameters;
parameters.setName(prefixName);
if (P_FLAG)
{
if (P_FLAG) {
parameters.setFlags(update::PREFIX_FLAG);
}
ndn::Name advertiseCommand("/localhost/nlsr/prefix-update/advertise");
ndn::Name withdrawCommand("/localhost/nlsr/prefix-update/withdraw");
ndn::security::CommandInterestSigner cis(m_keyChain);
ndn::security::InterestSigner signer(m_keyChain);
// type true for advertise, else withdraw
if (type == "advertise") {
advertiseCommand.append(parameters.wireEncode());
return cis.makeCommandInterest(advertiseCommand, ndn::security::signingByIdentity(opIdentity));
return signer.makeCommandInterest(advertiseCommand, ndn::security::signingByIdentity(opIdentity));
}
else {
withdrawCommand.append(parameters.wireEncode());
return cis.makeCommandInterest(withdrawCommand, ndn::security::signingByIdentity(opIdentity));
return signer.makeCommandInterest(withdrawCommand, ndn::security::signingByIdentity(opIdentity));
}
}
+4 -8
View File
@@ -30,7 +30,7 @@
#include <ndn-cxx/interest.hpp>
#include <ndn-cxx/mgmt/nfd/control-parameters.hpp>
#include <ndn-cxx/mgmt/nfd/control-response.hpp>
#include <ndn-cxx/security/command-interest-signer.hpp>
#include <ndn-cxx/security/interest-signer.hpp>
#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/security/signing-helpers.hpp>
#include <ndn-cxx/util/segment-fetcher.hpp>
@@ -205,13 +205,9 @@ Nlsrc::sendNamePrefixUpdate(const ndn::Name& name,
commandName.append(verb);
commandName.append(parameters.wireEncode());
ndn::security::CommandInterestSigner cis(m_keyChain);
ndn::Interest commandInterest =
cis.makeCommandInterest(commandName,
ndn::security::signingByIdentity(m_keyChain.getPib().
getDefaultIdentity()));
ndn::security::InterestSigner signer(m_keyChain);
auto commandInterest = signer.makeCommandInterest(commandName,
ndn::security::signingByIdentity(m_keyChain.getPib().getDefaultIdentity()));
commandInterest.setMustBeFresh(true);
m_face.expressInterest(commandInterest,