diff --git a/tests/update/test-advertise-crash.cpp b/tests/update/test-advertise-crash.cpp
index 4f59c49..db9dfe6 100644
--- a/tests/update/test-advertise-crash.cpp
+++ b/tests/update/test-advertise-crash.cpp
@@ -30,14 +30,14 @@
 {
 public:
   AdvertiseCrashFixture()
-    : face(g_ioService, keyChain, {true, true})
-    , nlsr(g_ioService, g_scheduler, face, g_keyChain)
+    : face(m_ioService, m_keyChain, {true, true})
+    , nlsr(m_ioService, m_scheduler, face, m_keyChain)
     , namePrefixList(nlsr.getNamePrefixList())
     , updatePrefixUpdateProcessor(nlsr.getPrefixUpdateProcessor())
   {
     // Add an adjacency to nlsr
     Adjacent adj("/ndn/edu/test-site-2/%C1.Router/test",
-                 ndn::util::FaceUri("udp://1.0.0.2"), 10, Adjacent::STATUS_INACTIVE, 0, 0);
+                 ndn::FaceUri("udp://1.0.0.2"), 10, Adjacent::STATUS_INACTIVE, 0, 0);
     nlsr.getAdjacencyList().insert(adj);
 
     // Create a face dataset response with the face having the same uri as
@@ -50,6 +50,9 @@
 
     // Set the network so the LSA prefix is constructed
     nlsr.getConfParameter().setNetwork("/ndn");
+    nlsr.getConfParameter().setRouterName(ndn::Name("/This/router"));
+
+    addIdentity(ndn::Name("/ndn/This/router"));
 
     // So that NLSR starts listening on prefixes
     nlsr.initialize();
@@ -59,14 +62,13 @@
     // in fib.cpp if an operation is done on non-existent faceUri
     nlsr.processFaceDataset(faces);
 
-    this->advanceClocks(ndn::time::milliseconds(1));
+    this->advanceClocks(ndn::time::milliseconds(1), 10);
 
     face.sentInterests.clear();
   }
 
 public:
   ndn::util::DummyClientFace face;
-  ndn::KeyChain keyChain;
 
   Nlsr nlsr;
   NamePrefixList& namePrefixList;
@@ -89,7 +91,7 @@
   std::shared_ptr<ndn::Interest> advertiseInterest = std::make_shared<ndn::Interest>(advertiseCommand);
 
   face.receive(*advertiseInterest);
-  this->advanceClocks(ndn::time::milliseconds(10));
+  this->advanceClocks(ndn::time::milliseconds(10), 10);
 }
 
 } // namespace test
diff --git a/tests/update/test-nfd-rib-command-processor.cpp b/tests/update/test-nfd-rib-command-processor.cpp
index 53c77a1..2a78171 100644
--- a/tests/update/test-nfd-rib-command-processor.cpp
+++ b/tests/update/test-nfd-rib-command-processor.cpp
@@ -39,13 +39,16 @@
 {
 public:
   NfdRibCommandProcessorFixture()
-    : face(g_ioService, keyChain, {true, true})
-    , nlsr(g_ioService, g_scheduler, face, g_keyChain)
+    : face(m_ioService, m_keyChain, {true, true})
+    , nlsr(m_ioService, m_scheduler, face, m_keyChain)
     , namePrefixes(nlsr.getNamePrefixList())
     , processor(nlsr.getNfdRibCommandProcessor())
   {
     // Set the network so the LSA prefix is constructed
     nlsr.getConfParameter().setNetwork("/ndn");
+    nlsr.getConfParameter().setRouterName(ndn::Name("/This/router"));
+
+    addIdentity(ndn::Name("/ndn/This/router"));
 
     // Initialize NLSR so a sync socket is created
     nlsr.initialize();
@@ -54,7 +57,7 @@
     // be the same value as what ChronoSync uses in setting the sessionName
     sessionTime.appendNumber(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count());
 
-    this->advanceClocks(ndn::time::milliseconds(10));
+    this->advanceClocks(ndn::time::milliseconds(10), 10);
     face.sentInterests.clear();
 
     nameLsaSeqNoBeforeInterest = nlsr.getLsdb().getSequencingManager().getNameLsaSeq();
@@ -74,7 +77,7 @@
     // Need to send an interest now since ChronoSync
     // no longer does face->put(*data) in publishData.
     // Instead it does it in onInterest
-    ndn::Name lsaInterestName("/localhop/ndn/NLSR/LSA");
+    ndn::Name lsaInterestName("/localhop/ndn/NLSR/LSA/This/router");
     lsaInterestName.append(std::to_string(Lsa::Type::NAME));
 
     // The part after LSA is Chronosync getSession
@@ -83,13 +86,14 @@
     shared_ptr<ndn::Interest> lsaInterest = make_shared<ndn::Interest>(lsaInterestName);
 
     face.receive(*lsaInterest);
-    this->advanceClocks(ndn::time::milliseconds(10));
+    this->advanceClocks(ndn::time::milliseconds(10), 10);
   }
 
   bool
   wasRoutingUpdatePublished()
   {
     sendInterestForPublishedData();
+
     const ndn::Name& lsaPrefix = nlsr.getConfParameter().getLsaPrefix();
 
     const auto& it = std::find_if(face.sentData.begin(), face.sentData.end(),
@@ -102,7 +106,6 @@
 
 public:
   ndn::util::DummyClientFace face;
-  ndn::KeyChain keyChain;
 
   Nlsr nlsr;
   NamePrefixList& namePrefixes;
@@ -148,7 +151,7 @@
     .wireEncode()), 0);
 
   face.receive(*command);
-  this->advanceClocks(ndn::time::milliseconds(10));
+  this->advanceClocks(ndn::time::milliseconds(10), 10);
 
   BOOST_CHECK_EQUAL(namePrefixes.getNames().size(), 1);
   std::list<ndn::Name> names = namePrefixes.getNames();
@@ -173,7 +176,7 @@
     .wireEncode()), 0);
 
   face.receive(ndn::Interest(name));
-  this->advanceClocks(ndn::time::milliseconds(10));
+  this->advanceClocks(ndn::time::milliseconds(10), 10);
 
   BOOST_CHECK_EQUAL(namePrefixes.getNames().size(), 0);
   BOOST_CHECK(wasRoutingUpdatePublished());
@@ -190,7 +193,7 @@
     .wireEncode()), 0);
 
   face.receive(ndn::Interest(name));
-  this->advanceClocks(ndn::time::milliseconds(10));
+  this->advanceClocks(ndn::time::milliseconds(10), 10);
 
   BOOST_CHECK_EQUAL(namePrefixes.getNames().size(), 0);
 
diff --git a/tests/update/test-prefix-update-processor.cpp b/tests/update/test-prefix-update-processor.cpp
index 62ec8f6..5bb61f1 100644
--- a/tests/update/test-prefix-update-processor.cpp
+++ b/tests/update/test-prefix-update-processor.cpp
@@ -29,7 +29,11 @@
 #include <ndn-cxx/mgmt/nfd/control-parameters.hpp>
 #include <ndn-cxx/mgmt/nfd/control-response.hpp>
 #include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/security/pib/identity.hpp>
+#include <ndn-cxx/security/signing-helpers.hpp>
+#include <ndn-cxx/security/command-interest-signer.hpp>
 #include <ndn-cxx/util/dummy-client-face.hpp>
+#include <ndn-cxx/lp/tags.hpp>
 
 #include <boost/filesystem.hpp>
 
@@ -43,74 +47,78 @@
 {
 public:
   PrefixUpdateFixture()
-    : face(g_ioService, keyChain, {true, true})
-    , siteIdentity(ndn::Name("/ndn/edu/test-site").appendVersion())
-    , opIdentity(ndn::Name(siteIdentity).append(ndn::Name("%C1.Operator")).appendVersion())
-    , nlsr(g_ioService, g_scheduler, face, g_keyChain)
-    , keyPrefix(("/ndn/broadcast"))
+    : face(m_ioService, m_keyChain, {true, true})
+    , siteIdentityName(ndn::Name("/edu/test-site"))
+    , opIdentityName(ndn::Name("/edu/test-site").append(ndn::Name("%C1.Operator")))
+    , nlsr(m_ioService, m_scheduler, face, m_keyChain)
     , namePrefixList(nlsr.getNamePrefixList())
     , updatePrefixUpdateProcessor(nlsr.getPrefixUpdateProcessor())
     , SITE_CERT_PATH(boost::filesystem::current_path() / std::string("site.cert"))
   {
-    createSiteCert();
-    BOOST_REQUIRE(siteCert != nullptr);
+    // Site cert
+    siteIdentity = addIdentity(siteIdentityName);
+    saveCertificate(siteIdentity, SITE_CERT_PATH.string());
 
-    createOperatorCert();
-    BOOST_REQUIRE(opCert != nullptr);
+    // Operator cert
+    opIdentity = addSubCertificate(opIdentityName, siteIdentity);
 
-    const std::string CONFIG =
-      "rule\n"
-      "{\n"
-      "  id \"NLSR ControlCommand Rule\"\n"
-      "  for interest\n"
-      "  filter\n"
-      "  {\n"
-      "    type name\n"
-      "    regex ^<localhost><nlsr><prefix-update>[<advertise><withdraw>]<>$\n"
-      "  }\n"
-      "  checker\n"
-      "  {\n"
-      "    type customized\n"
-      "    sig-type rsa-sha256\n"
-      "    key-locator\n"
-      "    {\n"
-      "      type name\n"
-      "      regex ^([^<KEY><%C1.Operator>]*)<%C1.Operator>[^<KEY>]*<KEY><ksk-.*><ID-CERT>$\n"
-      "    }\n"
-      "  }\n"
-      "}\n"
-      "rule\n"
-      "{\n"
-      "  id \"NLSR Hierarchy Rule\"\n"
-      "  for data\n"
-      "  filter\n"
-      "  {\n"
-      "    type name\n"
-      "    regex ^[^<KEY>]*<KEY><ksk-.*><ID-CERT><>$\n"
-      "  }\n"
-      "  checker\n"
-      "  {\n"
-      "    type hierarchical\n"
-      "    sig-type rsa-sha256\n"
-      "  }\n"
-      "}\n"
-      "trust-anchor\n"
-      "{\n"
-      " type file\n"
-      " file-name \"site.cert\"\n"
-      "}\n";
+    const std::string CONFIG = R"CONF(
+        rule
+        {
+          id "NLSR ControlCommand Rule"
+          for interest
+          filter
+          {
+            type name
+            regex ^(<localhost><nlsr>)<prefix-update>[<advertise><withdraw>]<><><>$
+          }
+          checker
+          {
+            type customized
+            sig-type rsa-sha256
+            key-locator
+            {
+              type name
+              regex ^<>*<KEY><>$
+            }
+          }
+        }
+        rule
+        {
+          id "NLSR Hierarchy Rule"
+          for data
+          filter
+          {
+            type name
+            regex ^[^<KEY>]*<KEY><><><>$
+          }
+          checker
+          {
+            type hierarchical
+            sig-type rsa-sha256
+          }
+        }
+        trust-anchor
+        {
+         type file
+         file-name "site.cert"
+        }
+    )CONF";
 
     const boost::filesystem::path CONFIG_PATH =
       (boost::filesystem::current_path() / std::string("unit-test.conf"));
 
     updatePrefixUpdateProcessor.getValidator().load(CONFIG, CONFIG_PATH.native());
 
-    // Insert certs after the validator is loaded since ValidatorConfig::load() clears
-    // the certificate cache
-    nlsr.addCertificateToCache(opCert);
+    nlsr.loadCertToPublish(opIdentity.getDefaultKey().getDefaultCertificate());
 
     // Set the network so the LSA prefix is constructed
     nlsr.getConfParameter().setNetwork("/ndn");
+    nlsr.getConfParameter().setSiteName("/edu/test-site");
+    nlsr.getConfParameter().setRouterName("/%C1.Router/this-router");
+    nlsr.getConfParameter().buildRouterPrefix();
+
+    addIdentity(ndn::Name("/ndn/edu/test-site/%C1.Router/this-router"));
 
     // Initialize NLSR so a sync socket is created
     nlsr.initialize();
@@ -124,45 +132,14 @@
     face.sentInterests.clear();
   }
 
-  void
-  createSiteCert()
+  void sendInterestForPublishedData()
   {
-    // Site cert
-    keyChain.createIdentity(siteIdentity);
-    siteCertName = keyChain.getDefaultCertificateNameForIdentity(siteIdentity);
-    siteCert = keyChain.getCertificate(siteCertName);
-
-    ndn::io::save(*siteCert, SITE_CERT_PATH.string());
-  }
-
-  void
-  createOperatorCert()
-  {
-    // Operator cert
-    ndn::Name keyName = keyChain.generateRsaKeyPairAsDefault(opIdentity, true);
-
-    opCert = std::make_shared<ndn::IdentityCertificate>();
-    std::shared_ptr<ndn::PublicKey> pubKey = keyChain.getPublicKey(keyName);
-    opCertName = keyName.getPrefix(-1);
-    opCertName.append("KEY").append(keyName.get(-1)).append("ID-CERT").appendVersion();
-    opCert->setName(opCertName);
-    opCert->setNotBefore(time::system_clock::now() - time::days(1));
-    opCert->setNotAfter(time::system_clock::now() + time::days(1));
-    opCert->setPublicKeyInfo(*pubKey);
-    opCert->addSubjectDescription(ndn::security::v1::CertificateSubjectDescription(ndn::oid::ATTRIBUTE_NAME,
-                                                                                   keyName.toUri()));
-    opCert->encode();
-
-    keyChain.signByIdentity(*opCert, siteIdentity);
-
-    keyChain.addCertificateAsIdentityDefault(*opCert);
-  }
-
-  void sendInterestForPublishedData() {
     // Need to send an interest now since ChronoSync
     // no longer does face->put(*data) in publishData.
     // Instead it does it in onInterest
-    ndn::Name lsaInterestName("/localhop/ndn/NLSR/LSA");
+    ndn::Name lsaInterestName = nlsr.getConfParameter().getLsaPrefix();
+    lsaInterestName.append(nlsr.getConfParameter().getSiteName());
+    lsaInterestName.append(nlsr.getConfParameter().getRouterName());
     lsaInterestName.append(std::to_string(Lsa::Type::NAME));
 
     // The part after LSA is Chronosync getSession
@@ -172,7 +149,7 @@
     std::shared_ptr<Interest> lsaInterest = std::make_shared<Interest>(lsaInterestName);
 
     face.receive(*lsaInterest);
-    this->advanceClocks(ndn::time::milliseconds(10));
+    this->advanceClocks(ndn::time::milliseconds(100));
   }
 
   bool
@@ -185,7 +162,8 @@
     const auto& it = std::find_if(face.sentData.begin(), face.sentData.end(),
       [lsaPrefix] (const ndn::Data& data) {
         return lsaPrefix.isPrefixOf(data.getName());
-      });
+      }
+    );
 
     return (it != face.sentData.end());
   }
@@ -204,28 +182,16 @@
     BOOST_CHECK_EQUAL(response.getCode(), expectedCode);
   }
 
-  ~PrefixUpdateFixture()
-  {
-    keyChain.deleteIdentity(siteIdentity);
-    keyChain.deleteIdentity(opIdentity);
-
-    boost::filesystem::remove(SITE_CERT_PATH);
-  }
-
 public:
   ndn::util::DummyClientFace face;
-  ndn::KeyChain keyChain;
 
-  ndn::Name siteIdentity;
-  ndn::Name siteCertName;
-  std::shared_ptr<IdentityCertificate> siteCert;
+  ndn::Name siteIdentityName;
+  ndn::security::pib::Identity siteIdentity;
 
-  ndn::Name opIdentity;
-  ndn::Name opCertName;
-  std::shared_ptr<IdentityCertificate> opCert;
+  ndn::Name opIdentityName;
+  ndn::security::pib::Identity opIdentity;
 
   Nlsr nlsr;
-  ndn::Name keyPrefix;
   NamePrefixList& namePrefixList;
   PrefixUpdateProcessor& updatePrefixUpdateProcessor;
 
@@ -238,16 +204,29 @@
 BOOST_AUTO_TEST_CASE(Basic)
 {
   uint64_t nameLsaSeqNoBeforeInterest = nlsr.getLsdb().getSequencingManager().getNameLsaSeq();
-  // Advertise
+
   ndn::nfd::ControlParameters parameters;
   parameters.setName("/prefix/to/advertise/");
+
+  // Control Command format: /<prefix>/<management-module>/<command-verb>/<control-parameters>
+  // /<timestamp>/<random-value>/<signed-interests-components>
+
+  // Advertise
   ndn::Name advertiseCommand("/localhost/nlsr/prefix-update/advertise");
+
+  // append /<control-parameters>
   advertiseCommand.append(parameters.wireEncode());
 
-  std::shared_ptr<Interest> advertiseInterest = std::make_shared<Interest>(advertiseCommand);
-  keyChain.signByIdentity(*advertiseInterest, opIdentity);
+  ndn::security::CommandInterestSigner cis(m_keyChain);
 
-  face.receive(*advertiseInterest);
+  // CommandInterestSigner::makeCommandInterest() will append the last
+  // three components: (<timestamp>/<random-value>/<signed-interests-components>)
+  ndn::Interest advertiseInterest =
+    cis.makeCommandInterest(advertiseCommand,
+                            ndn::security::signingByIdentity(opIdentity));
+
+  face.receive(advertiseInterest);
+
   this->advanceClocks(ndn::time::milliseconds(10));
 
   NamePrefixList& namePrefixList = nlsr.getNamePrefixList();
@@ -261,14 +240,15 @@
   face.sentData.clear();
   nameLsaSeqNoBeforeInterest = nlsr.getLsdb().getSequencingManager().getNameLsaSeq();
 
-  // Withdraw
+  //Withdraw
   ndn::Name withdrawCommand("/localhost/nlsr/prefix-update/withdraw");
   withdrawCommand.append(parameters.wireEncode());
 
-  std::shared_ptr<Interest> withdrawInterest = std::make_shared<Interest>(withdrawCommand);
-  keyChain.signByIdentity(*withdrawInterest, opIdentity);
+  ndn::Interest withdrawInterest
+    = cis.makeCommandInterest(withdrawCommand,
+                              ndn::security::signingByIdentity(opIdentity));
 
-  face.receive(*withdrawInterest);
+  face.receive(withdrawInterest);
   this->advanceClocks(ndn::time::milliseconds(10));
 
   BOOST_CHECK_EQUAL(namePrefixList.size(), 0);
