tests: expect certificate name in KeyLocator
Also, delete unused KeyChainFixture::makeCert function.
refs #5112
Change-Id: I59b1ca81fca0481a37126270c447f639080ec75f
diff --git a/tests/daemon/mgmt/rib-manager.t.cpp b/tests/daemon/mgmt/rib-manager.t.cpp
index b688996..d23eb70 100644
--- a/tests/daemon/mgmt/rib-manager.t.cpp
+++ b/tests/daemon/mgmt/rib-manager.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California,
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -128,17 +128,17 @@
, m_fibUpdater(m_rib, m_nfdController)
, m_manager(m_rib, m_face, m_keyChain, m_nfdController, m_dispatcher)
{
- m_keyChain.createIdentity(m_anchorId);
- m_keyChain.createIdentity(m_derivedId);
-
- m_derivedCert = m_keyChain.getPib().getIdentity(m_derivedId).getDefaultKey().getDefaultCertificate();
- ndn::SignatureInfo signatureInfo;
- signatureInfo.setValidityPeriod(m_derivedCert.getValidityPeriod());
- ndn::security::SigningInfo signingInfo(ndn::security::SigningInfo::SIGNER_TYPE_ID,
- m_anchorId, signatureInfo);
- m_keyChain.sign(m_derivedCert, signingInfo);
+ auto anchorIdentity = m_keyChain.createIdentity(m_anchorId);
saveIdentityCert(m_anchorId, "signer.ndncert", true);
+ auto derivedKey = m_keyChain.createIdentity(m_derivedId).getDefaultKey();
+ auto derivedSelfSigned = derivedKey.getDefaultCertificate();
+ ndn::security::MakeCertificateOptions opts;
+ opts.validity = derivedSelfSigned.getValidityPeriod();
+ auto derivedCert = m_keyChain.makeCertificate(derivedSelfSigned,
+ ndn::security::signingByIdentity(anchorIdentity), opts);
+ m_keyChain.setDefaultCertificate(derivedKey, derivedCert);
+
if (m_status.isLocalhostConfigured) {
m_manager.applyLocalhostConfig(getValidatorConfigSection(), "test");
}
@@ -155,11 +155,11 @@
clearRib();
}
- m_face.onSendInterest.connect([this] (const Interest& interest) {
- if (interest.getName().isPrefixOf(m_derivedCert.getName())) {
- if (m_status.isLocalhopConfigured && interest.template getTag<lp::NextHopFaceIdTag>() != nullptr) {
- m_face.put(m_derivedCert);
- }
+ m_face.onSendInterest.connect([=] (const Interest& interest) {
+ if (interest.matchesData(derivedCert) &&
+ m_status.isLocalhopConfigured &&
+ interest.template getTag<lp::NextHopFaceIdTag>() != nullptr) {
+ m_face.put(derivedCert);
}
});
}
@@ -234,7 +234,6 @@
ConfigurationStatus m_status;
Name m_anchorId;
Name m_derivedId;
- ndn::security::Certificate m_derivedCert;
ndn::nfd::Controller m_nfdController;
rib::Rib m_rib;