security: Move KeyChain to security::v1 namespace and deprecated it

Change-Id: Ic4b6915ca15998a83b410f3f8fac027f797ee7ca
Refs: #3098
diff --git a/tools/ndnsec/cert-dump.hpp b/tools/ndnsec/cert-dump.hpp
index cd56e6e..2cfc661 100644
--- a/tools/ndnsec/cert-dump.hpp
+++ b/tools/ndnsec/cert-dump.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).
  *
@@ -130,7 +130,7 @@
 
   shared_ptr<v1::IdentityCertificate> certificate;
 
-  KeyChain keyChain;
+  ndn::security::v1::KeyChain keyChain;
 
   if (isIdentityName || isKeyName || isCertName) {
     if (isIdentityName) {
diff --git a/tools/ndnsec/cert-gen.hpp b/tools/ndnsec/cert-gen.hpp
index 04da040..4be98a1 100644
--- a/tools/ndnsec/cert-gen.hpp
+++ b/tools/ndnsec/cert-gen.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).
  *
@@ -37,7 +37,7 @@
   using namespace ndn::security;
   namespace po = boost::program_options;
 
-  KeyChain keyChain;
+  ndn::security::v1::KeyChain keyChain;
 
   std::string notBeforeStr;
   std::string notAfterStr;
@@ -46,7 +46,7 @@
   Name signId;
   std::string subjectInfo;
   std::vector<std::string> signedInfo;
-  Name certPrefix = KeyChain::DEFAULT_PREFIX; // to avoid displaying the default value
+  Name certPrefix = ndn::security::v1::KeyChain::DEFAULT_PREFIX; // to avoid displaying the default value
 
   po::options_description description(
     "General Usage\n"
diff --git a/tools/ndnsec/cert-install.hpp b/tools/ndnsec/cert-install.hpp
index a1416ff..f37f04a 100644
--- a/tools/ndnsec/cert-install.hpp
+++ b/tools/ndnsec/cert-install.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).
  *
@@ -188,7 +188,7 @@
   if (!static_cast<bool>(cert))
     return 1;
 
-  KeyChain keyChain;
+  ndn::security::v1::KeyChain keyChain;
 
   if (isSystemDefault) {
     keyChain.addCertificateAsIdentityDefault(*cert);
diff --git a/tools/ndnsec/cert-revoke.hpp b/tools/ndnsec/cert-revoke.hpp
index 6aa8d02..6e948e0 100644
--- a/tools/ndnsec/cert-revoke.hpp
+++ b/tools/ndnsec/cert-revoke.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).
  *
@@ -33,12 +33,12 @@
   using namespace ndn::security;
   namespace po = boost::program_options;
 
-  KeyChain keyChain;
+  ndn::security::v1::KeyChain keyChain;
 
   std::string requestFile("-");
   Name signId = keyChain.getDefaultIdentity();
   bool hasSignId = false;
-  Name certPrefix = KeyChain::DEFAULT_PREFIX;
+  Name certPrefix = ndn::security::v1::KeyChain::DEFAULT_PREFIX;
 
   po::options_description description("General Usage\n  ndnsec cert-revoke [-h] request\n"
                                       "General options");
@@ -108,7 +108,7 @@
     }
 
     Name certName;
-    if (certPrefix == KeyChain::DEFAULT_PREFIX) {
+    if (certPrefix == ndn::security::v1::KeyChain::DEFAULT_PREFIX) {
       certName = revokedCertificate->getName().getPrefix(-1);
     }
     else {
@@ -157,7 +157,7 @@
     std::cerr << "ERROR: Cannot determine the signing key!" << std::endl;
     return 1;
   }
-  catch (const SecPublicInfo::Error& e) {
+  catch (const v1::SecPublicInfo::Error& e) {
     std::cerr << "ERROR: Incomplete or corrupted PIB (" << e.what() << ")" << std::endl;
     return 1;
   }
diff --git a/tools/ndnsec/delete.hpp b/tools/ndnsec/delete.hpp
index 0c96af4..420af1c 100644
--- a/tools/ndnsec/delete.hpp
+++ b/tools/ndnsec/delete.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).
  *
@@ -82,7 +82,7 @@
   else if (vm.count("delete-key") != 0 || vm.count("delete-key2") != 0)
     isDeleteKey = true;
 
-  KeyChain keyChain;
+  ndn::security::v1::KeyChain keyChain;
 
   try {
     if (isDeleteCert) {
@@ -114,15 +114,15 @@
       std::cerr << "OK: Delete identity: " << name << std::endl;
     }
   }
-  catch (const SecPublicInfo::Error& e) {
+  catch (const ndn::security::v1::SecPublicInfo::Error& e) {
     std::cerr << "ERROR: Cannot delete the item: " << e.what() << std::endl;
     return 2;
   }
-  catch (const SecTpm::Error& e) {
+  catch (const ndn::security::v1::SecTpm::Error& e) {
     std::cerr << "ERROR: Cannot delete the item: " << e.what() << std::endl;
     return 2;
   }
-  catch (const KeyChain::Error& e) {
+  catch (const ndn::security::v1::KeyChain::Error& e) {
     std::cerr << "ERROR: " << e.what() << std::endl;
     return 2;
   }
diff --git a/tools/ndnsec/dsk-gen.hpp b/tools/ndnsec/dsk-gen.hpp
index 4f994c3..207100e 100644
--- a/tools/ndnsec/dsk-gen.hpp
+++ b/tools/ndnsec/dsk-gen.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).
  *
@@ -77,7 +77,7 @@
   shared_ptr<v1::IdentityCertificate> kskCert;
   Name signingCertName;
 
-  KeyChain keyChain;
+  ndn::security::v1::KeyChain keyChain;
 
   try {
     Name defaultCertName = keyChain.getDefaultCertificateNameForIdentity(identityName);
diff --git a/tools/ndnsec/export.hpp b/tools/ndnsec/export.hpp
index cd0c786..45c3d32 100644
--- a/tools/ndnsec/export.hpp
+++ b/tools/ndnsec/export.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).
  *
@@ -79,7 +79,7 @@
 
   Name identity(identityStr);
   if (!isPrivateExport) {
-    KeyChain keyChain;
+    ndn::security::v1::KeyChain keyChain;
     shared_ptr<security::v1::IdentityCertificate> cert
       = keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(identity));
 
@@ -93,7 +93,7 @@
   else {
     Block wire;
     try {
-      KeyChain keyChain;
+      ndn::security::v1::KeyChain keyChain;
 
       int count = 3;
       while (!getPassword(exportPassword, "Passphrase for the private key: ")) {
@@ -104,7 +104,7 @@
           return 1;
         }
       }
-      shared_ptr<SecuredBag> securedBag = keyChain.exportIdentity(identity, exportPassword);
+      shared_ptr<ndn::security::v1::SecuredBag> securedBag = keyChain.exportIdentity(identity, exportPassword);
       memset(const_cast<char*>(exportPassword.c_str()), 0, exportPassword.size());
 
       if (output == "-")
diff --git a/tools/ndnsec/get-default.hpp b/tools/ndnsec/get-default.hpp
index 41f4f2a..b701015 100644
--- a/tools/ndnsec/get-default.hpp
+++ b/tools/ndnsec/get-default.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2015 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).
  *
@@ -26,7 +26,6 @@
 
 #include "util.hpp"
 
-
 int
 ndnsec_get_default(int argc, char** argv)
 {
@@ -85,7 +84,7 @@
       isQuiet = true;
     }
 
-  KeyChain keyChain;
+  ndn::security::v1::KeyChain keyChain;
 
   if (vm.count("key") != 0)
     {
diff --git a/tools/ndnsec/import.hpp b/tools/ndnsec/import.hpp
index 3a42c1b..41cf602 100644
--- a/tools/ndnsec/import.hpp
+++ b/tools/ndnsec/import.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2015 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).
  *
@@ -79,13 +79,13 @@
     {
       try
         {
-          KeyChain keyChain;
+          ndn::security::v1::KeyChain keyChain;
 
-          shared_ptr<SecuredBag> securedBag;
+          shared_ptr<ndn::security::v1::SecuredBag> securedBag;
           if (input == "-")
-            securedBag = io::load<SecuredBag>(std::cin);
+            securedBag = io::load<ndn::security::v1::SecuredBag>(std::cin);
           else
-            securedBag = io::load<SecuredBag>(input);
+            securedBag = io::load<ndn::security::v1::SecuredBag>(input);
 
           int count = 3;
           while (!getPassword(importPassword, "Passphrase for the private key: "))
diff --git a/tools/ndnsec/key-gen.hpp b/tools/ndnsec/key-gen.hpp
index 1384ac8..5be5ce7 100644
--- a/tools/ndnsec/key-gen.hpp
+++ b/tools/ndnsec/key-gen.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).
  *
@@ -85,7 +85,7 @@
 
   bool isKsk = (vm.count("dsk") == 0);
 
-  KeyChain keyChain;
+  ndn::security::v1::KeyChain keyChain;
   Name keyName;
 
   try {
diff --git a/tools/ndnsec/list.hpp b/tools/ndnsec/list.hpp
index 8a750f2..d7d3c4f 100644
--- a/tools/ndnsec/list.hpp
+++ b/tools/ndnsec/list.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).
  *
@@ -27,7 +27,7 @@
 #include "util.hpp"
 
 void
-printCertificate(ndn::KeyChain& keyChain,
+printCertificate(ndn::security::v1::KeyChain& keyChain,
                  const ndn::Name& certName,
                  bool isDefault,
                  int verboseLevel)
@@ -47,7 +47,7 @@
 }
 
 void
-printKey(ndn::KeyChain& keyChain,
+printKey(ndn::security::v1::KeyChain& keyChain,
          const ndn::Name& keyName,
          bool isDefault,
          int verboseLevel)
@@ -74,7 +74,7 @@
 }
 
 void
-printIdentity(ndn::KeyChain& keyChain,
+printIdentity(ndn::security::v1::KeyChain& keyChain,
               const ndn::Name& identity,
               bool isDefault,
               int verboseLevel)
@@ -154,7 +154,7 @@
 
   verboseLevel = std::max(verboseLevel, tmpVerboseLevel);
 
-  KeyChain keyChain;
+  ndn::security::v1::KeyChain keyChain;
 
   std::vector<Name> defaultIdentities;
   keyChain.getAllIdentities(defaultIdentities, true);
diff --git a/tools/ndnsec/main.cpp b/tools/ndnsec/main.cpp
index f0c97b7..b86fee1 100644
--- a/tools/ndnsec/main.cpp
+++ b/tools/ndnsec/main.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2015 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).
  *
@@ -23,6 +23,10 @@
 
 #include "version.hpp"
 
+#include "security/key-chain.hpp"
+#include "security/v1/certificate-subject-description.hpp"
+#include "security/v1/secured-bag.hpp"
+
 #include "util.hpp"
 #include "list.hpp"
 #include "get-default.hpp"
@@ -37,12 +41,13 @@
 #include "export.hpp"
 #include "import.hpp"
 #include "delete.hpp"
-#include "sig-verify.hpp"
 #include "set-acl.hpp"
 #include "unlock-tpm.hpp"
 #include "op-tool.hpp"
 
 using namespace ndn;
+using namespace ndn::security;
+using namespace ndn::security::v1;
 
 std::string ndnsec_helper("\
   help         Show all commands.\n\
@@ -60,7 +65,6 @@
   delete       Delete identity/key/certificate.\n\
   export       Export an identity package.\n\
   import       Import an identity package.\n\
-  sig-verify   Verify the signature of a Data packet.\n\
   set-acl      Configure ACL of a private key.\n\
   unlock-tpm   Unlock Tpm.\n\
   op-tool      Operator tool.\n\
@@ -95,7 +99,6 @@
       else if (command == "delete")       { return ndnsec_delete(argc - 1, argv + 1); }
       else if (command == "export")       { return ndnsec_export(argc - 1, argv + 1); }
       else if (command == "import")       { return ndnsec_import(argc - 1, argv + 1); }
-      else if (command == "sig-verify")   { return ndnsec_sig_verify(argc - 1, argv + 1); }
       else if (command == "set-acl")      { return ndnsec_set_acl(argc - 1, argv + 1); }
       else if (command == "unlock-tpm")   { return ndnsec_unlock_tpm(argc - 1, argv + 1); }
       else if (command == "op-tool")      { return ndnsec_op_tool(argc - 1, argv + 1); }
diff --git a/tools/ndnsec/op-tool.hpp b/tools/ndnsec/op-tool.hpp
index 5766949..971ad98 100644
--- a/tools/ndnsec/op-tool.hpp
+++ b/tools/ndnsec/op-tool.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).
  *
@@ -72,7 +72,7 @@
 
   if (command == "sign") // the content to be signed from stdin
     {
-      KeyChain keyChain;
+      ndn::security::v1::KeyChain keyChain;
 
       Buffer dataToSign((std::istreambuf_iterator<char>(std::cin)), std::istreambuf_iterator<char>());
 
diff --git a/tools/ndnsec/set-acl.hpp b/tools/ndnsec/set-acl.hpp
index ca639b6..cf12d55 100644
--- a/tools/ndnsec/set-acl.hpp
+++ b/tools/ndnsec/set-acl.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).
  *
@@ -79,7 +79,7 @@
       return 1;
     }
 
-  KeyChain keyChain;
+  ndn::security::v1::KeyChain keyChain;
   keyChain.addAppToAcl(keyName, KeyClass::PRIVATE, appPath, AclType::PRIVATE);
 
   return 0;
diff --git a/tools/ndnsec/set-default.hpp b/tools/ndnsec/set-default.hpp
index ed23b6f..d1ff7fa 100644
--- a/tools/ndnsec/set-default.hpp
+++ b/tools/ndnsec/set-default.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2015 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).
  *
@@ -73,7 +73,7 @@
       return 1;
     }
 
-  KeyChain keyChain;
+  ndn::security::v1::KeyChain keyChain;
 
   if (vm.count("default_key") != 0)
     {
diff --git a/tools/ndnsec/sig-verify.hpp b/tools/ndnsec/sig-verify.hpp
deleted file mode 100644
index 28107ce..0000000
--- a/tools/ndnsec/sig-verify.hpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2015 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- *
- * @author Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/>
- */
-
-#ifndef NDN_TOOLS_NDNSEC_SIG_VERIFY_HPP
-#define NDN_TOOLS_NDNSEC_SIG_VERIFY_HPP
-
-#include "util.hpp"
-
-// using namespace ndn;
-// namespace po = boost::program_options;
-
-// shared_ptr<IdentityCertificate>
-// getCertificate(const std::string& certString)
-// {
-//   std::string decoded;
-//   CryptoPP::StringSource ss2(reinterpret_cast<const unsigned char *>(certString.c_str()), certString.size(), true,
-//                              new CryptoPP::Base64Decoder(new CryptoPP::StringSink(decoded)));
-
-//   Data data;
-//   data.wireDecode(Block(make_shared<Buffer>(decoded.begin(), decoded.end())));
-
-//   shared_ptr<IdentityCertificate> identityCertificate = make_shared<IdentityCertificate>(data);
-
-//   return identityCertificate;
-// }
-
-// bool
-// verifySignature(shared_ptr<IdentityCertificate> certificate, bool isDataPacket)
-// {
-//   throw std::runtime_error("Not supported yet");
-//   // if(isDataPacket)
-//   //   {
-//   //     std::string decoded;
-//   //     CryptoPP::FileSource ss2(cin, true,
-//   //                              new CryptoPP::Base64Decoder(new CryptoPP::StringSink(decoded)));
-
-//   //     Data data;
-//   //     data.wireDecode(make_shared<Buffer>(decoded.c_str(), decoded.size()));
-//   //     return PolicyManager::verifySignature(data, certificate->getPublicKeyInfo());
-//   //   }
-//   // else
-//   //   {
-//   //     // The first two bytes indicates the boundary of the of the signed data and signature.
-//   //     // for example, if the size of the signed data is 300, then the boundary should be 300, so the first two bytes should be: 0x01 0x2C
-//   //     shared_ptr<Blob> input = shared_ptr<Blob>(new Blob ((istreambuf_iterator<char>(cin)), istreambuf_iterator<char>()));
-//   //     size_t size = input->at(0);
-//   //     size = ((size << 8) + input->at(1));
-
-//   //     Blob signedBlob(input->buf()+2, size);
-//   //     Blob signature(input->buf()+2+size, input->size()-2-size);
-
-//   //     return PolicyManager::verifySignature(signedBlob, signature, certificate->getPublicKeyInfo());
-//   //   }
-// }
-
-int
-ndnsec_sig_verify(int argc, char** argv)
-{
-  std::cerr << "Not supported yet" << std::endl;
-  return 1;
-  // bool isDataPacket = false;
-  // std::string certString;
-
-  // po::options_description desc("General Usage\n  ndn-sig-verify [-h] [-d] certificate\nGeneral options");
-  // desc.add_options()
-  //   ("help,h", "produce help message")
-  //   ("data,d", "if specified, input from stdin will be treated as a Data packet, otherwise binary data")
-  //   ("certificate,c", po::value<std::string>(&certString), "the certificate bits")
-  //   ;
-
-  // po::positional_options_description p;
-  // p.add("certificate", 1);
-
-  // po::variables_map vm;
-  // try
-  //   {
-  //     po::store(po::command_line_parser(argc, argv).options(desc).positional(p).run(), vm);
-  //     po::notify(vm);
-  //   }
-  // catch( const std::exception& e)
-  //   {
-  //     std::cerr << e.what() << std::endl;
-  //     std::cerr << desc << std::endl;
-  //     return 1;
-  //   }
-
-  // if (vm.count("help") || vm.count("certificate")==0)
-  //   {
-  //     std::cerr << desc << std::endl;
-  //     return 1;
-  //   }
-  // if (vm.count("data"))
-  //   isDataPacket = true;
-
-  // try
-  //   {
-  //     shared_ptr<IdentityCertificate> certificate = getCertificate(certString);
-  //     bool res = verifySignature(certificate, isDataPacket);
-  //     return (res ? 0 : 1);
-  //   }
-  // catch(const std::exception &e)
-  //   {
-  //     std::cerr << "ERROR: " << e.what() << std::endl;
-  //     return 1;
-  //   }
-}
-
-#endif // NDN_TOOLS_NDNSEC_SIG_VERIFY_HPP
diff --git a/tools/ndnsec/sign-req.hpp b/tools/ndnsec/sign-req.hpp
index bb8906e..425839f 100644
--- a/tools/ndnsec/sign-req.hpp
+++ b/tools/ndnsec/sign-req.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).
  *
@@ -78,7 +78,7 @@
 
   shared_ptr<v1::IdentityCertificate> selfSignCert;
 
-  KeyChain keyChain;
+  ndn::security::v1::KeyChain keyChain;
 
   if (isKeyName)
     selfSignCert = keyChain.selfSign(name);
diff --git a/tools/ndnsec/unlock-tpm.hpp b/tools/ndnsec/unlock-tpm.hpp
index 2127848..927bc81 100644
--- a/tools/ndnsec/unlock-tpm.hpp
+++ b/tools/ndnsec/unlock-tpm.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2015 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).
  *
@@ -62,7 +62,7 @@
 
   bool isUnlocked = false;
 
-  KeyChain keyChain;
+  ndn::security::v1::KeyChain keyChain;
 
   char* password;
   password = getpass("Password to unlock the TPM: ");