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

Change-Id: Ic4b6915ca15998a83b410f3f8fac027f797ee7ca
Refs: #3098
diff --git a/tests/identity-management-fixture.cpp b/tests/identity-management-fixture.cpp
index 0b296f7..6767d62 100644
--- a/tests/identity-management-fixture.cpp
+++ b/tests/identity-management-fixture.cpp
@@ -60,11 +60,11 @@
 IdentityManagementFixture::saveIdentityCertificate(const Name& identity,
                                                    const std::string& filename, bool wantAdd)
 {
-  shared_ptr<ndn::IdentityCertificate> cert;
+  shared_ptr<security::v1::IdentityCertificate> cert;
   try {
     cert = m_keyChain.getCertificate(m_keyChain.getDefaultCertificateNameForIdentity(identity));
   }
-  catch (const ndn::SecPublicInfo::Error&) {
+  catch (const security::v1::SecPublicInfo::Error&) {
     if (wantAdd && this->addIdentity(identity)) {
       return this->saveIdentityCertificate(identity, filename, false);
     }
@@ -73,10 +73,10 @@
 
   m_certFiles.push_back(filename);
   try {
-    ndn::io::save(*cert, filename);
+    io::save(*cert, filename);
     return true;
   }
-  catch (const ndn::io::Error&) {
+  catch (const io::Error&) {
     return false;
   }
 }
@@ -94,11 +94,11 @@
   try {
     identityKeyName = m_keyChain.getDefaultKeyNameForIdentity(identity);
   }
-  catch (const ndn::SecPublicInfo::Error&) {
+  catch (const security::v1::SecPublicInfo::Error&) {
     identityKeyName = m_keyChain.generateRsaKeyPairAsDefault(identity, true);
   }
-  std::vector<ndn::CertificateSubjectDescription> subjectDescription;
-  shared_ptr<ndn::IdentityCertificate> identityCert =
+  std::vector<security::v1::CertificateSubjectDescription> subjectDescription;
+  shared_ptr<security::v1::IdentityCertificate> identityCert =
     m_keyChain.prepareUnsignedIdentityCertificate(identityKeyName,
                                                   issuer,
                                                   time::system_clock::now(),
diff --git a/tests/identity-management-fixture.hpp b/tests/identity-management-fixture.hpp
index d792a3f..f96a24c 100644
--- a/tests/identity-management-fixture.hpp
+++ b/tests/identity-management-fixture.hpp
@@ -22,7 +22,7 @@
 #ifndef NDN_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
 #define NDN_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
 
-#include "security/key-chain.hpp"
+#include "security/v1/key-chain.hpp"
 #include "security/signing-helpers.hpp"
 #include <vector>
 
@@ -46,7 +46,7 @@
 
   /// @brief add identity, return true if succeed.
   bool
-  addIdentity(const Name& identity, const KeyParams& params = KeyChain::DEFAULT_KEY_PARAMS);
+  addIdentity(const Name& identity, const KeyParams& params = security::v1::KeyChain::DEFAULT_KEY_PARAMS);
 
   /**
    *  @brief save identity certificate to a file
@@ -68,10 +68,10 @@
    */
   bool
   addSubCertificate(const Name& identity, const Name& issuer,
-                    const KeyParams& params = KeyChain::DEFAULT_KEY_PARAMS);
+                    const KeyParams& params = security::v1::KeyChain::DEFAULT_KEY_PARAMS);
 
 protected:
-  KeyChain m_keyChain;
+  security::v1::KeyChain m_keyChain;
 
 private:
   std::vector<Name> m_identities;
diff --git a/tests/integrated/face.cpp b/tests/integrated/face.cpp
index 114544f..799a562 100644
--- a/tests/integrated/face.cpp
+++ b/tests/integrated/face.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).
  *
@@ -25,7 +25,6 @@
 
 #include "face.hpp"
 #include "util/scheduler.hpp"
-#include "security/key-chain.hpp"
 
 #include "identity-management-fixture.hpp"
 #include "boost-test.hpp"
diff --git a/tests/key-chain-fixture.hpp b/tests/key-chain-fixture.hpp
index 9301b23..014f572 100644
--- a/tests/key-chain-fixture.hpp
+++ b/tests/key-chain-fixture.hpp
@@ -22,7 +22,6 @@
 #ifndef NDN_TESTS_KEY_CHAIN_FIXTURE_HPP
 #define NDN_TESTS_KEY_CHAIN_FIXTURE_HPP
 
-#include "security/key-chain.hpp"
 #include "security/v2/key-chain.hpp"
 
 #include "boost-test.hpp"
diff --git a/tests/unit-tests/data.t.cpp b/tests/unit-tests/data.t.cpp
index 2940c77..0cf8aae 100644
--- a/tests/unit-tests/data.t.cpp
+++ b/tests/unit-tests/data.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).
  *
@@ -20,7 +20,6 @@
  */
 
 #include "data.hpp"
-#include "security/key-chain.hpp"
 #include "security/v1/cryptopp.hpp"
 #include "encoding/buffer-stream.hpp"
 
diff --git a/tests/unit-tests/face.t.cpp b/tests/unit-tests/face.t.cpp
index 0b1c479..7d4c9c8 100644
--- a/tests/unit-tests/face.t.cpp
+++ b/tests/unit-tests/face.t.cpp
@@ -21,7 +21,6 @@
 
 #include "face.hpp"
 #include "lp/tags.hpp"
-#include "security/key-chain.hpp"
 #include "transport/tcp-transport.hpp"
 #include "transport/unix-transport.hpp"
 #include "util/dummy-client-face.hpp"
diff --git a/tests/unit-tests/interest.t.cpp b/tests/unit-tests/interest.t.cpp
index 969bdbd..aee782f 100644
--- a/tests/unit-tests/interest.t.cpp
+++ b/tests/unit-tests/interest.t.cpp
@@ -24,7 +24,6 @@
 #include "data.hpp"
 #include "security/signature-sha256-with-rsa.hpp"
 #include "security/digest-sha256.hpp"
-#include "security/key-chain.hpp"
 #include "encoding/buffer-stream.hpp"
 
 #include "boost-test.hpp"
diff --git a/tests/unit-tests/link.t.cpp b/tests/unit-tests/link.t.cpp
index 3858036..6e29a5e 100644
--- a/tests/unit-tests/link.t.cpp
+++ b/tests/unit-tests/link.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).
  *
@@ -20,7 +20,6 @@
  */
 
 #include "link.hpp"
-#include "security/key-chain.hpp"
 #include "security/v1/cryptopp.hpp"
 #include "encoding/buffer-stream.hpp"
 
diff --git a/tests/unit-tests/meta-info.t.cpp b/tests/unit-tests/meta-info.t.cpp
index 3fd8b3c..ad83119 100644
--- a/tests/unit-tests/meta-info.t.cpp
+++ b/tests/unit-tests/meta-info.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).
  *
@@ -20,11 +20,10 @@
  */
 
 #include "meta-info.hpp"
-
 #include "data.hpp"
-#include "security/key-chain.hpp"
 #include "security/v1/cryptopp.hpp"
 #include "encoding/buffer-stream.hpp"
+
 #include "boost-test.hpp"
 
 namespace ndn {
diff --git a/tests/unit-tests/security/conf/checker.t.cpp b/tests/unit-tests/security/conf/checker.t.cpp
index 5ba5ad8..9ddf43a 100644
--- a/tests/unit-tests/security/conf/checker.t.cpp
+++ b/tests/unit-tests/security/conf/checker.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).
  *
@@ -20,7 +20,6 @@
  */
 
 #include "security/conf/checker.hpp"
-#include "security/key-chain.hpp"
 
 #include "boost-test.hpp"
 #include "identity-management-fixture.hpp"
diff --git a/tests/unit-tests/security/digest-sha256.t.cpp b/tests/unit-tests/security/digest-sha256.t.cpp
index cbac8e2..732efe6 100644
--- a/tests/unit-tests/security/digest-sha256.t.cpp
+++ b/tests/unit-tests/security/digest-sha256.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).
  *
@@ -20,7 +20,6 @@
  */
 
 #include "security/digest-sha256.hpp"
-#include "security/key-chain.hpp"
 #include "security/validator.hpp"
 #include "util/string-helper.hpp"
 
diff --git a/tests/unit-tests/security/sec-rule-specific.t.cpp b/tests/unit-tests/security/sec-rule-specific.t.cpp
index e69d0ee..d8c5d24 100644
--- a/tests/unit-tests/security/sec-rule-specific.t.cpp
+++ b/tests/unit-tests/security/sec-rule-specific.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).
  *
@@ -20,10 +20,9 @@
  */
 
 #include "security/sec-rule-specific.hpp"
-#include "security/key-chain.hpp"
-#include "identity-management-fixture.hpp"
 
 #include "boost-test.hpp"
+#include "identity-management-fixture.hpp"
 
 namespace ndn {
 namespace security {
diff --git a/tests/unit-tests/security/signature-sha256-with-ecdsa.t.cpp b/tests/unit-tests/security/signature-sha256-with-ecdsa.t.cpp
index 448734b..c54ee4c 100644
--- a/tests/unit-tests/security/signature-sha256-with-ecdsa.t.cpp
+++ b/tests/unit-tests/security/signature-sha256-with-ecdsa.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).
  *
@@ -20,7 +20,6 @@
  */
 
 #include "security/signature-sha256-with-ecdsa.hpp"
-#include "security/key-chain.hpp"
 #include "security/validator.hpp"
 #include "util/scheduler.hpp"
 
diff --git a/tests/unit-tests/security/signature-sha256-with-rsa.t.cpp b/tests/unit-tests/security/signature-sha256-with-rsa.t.cpp
index 75fc6be..494ea71 100644
--- a/tests/unit-tests/security/signature-sha256-with-rsa.t.cpp
+++ b/tests/unit-tests/security/signature-sha256-with-rsa.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).
  *
@@ -20,7 +20,6 @@
  */
 
 #include "security/signature-sha256-with-rsa.hpp"
-#include "security/key-chain.hpp"
 #include "security/validator.hpp"
 #include "util/scheduler.hpp"
 
diff --git a/tests/unit-tests/security/signing-info.t.cpp b/tests/unit-tests/security/signing-info.t.cpp
index cfada95..f111059 100644
--- a/tests/unit-tests/security/signing-info.t.cpp
+++ b/tests/unit-tests/security/signing-info.t.cpp
@@ -20,7 +20,6 @@
  */
 
 #include "security/signing-info.hpp"
-#include "security/key-chain.hpp"
 
 #include "boost-test.hpp"
 
diff --git a/tests/unit-tests/security/v1/certificate.t.cpp b/tests/unit-tests/security/v1/certificate.t.cpp
index 043a1fb..5b410c5 100644
--- a/tests/unit-tests/security/v1/certificate.t.cpp
+++ b/tests/unit-tests/security/v1/certificate.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,8 +22,6 @@
 #include "security/v1/certificate.hpp"
 #include "security/v1/public-key.hpp"
 
-#include "security/key-chain.hpp"
-
 #include "security/v1/cryptopp.hpp"
 
 #include "boost-test.hpp"
diff --git a/tests/unit-tests/security/dummy-keychain.cpp b/tests/unit-tests/security/v1/dummy-keychain.cpp
similarity index 96%
rename from tests/unit-tests/security/dummy-keychain.cpp
rename to tests/unit-tests/security/v1/dummy-keychain.cpp
index c173117..21db30c 100644
--- a/tests/unit-tests/security/dummy-keychain.cpp
+++ b/tests/unit-tests/security/v1/dummy-keychain.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).
  *
@@ -26,6 +26,7 @@
 
 namespace ndn {
 namespace security {
+namespace v1 {
 
 static const uint8_t DUMMY_CERT[] =
   "Bv0C8Ac4CAVkdW1teQgDa2V5CANLRVkIEWtzay0xNDE4NjAwMzkxMDUwCAdJRC1D"
@@ -67,14 +68,14 @@
 const std::string DummyPublicInfo::SCHEME = "pib-dummy";
 const std::string DummyTpm::SCHEME = "tpm-dummy";
 
-NDN_CXX_KEYCHAIN_REGISTER_PIB(DummyPublicInfo, "pib-dummy", "dummy");
-NDN_CXX_KEYCHAIN_REGISTER_TPM(DummyTpm, "tpm-dummy", "dummy");
+NDN_CXX_V1_KEYCHAIN_REGISTER_PIB(DummyPublicInfo, "pib-dummy", "dummy");
+NDN_CXX_V1_KEYCHAIN_REGISTER_TPM(DummyTpm, "tpm-dummy", "dummy");
 
 typedef DummyPublicInfo DummyPublicInfo2;
 typedef DummyTpm DummyTpm2;
 
-NDN_CXX_KEYCHAIN_REGISTER_PIB(DummyPublicInfo2, "pib-dummy2");
-NDN_CXX_KEYCHAIN_REGISTER_TPM(DummyTpm2, "tpm-dummy2");
+NDN_CXX_V1_KEYCHAIN_REGISTER_PIB(DummyPublicInfo2, "pib-dummy2");
+NDN_CXX_V1_KEYCHAIN_REGISTER_TPM(DummyTpm2, "tpm-dummy2");
 
 DummyPublicInfo::DummyPublicInfo(const std::string& locator)
   : SecPublicInfo(locator)
@@ -389,5 +390,6 @@
   return DummyTpm::SCHEME;
 }
 
+} // namespace v1
 } // namespace security
 } // namespace ndn
diff --git a/tests/unit-tests/security/dummy-keychain.hpp b/tests/unit-tests/security/v1/dummy-keychain.hpp
similarity index 94%
rename from tests/unit-tests/security/dummy-keychain.hpp
rename to tests/unit-tests/security/v1/dummy-keychain.hpp
index 7d5682e..3fe2101 100644
--- a/tests/unit-tests/security/dummy-keychain.hpp
+++ b/tests/unit-tests/security/v1/dummy-keychain.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).
  *
@@ -19,13 +19,14 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#ifndef NDN_TESTS_SECURITY_DUMMY_KEYCHAIN_HPP
-#define NDN_TESTS_SECURITY_DUMMY_KEYCHAIN_HPP
+#ifndef NDN_TESTS_SECURITY_V1_DUMMY_KEYCHAIN_HPP
+#define NDN_TESTS_SECURITY_V1_DUMMY_KEYCHAIN_HPP
 
-#include "security/key-chain.hpp"
+#include "security/v1/key-chain.hpp"
 
 namespace ndn {
 namespace security {
+namespace v1 {
 
 class DummyPublicInfo : public SecPublicInfo
 {
@@ -197,7 +198,8 @@
   static const std::string SCHEME;
 };
 
+} // namespace v1
 } // namespace security
 } // namespace ndn
 
-#endif // NDN_TESTS_SECURITY_DUMMY_KEYCHAIN_HPP
+#endif // NDN_TESTS_SECURITY_V1_DUMMY_KEYCHAIN_HPP
diff --git a/tests/unit-tests/security/key-chain.t.cpp b/tests/unit-tests/security/v1/key-chain.t.cpp
similarity index 98%
rename from tests/unit-tests/security/key-chain.t.cpp
rename to tests/unit-tests/security/v1/key-chain.t.cpp
index 8009daa..6130cae 100644
--- a/tests/unit-tests/security/key-chain.t.cpp
+++ b/tests/unit-tests/security/v1/key-chain.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).
  *
@@ -19,13 +19,13 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#include "security/key-chain.hpp"
+#include "security/v1/key-chain.hpp"
 #include "security/validator.hpp"
 #include "security/signing-helpers.hpp"
 
 #include "boost-test.hpp"
 #include "dummy-keychain.hpp"
-#include "../test-home-env-saver.hpp"
+#include "../../test-home-env-saver.hpp"
 #include "key-chain-fixture.hpp"
 #include "identity-management-fixture.hpp"
 
@@ -35,11 +35,13 @@
 
 namespace ndn {
 namespace security {
+namespace v1 {
 namespace tests {
 
 using namespace ndn::tests;
 
 BOOST_AUTO_TEST_SUITE(Security)
+BOOST_AUTO_TEST_SUITE(V1)
 BOOST_FIXTURE_TEST_SUITE(TestKeyChain, TestHomeEnvSaver)
 
 template<class Path>
@@ -419,8 +421,10 @@
 }
 
 BOOST_AUTO_TEST_SUITE_END() // TestKeyChain
+BOOST_AUTO_TEST_SUITE_END() // V1
 BOOST_AUTO_TEST_SUITE_END() // Security
 
 } // namespace tests
+} // namespace v1
 } // namespace security
 } // namespace ndn
diff --git a/tests/unit-tests/security/sec-public-info-sqlite3.t.cpp b/tests/unit-tests/security/v1/sec-public-info-sqlite3.t.cpp
similarity index 95%
rename from tests/unit-tests/security/sec-public-info-sqlite3.t.cpp
rename to tests/unit-tests/security/v1/sec-public-info-sqlite3.t.cpp
index 245babc..e2d668b 100644
--- a/tests/unit-tests/security/sec-public-info-sqlite3.t.cpp
+++ b/tests/unit-tests/security/v1/sec-public-info-sqlite3.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).
  *
@@ -19,8 +19,8 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#include "security/sec-public-info-sqlite3.hpp"
-#include "security/key-chain.hpp"
+#include "security/v1/sec-public-info-sqlite3.hpp"
+#include "security/v1/key-chain.hpp"
 #include "security/v1/cryptopp.hpp"
 #include "encoding/buffer-stream.hpp"
 #include "util/time.hpp"
@@ -32,6 +32,7 @@
 
 namespace ndn {
 namespace security {
+namespace v1 {
 namespace tests {
 
 class PibTmpPathFixture
@@ -55,6 +56,7 @@
 };
 
 BOOST_AUTO_TEST_SUITE(Security)
+BOOST_AUTO_TEST_SUITE(V1)
 BOOST_AUTO_TEST_SUITE(TestSecPublicInfoSqlite3)
 
 const std::string RSA_DER("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuFoDcNtffwbfFix64fw0\
@@ -145,8 +147,10 @@
 }
 
 BOOST_AUTO_TEST_SUITE_END() // TestSecPublicInfoSqlite3
+BOOST_AUTO_TEST_SUITE_END() // V1
 BOOST_AUTO_TEST_SUITE_END() // Security
 
 } // namespace tests
+} // namespace v1
 } // namespace security
 } // namespace ndn
diff --git a/tests/unit-tests/security/sec-tpm-file.t.cpp b/tests/unit-tests/security/v1/sec-tpm-file.t.cpp
similarity index 98%
rename from tests/unit-tests/security/sec-tpm-file.t.cpp
rename to tests/unit-tests/security/v1/sec-tpm-file.t.cpp
index 68671e8..79e3645 100644
--- a/tests/unit-tests/security/sec-tpm-file.t.cpp
+++ b/tests/unit-tests/security/v1/sec-tpm-file.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).
  *
@@ -19,8 +19,8 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#include "security/sec-tpm-file.hpp"
-#include "security/key-chain.hpp"
+#include "security/v1/sec-tpm-file.hpp"
+#include "security/v1/key-chain.hpp"
 #include "security/v1/cryptopp.hpp"
 #include "util/time.hpp"
 
@@ -31,9 +31,11 @@
 
 namespace ndn {
 namespace security {
+namespace v1 {
 namespace tests {
 
 BOOST_AUTO_TEST_SUITE(Security)
+BOOST_AUTO_TEST_SUITE(V1)
 BOOST_AUTO_TEST_SUITE(TestSecTpmFile)
 
 BOOST_AUTO_TEST_CASE(Delete)
@@ -406,8 +408,10 @@
 }
 
 BOOST_AUTO_TEST_SUITE_END() // TestSecTpmFile
+BOOST_AUTO_TEST_SUITE_END() // V1
 BOOST_AUTO_TEST_SUITE_END() // Security
 
 } // namespace tests
+} // namespace v1
 } // namespace security
 } // namespace ndn
diff --git a/tests/unit-tests/security/sec-tpm-osx.t.cpp b/tests/unit-tests/security/v1/sec-tpm-osx.t.cpp
similarity index 98%
rename from tests/unit-tests/security/sec-tpm-osx.t.cpp
rename to tests/unit-tests/security/v1/sec-tpm-osx.t.cpp
index 65ea5c3..2d6fbcc 100644
--- a/tests/unit-tests/security/sec-tpm-osx.t.cpp
+++ b/tests/unit-tests/security/v1/sec-tpm-osx.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).
  *
@@ -19,7 +19,7 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#include "security/sec-tpm-osx.hpp"
+#include "security/v1/sec-tpm-osx.hpp"
 #include "security/v1/cryptopp.hpp"
 #include "util/time.hpp"
 
@@ -30,6 +30,7 @@
 
 namespace ndn {
 namespace security {
+namespace v1 {
 namespace tests {
 
 class OsxKeyChainTestFixture
@@ -63,6 +64,7 @@
 };
 
 BOOST_AUTO_TEST_SUITE(Security)
+BOOST_AUTO_TEST_SUITE(V1)
 BOOST_FIXTURE_TEST_SUITE(TestSecTpmOsx, OsxKeyChainTestFixture)
 
 BOOST_AUTO_TEST_CASE(Delete)
@@ -361,8 +363,10 @@
 }
 
 BOOST_AUTO_TEST_SUITE_END() // TestSecTpmOsx
+BOOST_AUTO_TEST_SUITE_END() // V1
 BOOST_AUTO_TEST_SUITE_END() // Security
 
 } // namespace tests
+} // namespace v1
 } // namespace security
 } // namespace ndn
diff --git a/tests/unit-tests/security/validator-config.t.cpp b/tests/unit-tests/security/validator-config.t.cpp
index 2419e8d..74aab21 100644
--- a/tests/unit-tests/security/validator-config.t.cpp
+++ b/tests/unit-tests/security/validator-config.t.cpp
@@ -21,7 +21,7 @@
 
 #include "security/validator-config.hpp"
 
-#include "security/key-chain.hpp"
+#include "security/signing-helpers.hpp"
 #include "util/io.hpp"
 #include "util/scheduler.hpp"
 #include "util/dummy-client-face.hpp"
diff --git a/tests/unit-tests/security/validator.t.cpp b/tests/unit-tests/security/validator.t.cpp
index 65c5095..90bd1b9 100644
--- a/tests/unit-tests/security/validator.t.cpp
+++ b/tests/unit-tests/security/validator.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).
  *
@@ -20,7 +20,6 @@
  */
 
 #include "security/validator-null.hpp"
-#include "security/key-chain.hpp"
 
 #include "boost-test.hpp"
 #include "identity-management-fixture.hpp"
diff --git a/tests/unit-tests/util/in-memory-storage-common.t.cpp b/tests/unit-tests/util/in-memory-storage-common.t.cpp
index e6a3ab7..802b2f7 100644
--- a/tests/unit-tests/util/in-memory-storage-common.t.cpp
+++ b/tests/unit-tests/util/in-memory-storage-common.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).
  *
@@ -23,7 +23,8 @@
 #include "util/in-memory-storage-fifo.hpp"
 #include "util/in-memory-storage-lfu.hpp"
 #include "util/in-memory-storage-lru.hpp"
-#include "security/key-chain.hpp"
+#include "util/crypto.hpp"
+#include "security/signature-sha256-with-rsa.hpp"
 
 #include "boost-test.hpp"
 #include "../make-interest-data.hpp"
@@ -273,8 +274,7 @@
 {
   shared_ptr<Data> data = makeData("/digest/compute");
 
-  ndn::ConstBufferPtr digest1 = ndn::crypto::computeSha256Digest(data->wireEncode().wire(),
-                                                                 data->wireEncode().size());
+  ConstBufferPtr digest1 = crypto::computeSha256Digest(data->wireEncode().wire(), data->wireEncode().size());
   BOOST_CHECK_EQUAL(digest1->size(), 32);
 
   InMemoryStorageEntry* entry = new InMemoryStorageEntry();
@@ -372,8 +372,7 @@
   shared_ptr<Data> data7 = makeData("/c/c/1");
   ims.insert(*data7);
 
-  ndn::ConstBufferPtr digest1 = ndn::crypto::computeSha256Digest(data->wireEncode().wire(),
-                                                                 data->wireEncode().size());
+  ConstBufferPtr digest1 = crypto::computeSha256Digest(data->wireEncode().wire(), data->wireEncode().size());
 
   Name name("/a");
   ims.erase(name);
@@ -394,8 +393,7 @@
   shared_ptr<Data> data3 = makeData("/z/z/z");
   ims.insert(*data3);
 
-  ndn::ConstBufferPtr digest1 = ndn::crypto::computeSha256Digest(data->wireEncode().wire(),
-                                                                 data->wireEncode().size());
+  ConstBufferPtr digest1 = crypto::computeSha256Digest(data->wireEncode().wire(), data->wireEncode().size());
 
   shared_ptr<Interest> interest = makeInterest("");
   interest->setName(Name(name).appendImplicitSha256Digest(digest1->buf(), digest1->size()));
@@ -486,7 +484,7 @@
   shared_ptr<Interest> interest = makeInterest(name);
   Name keyName("/somewhere/key");
 
-  ndn::KeyLocator locator(keyName);
+  KeyLocator locator(keyName);
   interest->setPublisherPublicKeyLocator(locator);
 
   shared_ptr<const Data> found = ims.find(*interest);
@@ -504,9 +502,9 @@
   shared_ptr<Data> data2 = make_shared<Data>(name2);
 
   Name keyName("/somewhere/key");
-  const ndn::KeyLocator locator(keyName);
+  const KeyLocator locator(keyName);
 
-  ndn::SignatureSha256WithRsa fakeSignature;
+  SignatureSha256WithRsa fakeSignature;
   fakeSignature.setValue(makeEmptyBlock(tlv::SignatureValue));
 
   fakeSignature.setKeyLocator(locator);
@@ -698,7 +696,7 @@
 
 ///as Find function is implemented at the base case, therefore testing for one derived class is
 ///sufficient for all
-class FindFixture : public ndn::tests::UnitTestTimeFixture
+class FindFixture : public tests::UnitTestTimeFixture
 {
 protected:
   FindFixture()
@@ -930,9 +928,9 @@
   Name n2 = insert(2, "ndn:/A");
   insert(3, "ndn:/A/B");
 
-  uint8_t digest00[ndn::crypto::SHA256_DIGEST_SIZE];
+  uint8_t digest00[crypto::SHA256_DIGEST_SIZE];
   std::fill_n(digest00, sizeof(digest00), 0x00);
-  uint8_t digestFF[ndn::crypto::SHA256_DIGEST_SIZE];
+  uint8_t digestFF[crypto::SHA256_DIGEST_SIZE];
   std::fill_n(digestFF, sizeof(digestFF), 0xFF);
 
   Exclude excludeDigest;
diff --git a/tests/unit-tests/util/in-memory-storage-fifo.t.cpp b/tests/unit-tests/util/in-memory-storage-fifo.t.cpp
index 4404b51..6175837 100644
--- a/tests/unit-tests/util/in-memory-storage-fifo.t.cpp
+++ b/tests/unit-tests/util/in-memory-storage-fifo.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).
  *
@@ -20,7 +20,6 @@
  */
 
 #include "util/in-memory-storage-fifo.hpp"
-#include "security/key-chain.hpp"
 
 #include "boost-test.hpp"
 #include "../make-interest-data.hpp"
diff --git a/tests/unit-tests/util/in-memory-storage-lfu.t.cpp b/tests/unit-tests/util/in-memory-storage-lfu.t.cpp
index bc52b30..5c37e56 100644
--- a/tests/unit-tests/util/in-memory-storage-lfu.t.cpp
+++ b/tests/unit-tests/util/in-memory-storage-lfu.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).
  *
@@ -20,7 +20,6 @@
  */
 
 #include "util/in-memory-storage-lfu.hpp"
-#include "security/key-chain.hpp"
 
 #include "boost-test.hpp"
 #include "../make-interest-data.hpp"
diff --git a/tests/unit-tests/util/in-memory-storage-lru.t.cpp b/tests/unit-tests/util/in-memory-storage-lru.t.cpp
index 7585987..67068bd 100644
--- a/tests/unit-tests/util/in-memory-storage-lru.t.cpp
+++ b/tests/unit-tests/util/in-memory-storage-lru.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).
  *
@@ -20,7 +20,6 @@
  */
 
 #include "util/in-memory-storage-lru.hpp"
-#include "security/key-chain.hpp"
 
 #include "boost-test.hpp"
 #include "../make-interest-data.hpp"
diff --git a/tests/unit-tests/util/in-memory-storage-persistent.t.cpp b/tests/unit-tests/util/in-memory-storage-persistent.t.cpp
index af33ab3..9770ef3 100644
--- a/tests/unit-tests/util/in-memory-storage-persistent.t.cpp
+++ b/tests/unit-tests/util/in-memory-storage-persistent.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).
  *
@@ -20,7 +20,6 @@
  */
 
 #include "util/in-memory-storage-persistent.hpp"
-#include "security/key-chain.hpp"
 
 #include "boost-test.hpp"
 #include "../make-interest-data.hpp"
diff --git a/tests/unit-tests/util/io.t.cpp b/tests/unit-tests/util/io.t.cpp
index 8ffab07..fcb1f2b 100644
--- a/tests/unit-tests/util/io.t.cpp
+++ b/tests/unit-tests/util/io.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).
  *
@@ -20,7 +20,6 @@
  */
 
 #include "util/io.hpp"
-#include "security/key-chain.hpp"
 
 #include "boost-test.hpp"
 #include "identity-management-fixture.hpp"
diff --git a/tests/unit-tests/util/segment-fetcher.t.cpp b/tests/unit-tests/util/segment-fetcher.t.cpp
index 462e759..02ef85b 100644
--- a/tests/unit-tests/util/segment-fetcher.t.cpp
+++ b/tests/unit-tests/util/segment-fetcher.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).
  *
@@ -21,16 +21,15 @@
 
 #include "util/segment-fetcher.hpp"
 #include "security/validator-null.hpp"
-#include "../../dummy-validator.hpp"
+#include "lp/nack-header.hpp"
 #include "data.hpp"
 #include "encoding/block.hpp"
 
 #include "boost-test.hpp"
 #include "util/dummy-client-face.hpp"
-#include "security/key-chain.hpp"
-#include "lp/nack-header.hpp"
 #include "../identity-management-time-fixture.hpp"
 #include "../make-interest-data.hpp"
+#include "../../dummy-validator.hpp"
 
 namespace ndn {
 namespace util {
diff --git a/tests/unit-tests/util/simple-notification.hpp b/tests/unit-tests/util/simple-notification.hpp
index ce6ec90..23f26f8 100644
--- a/tests/unit-tests/util/simple-notification.hpp
+++ b/tests/unit-tests/util/simple-notification.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2016,  Regents of the University of California,
+ * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -31,7 +31,6 @@
 #include "common.hpp"
 
 #include "encoding/encoding-buffer.hpp"
-#include "security/key-chain.hpp"
 
 namespace ndn {
 namespace util {