mgmt: rename extractRequester() and support signed Interest v0.3
Change-Id: I6bb6635896fa1b9fa54beb70b902c5a35831dc9c
diff --git a/tests/daemon/mgmt/manager-base.t.cpp b/tests/daemon/mgmt/manager-base.t.cpp
index ce74b1c..ea7aea5 100644
--- a/tests/daemon/mgmt/manager-base.t.cpp
+++ b/tests/daemon/mgmt/manager-base.t.cpp
@@ -125,17 +125,26 @@
Name("/localhost/nfd/test-module/test-notification").appendSequenceNumber(0));
}
-BOOST_AUTO_TEST_CASE(ExtractRequester)
+BOOST_AUTO_TEST_CASE(ExtractSigner)
{
- std::string requesterName;
- auto testAccept = [&] (const std::string& requester) { requesterName = requester; };
+ std::string signer = ManagerBase::extractSigner(Interest("/test/interest/unsigned"));
+ BOOST_CHECK_EQUAL(signer, ""); // missing SignatureInfo
- m_manager.extractRequester(Interest("/test/interest/unsigned"), testAccept);
- BOOST_CHECK_EQUAL(requesterName, "");
+ auto signedV03 = makeControlCommandRequest("/test/interest/signed", {},
+ ndn::security::SignedInterestFormat::V03);
+ signer = ManagerBase::extractSigner(signedV03);
+ BOOST_CHECK_EQUAL(signer,
+ m_keyChain.getPib().getIdentity(DEFAULT_COMMAND_SIGNER_IDENTITY)
+ .getDefaultKey().getDefaultCertificate().getName().toUri());
- requesterName.clear();
- m_manager.extractRequester(makeControlCommandRequest("/test/interest/signed"), testAccept);
- BOOST_CHECK_EQUAL(requesterName,
+ signedV03.setSignatureInfo(ndn::SignatureInfo(tlv::SignatureSha256WithEcdsa));
+ signer = ManagerBase::extractSigner(signedV03);
+ BOOST_CHECK_EQUAL(signer, ""); // missing KeyLocator
+
+ auto signedV02 = makeControlCommandRequest("/test/interest/signed", {},
+ ndn::security::SignedInterestFormat::V02);
+ signer = ManagerBase::extractSigner(signedV02);
+ BOOST_CHECK_EQUAL(signer,
m_keyChain.getPib().getIdentity(DEFAULT_COMMAND_SIGNER_IDENTITY)
.getDefaultKey().getDefaultCertificate().getName().toUri());
}