security: refactor CertificateStore class
Refs: #5075
Change-Id: I8ab92012b3acf405503ab33c9320463accc682a9
diff --git a/tests/update/test-advertise-crash.cpp b/tests/update/test-advertise-crash.cpp
index 7f0cad3..4e8f112 100644
--- a/tests/update/test-advertise-crash.cpp
+++ b/tests/update/test-advertise-crash.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2019, The University of Memphis,
+ * Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -31,7 +31,7 @@
public:
AdvertiseCrashFixture()
: face(m_ioService, m_keyChain, {true, true})
- , conf(face)
+ , conf(face, m_keyChain)
, confProcessor(conf)
, nlsr(face, m_keyChain, conf)
, namePrefixList(conf.getNamePrefixList())
diff --git a/tests/update/test-nfd-rib-command-processor.cpp b/tests/update/test-nfd-rib-command-processor.cpp
index 17485da..514fa1c 100644
--- a/tests/update/test-nfd-rib-command-processor.cpp
+++ b/tests/update/test-nfd-rib-command-processor.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2019, The University of Memphis,
+ * Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -35,7 +35,7 @@
public:
NfdRibCommandProcessorFixture()
: face(m_ioService, m_keyChain, {true, true})
- , conf(face)
+ , conf(face, m_keyChain)
, confProcessor(conf)
, nlsr(face, m_keyChain, conf)
, namePrefixes(conf.getNamePrefixList())
diff --git a/tests/update/test-prefix-update-processor.cpp b/tests/update/test-prefix-update-processor.cpp
index 5a6cbde..711935f 100644
--- a/tests/update/test-prefix-update-processor.cpp
+++ b/tests/update/test-prefix-update-processor.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2019, The University of Memphis,
+ * Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -22,8 +22,8 @@
#include "update/prefix-update-processor.hpp"
#include "nlsr.hpp"
-#include "../control-commands.hpp"
-#include "../test-common.hpp"
+#include "tests/control-commands.hpp"
+#include "tests/test-common.hpp"
#include <ndn-cxx/mgmt/nfd/control-response.hpp>
#include <ndn-cxx/security/command-interest-signer.hpp>
@@ -46,7 +46,7 @@
: face(m_ioService, m_keyChain, {true, true})
, siteIdentityName(ndn::Name("site"))
, opIdentityName(ndn::Name("site").append(ndn::Name("%C1.Operator")))
- , conf(face)
+ , conf(face, m_keyChain)
, confProcessor(conf)
, nlsr(face, m_keyChain, conf)
, namePrefixList(conf.getNamePrefixList())
@@ -59,6 +59,12 @@
// Operator cert
opIdentity = addSubCertificate(opIdentityName, siteIdentity);
+ // Create certificate and load it to the validator
+ conf.initializeKey();
+
+ conf.loadCertToValidator(siteIdentity.getDefaultKey().getDefaultCertificate());
+ conf.loadCertToValidator(opIdentity.getDefaultKey().getDefaultCertificate());
+
std::ifstream inputFile;
inputFile.open(std::string("nlsr.conf"));
@@ -78,8 +84,6 @@
}
inputFile.close();
- nlsr.loadCertToPublish(opIdentity.getDefaultKey().getDefaultCertificate());
-
addIdentity(conf.getRouterPrefix());
// Initialize NLSR so a sync socket is created
@@ -131,7 +135,9 @@
ndn::security::pib::Identity siteIdentity;
ndn::Name opIdentityName;
+ ndn::Name routerIdName;
ndn::security::pib::Identity opIdentity;
+ ndn::security::pib::Identity routerId;
ConfParameter conf;
DummyConfFileProcessor confProcessor;
@@ -175,7 +181,6 @@
BOOST_REQUIRE_EQUAL(namePrefixList.size(), 1);
BOOST_CHECK_EQUAL(namePrefixList.getNames().front(), parameters.getName());
-
BOOST_CHECK(wasRoutingUpdatePublished());
BOOST_CHECK(nameLsaSeqNoBeforeInterest < nlsr.m_lsdb.m_sequencingManager.getNameLsaSeq());
diff --git a/tests/update/test-save-delete-prefix.cpp b/tests/update/test-save-delete-prefix.cpp
index 10988bf..1bcca79 100644
--- a/tests/update/test-save-delete-prefix.cpp
+++ b/tests/update/test-save-delete-prefix.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2019, The University of Memphis,
+ * Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -22,8 +22,8 @@
#include "update/prefix-update-processor.hpp"
#include "nlsr.hpp"
-#include "../control-commands.hpp"
-#include "../test-common.hpp"
+#include "tests/control-commands.hpp"
+#include "tests/test-common.hpp"
#include "conf-parameter.hpp"
#include <ndn-cxx/mgmt/nfd/control-response.hpp>
@@ -47,7 +47,7 @@
, siteIdentityName(ndn::Name("/edu/test-site"))
, opIdentityName(ndn::Name("/edu/test-site").append(ndn::Name("%C1.Operator")))
, testConfFile("/tmp/nlsr.conf.test")
- , conf(face, testConfFile)
+ , conf(face, m_keyChain, testConfFile)
, confProcessor(conf)
, nlsr(face, m_keyChain, conf)
, SITE_CERT_PATH(boost::filesystem::current_path() / std::string("site.cert"))
@@ -91,7 +91,11 @@
// Operator cert
opIdentity = addSubCertificate(opIdentityName, siteIdentity);
- nlsr.loadCertToPublish(opIdentity.getDefaultKey().getDefaultCertificate());
+
+ // Create certificate and load it to the validator
+ conf.initializeKey();
+ conf.loadCertToValidator(siteIdentity.getDefaultKey().getDefaultCertificate());
+ conf.loadCertToValidator(opIdentity.getDefaultKey().getDefaultCertificate());
// Set the network so the LSA prefix is constructed
addIdentity(conf.getRouterPrefix());
@@ -156,8 +160,8 @@
public:
ndn::util::DummyClientFace face;
- ndn::Name siteIdentityName;
- ndn::security::pib::Identity siteIdentity;
+ ndn::Name siteIdentityName, routerIdName;
+ ndn::security::pib::Identity siteIdentity, routerId;
ndn::Name opIdentityName;
ndn::security::pib::Identity opIdentity;