**breaking change**: Switch Face and related classes to v2::KeyChain

security::v2::KeyChain is now exposed as ndn::KeyChain, which should
ensure that dependent code can be mostly compiled.  However, expect code
that explicitly uses the old KeyChain interface to be broken.

Change-Id: I7330d0250d92f3f0f2570ab6d0214ab3dfdd18cc
Refs: #3098
diff --git a/src/mgmt/dispatcher.cpp b/src/mgmt/dispatcher.cpp
index 62f9114..3220864 100644
--- a/src/mgmt/dispatcher.cpp
+++ b/src/mgmt/dispatcher.cpp
@@ -42,7 +42,7 @@
   };
 }
 
-Dispatcher::Dispatcher(Face& face, security::v1::KeyChain& keyChain,
+Dispatcher::Dispatcher(Face& face, KeyChain& keyChain,
                        const security::SigningInfo& signingInfo,
                        size_t imsCapacity)
   : m_face(face)
diff --git a/src/mgmt/dispatcher.hpp b/src/mgmt/dispatcher.hpp
index a8b30b4..b3c9967 100644
--- a/src/mgmt/dispatcher.hpp
+++ b/src/mgmt/dispatcher.hpp
@@ -145,7 +145,7 @@
    *  \param signingInfo signing parameters to sign Data with \p keyChain
    *  \param imsCapacity capacity of the internal InMemoryStorage used by dispatcher
    */
-  Dispatcher(Face& face, security::v1::KeyChain& keyChain,
+  Dispatcher(Face& face, KeyChain& keyChain,
              const security::SigningInfo& signingInfo = security::SigningInfo(),
              size_t imsCapacity = 256);
 
@@ -462,7 +462,7 @@
   std::unordered_map<Name, TopPrefixEntry> m_topLevelPrefixes;
 
   Face& m_face;
-  security::v1::KeyChain& m_keyChain;
+  KeyChain& m_keyChain;
   security::SigningInfo m_signingInfo;
 
   typedef std::unordered_map<PartialName, InterestHandler> HandlerMap;
diff --git a/src/mgmt/nfd/controller.cpp b/src/mgmt/nfd/controller.cpp
index 4ccb895..bfb0843 100644
--- a/src/mgmt/nfd/controller.cpp
+++ b/src/mgmt/nfd/controller.cpp
@@ -36,9 +36,10 @@
 const uint32_t Controller::ERROR_LBOUND = 400;
 ValidatorNull Controller::s_validatorNull;
 
-Controller::Controller(Face& face, security::v1::KeyChain& keyChain, Validator& validator)
+Controller::Controller(Face& face, KeyChain& keyChain, Validator& validator)
   : m_face(face)
   , m_keyChain(keyChain)
+  , m_signer(keyChain)
   , m_validator(validator)
 {
 }
@@ -56,9 +57,8 @@
     onFailure1 : [] (const ControlResponse&) {};
 
   Name requestName = command->getRequestName(options.getPrefix(), parameters);
-  Interest interest(requestName);
+  Interest interest = m_signer.makeCommandInterest(requestName, options.getSigningInfo());
   interest.setInterestLifetime(options.getTimeout());
-  m_keyChain.sign(interest, options.getSigningInfo());
 
   m_face.expressInterest(interest,
     [=] (const Interest&, const Data& data) {
diff --git a/src/mgmt/nfd/controller.hpp b/src/mgmt/nfd/controller.hpp
index aa4b285..d9bfa1f 100644
--- a/src/mgmt/nfd/controller.hpp
+++ b/src/mgmt/nfd/controller.hpp
@@ -28,6 +28,7 @@
 #include "command-options.hpp"
 #include "../../security/validator-null.hpp"
 #include "../../security/key-chain.hpp"
+#include "../../security/command-interest-signer.hpp"
 
 namespace ndn {
 
@@ -66,7 +67,7 @@
   /** \brief construct a Controller that uses face for transport,
    *         and uses the passed KeyChain to sign commands
    */
-  Controller(Face& face, security::v1::KeyChain& keyChain, security::Validator& validator = s_validatorNull);
+  Controller(Face& face, KeyChain& keyChain, security::Validator& validator = s_validatorNull);
 
   /** \brief start command execution
    */
@@ -170,7 +171,8 @@
 
 protected:
   Face& m_face;
-  security::v1::KeyChain& m_keyChain;
+  KeyChain& m_keyChain;
+  security::CommandInterestSigner m_signer;
   security::Validator& m_validator;
 
 private:
diff --git a/src/security/command-interest-signer.cpp b/src/security/command-interest-signer.cpp
index 0d2f82f..3704a7e 100644
--- a/src/security/command-interest-signer.cpp
+++ b/src/security/command-interest-signer.cpp
@@ -47,7 +47,7 @@
   return name;
 }
 
-CommandInterestSigner::CommandInterestSigner(v2::KeyChain& keyChain)
+CommandInterestSigner::CommandInterestSigner(KeyChain& keyChain)
   : m_keyChain(keyChain)
 {
 }
diff --git a/src/security/command-interest-signer.hpp b/src/security/command-interest-signer.hpp
index 6c5e2ce..730260d 100644
--- a/src/security/command-interest-signer.hpp
+++ b/src/security/command-interest-signer.hpp
@@ -67,7 +67,7 @@
 {
 public:
   explicit
-  CommandInterestSigner(v2::KeyChain& keyChain);
+  CommandInterestSigner(KeyChain& keyChain);
 
   /**
    * @brief Create CommandInterest
@@ -82,10 +82,10 @@
    * @sa https://redmine.named-data.net/projects/ndn-cxx/wiki/CommandInterest
    */
   Interest
-  makeCommandInterest(const Name& name, const SigningInfo& params = v2::KeyChain::getDefaultSigningInfo());
+  makeCommandInterest(const Name& name, const SigningInfo& params = KeyChain::getDefaultSigningInfo());
 
 private:
-  v2::KeyChain& m_keyChain;
+  KeyChain& m_keyChain;
 };
 
 } // namespace security
diff --git a/src/security/command-interest-validator.cpp b/src/security/command-interest-validator.cpp
index 73358bf..57c9c82 100644
--- a/src/security/command-interest-validator.cpp
+++ b/src/security/command-interest-validator.cpp
@@ -20,7 +20,6 @@
  */
 
 #include "command-interest-validator.hpp"
-#include "v1/identity-certificate.hpp"
 #include <boost/lexical_cast.hpp>
 
 namespace ndn {
@@ -146,12 +145,14 @@
   }
 
   try {
-    keyName = v1::IdentityCertificate::certificateNameToPublicKeyName(keyLocator.getName());
+    v2::extractIdentityFromKeyName(keyLocator.getName());
   }
-  catch (const v1::IdentityCertificate::Error&) {
+  catch (const std::invalid_argument&) {
     return ErrorCode::BAD_CERT_NAME;
   }
 
+  keyName = keyLocator.getName();
+
   return ErrorCode::NONE;
 }
 
diff --git a/src/security/key-chain.hpp b/src/security/key-chain.hpp
index 31b26ea..2bd847b 100644
--- a/src/security/key-chain.hpp
+++ b/src/security/key-chain.hpp
@@ -19,21 +19,10 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-/**
- * @file security/key-chain.hpp
- */
+#ifndef NDN_CXX_SECURITY_KEY_CHAIN_HPP
+#define NDN_CXX_SECURITY_KEY_CHAIN_HPP
 
 #include "security-common.hpp"
-#include "v1/key-chain.hpp"
 #include "v2/key-chain.hpp"
 
-namespace ndn {
-namespace security {
-
-using security::v1::KeyChain;
-
-} // namespace security
-
-using ndn::security::KeyChain;
-
-} // namespace ndn
+#endif // NDN_CXX_SECURITY_KEY_CHAIN_HPP
diff --git a/src/security/v2/key-chain.hpp b/src/security/v2/key-chain.hpp
index f0299c3..e564326 100644
--- a/src/security/v2/key-chain.hpp
+++ b/src/security/v2/key-chain.hpp
@@ -503,6 +503,9 @@
 
 } // namespace v2
 } // namespace security
+
+using security::v2::KeyChain;
+
 } // namespace ndn
 
 #endif // NDN_SECURITY_V2_KEY_CHAIN_HPP
diff --git a/src/util/dummy-client-face.cpp b/src/util/dummy-client-face.cpp
index af1f702..79586c6 100644
--- a/src/util/dummy-client-face.cpp
+++ b/src/util/dummy-client-face.cpp
@@ -86,13 +86,13 @@
 
 DummyClientFace::DummyClientFace(const Options& options/* = DummyClientFace::DEFAULT_OPTIONS*/)
   : Face(make_shared<DummyClientFace::Transport>())
-  , m_internalKeyChain(new security::v1::KeyChain)
+  , m_internalKeyChain(new KeyChain)
   , m_keyChain(*m_internalKeyChain)
 {
   this->construct(options);
 }
 
-DummyClientFace::DummyClientFace(security::v1::KeyChain& keyChain,
+DummyClientFace::DummyClientFace(KeyChain& keyChain,
                                  const Options& options/* = DummyClientFace::DEFAULT_OPTIONS*/)
   : Face(make_shared<DummyClientFace::Transport>(), keyChain)
   , m_keyChain(keyChain)
@@ -103,13 +103,13 @@
 DummyClientFace::DummyClientFace(boost::asio::io_service& ioService,
                                  const Options& options/* = DummyClientFace::DEFAULT_OPTIONS*/)
   : Face(make_shared<DummyClientFace::Transport>(), ioService)
-  , m_internalKeyChain(new security::v1::KeyChain)
+  , m_internalKeyChain(new KeyChain)
   , m_keyChain(*m_internalKeyChain)
 {
   this->construct(options);
 }
 
-DummyClientFace::DummyClientFace(boost::asio::io_service& ioService, security::v1::KeyChain& keyChain,
+DummyClientFace::DummyClientFace(boost::asio::io_service& ioService, KeyChain& keyChain,
                                  const Options& options/* = DummyClientFace::DEFAULT_OPTIONS*/)
   : Face(make_shared<DummyClientFace::Transport>(), ioService, keyChain)
   , m_keyChain(keyChain)
diff --git a/src/util/dummy-client-face.hpp b/src/util/dummy-client-face.hpp
index cbf22f1..630913c 100644
--- a/src/util/dummy-client-face.hpp
+++ b/src/util/dummy-client-face.hpp
@@ -80,7 +80,7 @@
   /** \brief Create a dummy face with internal IO service and the specified KeyChain
    */
   explicit
-  DummyClientFace(security::v1::KeyChain& keyChain, const Options& options = Options());
+  DummyClientFace(KeyChain& keyChain, const Options& options = Options());
 
   /** \brief Create a dummy face with the provided IO service
    */
@@ -89,7 +89,7 @@
 
   /** \brief Create a dummy face with the provided IO service and the specified KeyChain
    */
-  DummyClientFace(boost::asio::io_service& ioService, security::v1::KeyChain& keyChain,
+  DummyClientFace(boost::asio::io_service& ioService, KeyChain& keyChain,
                   const Options& options = Options());
 
   /** \brief cause the Face to receive an interest
@@ -166,8 +166,8 @@
   Signal<DummyClientFace, lp::Nack> onSendNack;
 
 private:
-  std::unique_ptr<security::v1::KeyChain> m_internalKeyChain;
-  security::v1::KeyChain& m_keyChain;
+  std::unique_ptr<KeyChain> m_internalKeyChain;
+  KeyChain& m_keyChain;
   std::function<void(time::milliseconds)> m_processEventsOverride;
 };
 
diff --git a/src/util/notification-stream.hpp b/src/util/notification-stream.hpp
index 212f7e5..1c7887e 100644
--- a/src/util/notification-stream.hpp
+++ b/src/util/notification-stream.hpp
@@ -30,7 +30,7 @@
 
 #include "../name.hpp"
 #include "../face.hpp"
-#include "../security/v1/key-chain.hpp"
+#include "../security/v2/key-chain.hpp"
 
 #include "concepts.hpp"
 
diff --git a/tests/unit-tests/face.t.cpp b/tests/unit-tests/face.t.cpp
index 3f73f8a..8657613 100644
--- a/tests/unit-tests/face.t.cpp
+++ b/tests/unit-tests/face.t.cpp
@@ -36,7 +36,7 @@
 
 using ndn::util::DummyClientFace;
 
-class FaceFixture : public IdentityManagementV1TimeFixture
+class FaceFixture : public IdentityManagementTimeFixture
 {
 public:
   explicit
@@ -648,21 +648,18 @@
   const std::string PATH = "build/keys-with-default-tpm";
 };
 
-BOOST_FIXTURE_TEST_CASE(FaceTransport, PibDirFixture<PibDirWithDefaultTpm>)
+BOOST_FIXTURE_TEST_CASE(FaceTransport, IdentityManagementTimeFixture)
 {
-  KeyChain keyChain;
-  boost::asio::io_service io;
-
   BOOST_CHECK(Face().getTransport() != nullptr);
 
   BOOST_CHECK(Face(shared_ptr<Transport>()).getTransport() != nullptr);
   BOOST_CHECK(Face(shared_ptr<Transport>(), io).getTransport() != nullptr);
-  BOOST_CHECK(Face(shared_ptr<Transport>(), io, keyChain).getTransport() != nullptr);
+  BOOST_CHECK(Face(shared_ptr<Transport>(), io, m_keyChain).getTransport() != nullptr);
 
   auto transport = make_shared<TcpTransport>("localhost", "6363"); // no real io operations will be scheduled
   BOOST_CHECK(Face(transport).getTransport() == transport);
   BOOST_CHECK(Face(transport, io).getTransport() == transport);
-  BOOST_CHECK(Face(transport, io, keyChain).getTransport() == transport);
+  BOOST_CHECK(Face(transport, io, m_keyChain).getTransport() == transport);
 }
 
 class WithEnv : private IdentityManagementTimeFixture
diff --git a/tests/unit-tests/mgmt/dispatcher.t.cpp b/tests/unit-tests/mgmt/dispatcher.t.cpp
index 96623f5..6127ea0 100644
--- a/tests/unit-tests/mgmt/dispatcher.t.cpp
+++ b/tests/unit-tests/mgmt/dispatcher.t.cpp
@@ -34,7 +34,7 @@
 
 using namespace ndn::tests;
 
-class DispatcherFixture : public IdentityManagementV1TimeFixture
+class DispatcherFixture : public IdentityManagementTimeFixture
 {
 public:
   DispatcherFixture()
diff --git a/tests/unit-tests/mgmt/nfd/controller-fixture.hpp b/tests/unit-tests/mgmt/nfd/controller-fixture.hpp
index d64d77e..8f31f14 100644
--- a/tests/unit-tests/mgmt/nfd/controller-fixture.hpp
+++ b/tests/unit-tests/mgmt/nfd/controller-fixture.hpp
@@ -35,7 +35,7 @@
 
 using namespace ndn::tests;
 
-class ControllerFixture : public IdentityManagementV1TimeFixture
+class ControllerFixture : public IdentityManagementTimeFixture
 {
 protected:
   ControllerFixture()
@@ -45,8 +45,7 @@
     , datasetFailCallback(bind(&ControllerFixture::recordDatasetFail, this, _1, _2))
   {
     Name identityName("/localhost/ControllerFixture");
-    this->addIdentity(identityName);
-    m_keyChain.setDefaultIdentity(identityName);
+    m_keyChain.setDefaultIdentity(this->addIdentity(identityName));
   }
 
   /** \brief controls whether Controller's validator should accept or reject validation requests
diff --git a/tests/unit-tests/security/command-interest-validator.t.cpp b/tests/unit-tests/security/command-interest-validator.t.cpp
index cb01b36..e8c4eeb 100644
--- a/tests/unit-tests/security/command-interest-validator.t.cpp
+++ b/tests/unit-tests/security/command-interest-validator.t.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "security/command-interest-validator.hpp"
+#include "security/command-interest-signer.hpp"
 #include "security/signing-helpers.hpp"
 
 #include "boost-test.hpp"
@@ -35,10 +36,11 @@
 
 using namespace ndn::tests;
 
-class CommandInterestValidatorFixture : public IdentityManagementV1TimeFixture
+class CommandInterestValidatorFixture : public IdentityManagementTimeFixture
 {
 protected:
   CommandInterestValidatorFixture()
+    : signer(m_keyChain)
   {
     this->initialize(CommandInterestValidator::Options{});
   }
@@ -63,10 +65,8 @@
   shared_ptr<Interest>
   makeCommandInterest(uint64_t identity = 0)
   {
-    auto interest = makeInterest("/CommandInterestPrefix");
-    m_keyChain.sign(*interest, signingByIdentity(makeIdentity(identity)));
-    BOOST_TEST_MESSAGE("makeCommandInterest " << interest->getName());
-    return interest;
+    auto interest = signer.makeCommandInterest("/CommandInterestPrefix", signingByIdentity(makeIdentity(identity)));
+    return make_shared<Interest>(std::move(interest));
   }
 
   /** \brief check that validator accepts interest
@@ -75,7 +75,6 @@
   void
   assertAccept(const Interest& interest)
   {
-    BOOST_TEST_MESSAGE("assertAccept " << interest.getName());
     int nAccepts = 0;
     validator->validate(interest,
       [&nAccepts] (const shared_ptr<const Interest>&) { ++nAccepts; },
@@ -93,7 +92,6 @@
   void
   assertReject(const Interest& interest, CommandInterestValidator::ErrorCode error)
   {
-    BOOST_TEST_MESSAGE("assertReject " << interest.getName());
     int nRejects = 0;
     validator->validate(interest,
       [] (const shared_ptr<const Interest>&) {
@@ -109,6 +107,7 @@
   }
 
 protected:
+  CommandInterestSigner signer;
   DummyValidator* inner;
   unique_ptr<CommandInterestValidator> validator;
 };
diff --git a/tests/unit-tests/security/v2/key-chain.t.cpp b/tests/unit-tests/security/v2/key-chain.t.cpp
index 4eaf75e..d1a954c 100644
--- a/tests/unit-tests/security/v2/key-chain.t.cpp
+++ b/tests/unit-tests/security/v2/key-chain.t.cpp
@@ -47,6 +47,12 @@
     unsetenv("NDN_CLIENT_PIB");
     unsetenv("NDN_CLIENT_TPM");
   }
+
+  ~TestHomeAndPibFixture()
+  {
+    const_cast<std::string&>(KeyChain::getDefaultPibLocator()).clear();
+    const_cast<std::string&>(KeyChain::getDefaultTpmLocator()).clear();
+  }
 };
 
 struct PibPathConfigFileHome
diff --git a/tests/unit-tests/security/validator-config.t.cpp b/tests/unit-tests/security/validator-config.t.cpp
index 14ed721..74c29ae 100644
--- a/tests/unit-tests/security/validator-config.t.cpp
+++ b/tests/unit-tests/security/validator-config.t.cpp
@@ -49,12 +49,14 @@
 {
 public:
   ValidatorConfigFixture()
-    : face(nullptr, m_keyChain)
+    : m_v2KeyChain("pib-memory:", "tpm-memory:")
+    , face(nullptr, m_v2KeyChain)
     , validator(face)
   {
   }
 
 public:
+  v2::KeyChain m_v2KeyChain;
   Face face;
   ValidatorConfig validator;
 };
@@ -1078,8 +1080,8 @@
 struct FacesFixture : public ValidatorConfigFixture
 {
   FacesFixture()
-    : face1(io, m_keyChain, {true, true})
-    , face2(io, m_keyChain, {true, true})
+    : face1(io, m_v2KeyChain, {true, true})
+    , face2(io, m_v2KeyChain, {true, true})
     , readInterestOffset1(0)
     , readDataOffset1(0)
     , readInterestOffset2(0)
@@ -1486,11 +1488,11 @@
   advanceClocks(time::milliseconds(10), 20);
 }
 
-class DirectCertFetchFixture : public IdentityManagementV1TimeFixture
+class DirectCertFetchFixture : public ValidatorConfigFixture
 {
 public:
   DirectCertFetchFixture()
-    : clientFace(io, m_keyChain, {true, true})
+    : clientFace(io, m_v2KeyChain, {true, true})
     , validationResult(boost::logic::indeterminate)
   {
     auto certName = addIdentity(ca);
diff --git a/tests/unit-tests/util/dummy-client-face.t.cpp b/tests/unit-tests/util/dummy-client-face.t.cpp
index 2e7368d..809034d 100644
--- a/tests/unit-tests/util/dummy-client-face.t.cpp
+++ b/tests/unit-tests/util/dummy-client-face.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -22,6 +22,7 @@
 #include "util/dummy-client-face.hpp"
 
 #include "boost-test.hpp"
+#include "../identity-management-time-fixture.hpp"
 
 namespace ndn {
 namespace util {
@@ -30,7 +31,7 @@
 BOOST_AUTO_TEST_SUITE(Util)
 BOOST_AUTO_TEST_SUITE(TestDummyClientFace)
 
-BOOST_AUTO_TEST_CASE(ProcessEventsOverride)
+BOOST_FIXTURE_TEST_CASE(ProcessEventsOverride, ndn::tests::IdentityManagementTimeFixture)
 {
   bool isOverrideInvoked = false;
   auto override = [&] (time::milliseconds timeout) {
@@ -38,7 +39,7 @@
     BOOST_CHECK_EQUAL(timeout, time::milliseconds(200));
   };
 
-  DummyClientFace face({false, false, override});
+  DummyClientFace face(io, {false, false, override});
   face.processEvents(time::milliseconds(200));
   BOOST_CHECK(isOverrideInvoked);
 }
diff --git a/tests/unit-tests/util/notification-stream.t.cpp b/tests/unit-tests/util/notification-stream.t.cpp
index 3697c41..faedec8 100644
--- a/tests/unit-tests/util/notification-stream.t.cpp
+++ b/tests/unit-tests/util/notification-stream.t.cpp
@@ -37,7 +37,7 @@
 namespace tests {
 
 BOOST_AUTO_TEST_SUITE(Util)
-BOOST_FIXTURE_TEST_SUITE(TestNotificationStream, ndn::tests::IdentityManagementV1TimeFixture)
+BOOST_FIXTURE_TEST_SUITE(TestNotificationStream, ndn::tests::IdentityManagementTimeFixture)
 
 BOOST_AUTO_TEST_CASE(Post)
 {
diff --git a/tests/unit-tests/util/notification-subscriber.t.cpp b/tests/unit-tests/util/notification-subscriber.t.cpp
index e7144e9..30924f3 100644
--- a/tests/unit-tests/util/notification-subscriber.t.cpp
+++ b/tests/unit-tests/util/notification-subscriber.t.cpp
@@ -39,7 +39,7 @@
 
 using namespace ndn::tests;
 
-class NotificationSubscriberFixture : public IdentityManagementV1TimeFixture
+class NotificationSubscriberFixture : public IdentityManagementTimeFixture
 {
 public:
   NotificationSubscriberFixture()
diff --git a/tests/unit-tests/util/segment-fetcher.t.cpp b/tests/unit-tests/util/segment-fetcher.t.cpp
index 6d9ea36..02ef85b 100644
--- a/tests/unit-tests/util/segment-fetcher.t.cpp
+++ b/tests/unit-tests/util/segment-fetcher.t.cpp
@@ -40,7 +40,7 @@
 BOOST_AUTO_TEST_SUITE(Util)
 BOOST_AUTO_TEST_SUITE(TestSegmentFetcher)
 
-class Fixture : public IdentityManagementV1TimeFixture
+class Fixture : public IdentityManagementTimeFixture
 {
 public:
   Fixture()
diff --git a/tools/ndnsec/main.cpp b/tools/ndnsec/main.cpp
index b86fee1..4dc7ee0 100644
--- a/tools/ndnsec/main.cpp
+++ b/tools/ndnsec/main.cpp
@@ -23,7 +23,7 @@
 
 #include "version.hpp"
 
-#include "security/key-chain.hpp"
+#include "security/v1/key-chain.hpp"
 #include "security/v1/certificate-subject-description.hpp"
 #include "security/v1/secured-bag.hpp"
 
diff --git a/tools/ndnsec/util.hpp b/tools/ndnsec/util.hpp
index f096515..c026852 100644
--- a/tools/ndnsec/util.hpp
+++ b/tools/ndnsec/util.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -38,7 +38,7 @@
 #include <boost/exception/all.hpp>
 
 #include "encoding/buffer-stream.hpp"
-#include "security/key-chain.hpp"
+#include "security/v1/key-chain.hpp"
 #include "security/transform.hpp"
 #include "util/io.hpp"
 
@@ -137,34 +137,34 @@
     return this;
   }
 
-  virtual std::string
+  std::string
   name() const final
   {
     return std::string();
   }
 
   // There are no tokens for an AccumulatorType
-  virtual unsigned
+  unsigned
   min_tokens() const final
   {
     return 0;
   }
 
-  virtual unsigned
+  unsigned
   max_tokens() const final
   {
     return 0;
   }
 
   // Accumulating from different sources is silly.
-  virtual bool
+  bool
   is_composing() const final
   {
     return false;
   }
 
   // Requiring one or more appearances is unlikely.
-  virtual bool
+  bool
   is_required() const final
   {
     return false;
@@ -176,7 +176,7 @@
    * Every appearance of the option simply increments the value
    * There should never be any tokens.
    */
-  virtual void
+  void
   parse(boost::any& value_store,
         const std::vector<std::string>& new_tokens,
         bool utf8) const final
@@ -189,7 +189,7 @@
   /**
    * @brief If the option doesn't appear, this is the default value.
    */
-  virtual bool
+  bool
   apply_default(boost::any& value_store) const final
   {
     value_store = m_default;
@@ -199,7 +199,7 @@
   /**
    * @brief Notify the user function with the value of the value store.
    */
-  virtual void
+  void
   notify(const boost::any& value_store) const final
   {
     const T* val = boost::any_cast<T>(&value_store);
@@ -208,7 +208,7 @@
   }
 
 #if BOOST_VERSION >= 105900
-  virtual bool
+  bool
   adjacent_tokens_only() const final
   {
     return false;