Drop unnecessary v2 namespace qualifications

Change-Id: I6358bac6860ca8f2e9cdbd00bb2a929e3af5b2da
diff --git a/tools/ndnsec/cert-dump.cpp b/tools/ndnsec/cert-dump.cpp
index d553822..5a388d7 100644
--- a/tools/ndnsec/cert-dump.cpp
+++ b/tools/ndnsec/cert-dump.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -107,7 +107,7 @@
     return 2;
   }
 
-  security::v2::Certificate certificate;
+  security::Certificate certificate;
   if (isFileName) {
     try {
       certificate = loadCertificate(name);
@@ -118,7 +118,7 @@
     }
   }
   else {
-    security::v2::KeyChain keyChain;
+    KeyChain keyChain;
     certificate = getCertificateFromPib(keyChain.getPib(), name,
                                         isIdentityName, isKeyName, nIsNameOptions == 0);
   }
diff --git a/tools/ndnsec/cert-gen.cpp b/tools/ndnsec/cert-gen.cpp
index 9aef677..9c11ca4 100644
--- a/tools/ndnsec/cert-gen.cpp
+++ b/tools/ndnsec/cert-gen.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -86,10 +86,10 @@
     return 0;
   }
 
-  security::v2::AdditionalDescription additionalDescription;
+  security::AdditionalDescription additionalDescription;
 
   for (const auto& info : infos) {
-    auto pos = info.find(" ");
+    auto pos = info.find(' ');
     if (pos == std::string::npos) {
       std::cerr << "ERROR: incorrectly formatted info block [" << info << "]" << std::endl;
       return 2;
@@ -122,9 +122,9 @@
     }
   }
 
-  security::v2::KeyChain keyChain;
+  KeyChain keyChain;
 
-  security::v2::Certificate certRequest;
+  security::Certificate certRequest;
   try {
     certRequest = loadCertificate(requestFile);
   }
@@ -143,7 +143,7 @@
     .append(issuerId)
     .appendVersion();
 
-  security::v2::Certificate cert;
+  security::Certificate cert;
   cert.setName(certName);
   cert.setContent(certRequest.getContent());
   // TODO: add ability to customize
diff --git a/tools/ndnsec/cert-install.cpp b/tools/ndnsec/cert-install.cpp
index 9ee4d87..7a6afa2 100644
--- a/tools/ndnsec/cert-install.cpp
+++ b/tools/ndnsec/cert-install.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -45,7 +45,7 @@
   }
 };
 
-security::v2::Certificate
+static security::Certificate
 getCertificateHttp(const std::string& host, const std::string& port, const std::string& path)
 {
   boost::asio::ip::tcp::iostream requestStream;
@@ -97,7 +97,7 @@
     streamSource(requestStream) >> base64Decode(true) >> streamSink(os);
   }
 
-  return security::v2::Certificate(Block(os.buf()));
+  return security::Certificate(Block(os.buf()));
 }
 
 int
@@ -158,7 +158,7 @@
     return 2;
   }
 
-  security::v2::Certificate cert;
+  security::Certificate cert;
   try {
     if (certFile.find("http://") == 0) {
       std::string host;
@@ -166,12 +166,12 @@
       std::string path;
 
       size_t pos = 7; // offset of "http://"
-      size_t posSlash = certFile.find("/", pos);
+      size_t posSlash = certFile.find('/', pos);
 
       if (posSlash == std::string::npos)
         NDN_THROW(HttpException("Request line is not correctly formatted"));
 
-      size_t posPort = certFile.find(":", pos);
+      size_t posPort = certFile.find(':', pos);
 
       if (posPort != std::string::npos && posPort < posSlash) {
         // port is specified
@@ -196,7 +196,7 @@
     return 1;
   }
 
-  security::v2::KeyChain keyChain;
+  KeyChain keyChain;
 
   auto id = keyChain.getPib().getIdentity(cert.getIdentity());
   auto key = id.getKey(cert.getKeyName());
diff --git a/tools/ndnsec/delete.cpp b/tools/ndnsec/delete.cpp
index 376e3e3..2159bb3 100644
--- a/tools/ndnsec/delete.cpp
+++ b/tools/ndnsec/delete.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -45,7 +45,7 @@
     ("name,n",        po::value<std::string>(&name),
                       "name of the item to delete. By default, it refers to an identity. "
                       "If -k is specified, it refers to a key. "
-                      "If -c is specified, it refers to a certificate.");
+                      "If -c is specified, it refers to a certificate.")
     ;
 
   po::positional_options_description p;
@@ -77,20 +77,20 @@
     return 2;
   }
 
-  security::v2::KeyChain keyChain;
+  KeyChain keyChain;
 
   try {
     if (wantDeleteCert) {
       security::Key key = keyChain.getPib()
-        .getIdentity(security::v2::extractIdentityFromCertName(name))
-        .getKey(security::v2::extractKeyNameFromCertName(name));
+        .getIdentity(security::extractIdentityFromCertName(name))
+        .getKey(security::extractKeyNameFromCertName(name));
 
       keyChain.deleteCertificate(key, key.getCertificate(name).getName());
       std::cerr << "OK: certificate deleted: " << name << std::endl;
     }
     else if (wantDeleteKey) {
       security::Identity identity = keyChain.getPib()
-        .getIdentity(security::v2::extractIdentityFromKeyName(name));
+        .getIdentity(security::extractIdentityFromKeyName(name));
 
       keyChain.deleteKey(identity, identity.getKey(name));
       std::cerr << "OK: key deleted: " << name << std::endl;
diff --git a/tools/ndnsec/export.cpp b/tools/ndnsec/export.cpp
index 2b6d528..f0a9395 100644
--- a/tools/ndnsec/export.cpp
+++ b/tools/ndnsec/export.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -105,7 +105,8 @@
     isIdentityName = true;
   }
 
-  security::v2::KeyChain keyChain;
+  KeyChain keyChain;
+
   auto cert = getCertificateFromPib(keyChain.getPib(), name,
                                     isIdentityName, isKeyName, isCertName);
 
diff --git a/tools/ndnsec/get-default.cpp b/tools/ndnsec/get-default.cpp
index d59cfba..37f7425 100644
--- a/tools/ndnsec/get-default.cpp
+++ b/tools/ndnsec/get-default.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -75,12 +75,12 @@
     return 2;
   }
 
-  security::v2::KeyChain keyChain;
+  KeyChain keyChain;
 
   if (vm.count("key") > 0) {
     if (wantDefaultCert) {
       auto cert = keyChain.getPib()
-                  .getIdentity(security::v2::extractIdentityFromKeyName(keyName))
+                  .getIdentity(security::extractIdentityFromKeyName(keyName))
                   .getKey(keyName)
                   .getDefaultCertificate();
       std::cout << cert.getName();
diff --git a/tools/ndnsec/import.cpp b/tools/ndnsec/import.cpp
index 9dab73f..7e27bee 100644
--- a/tools/ndnsec/import.cpp
+++ b/tools/ndnsec/import.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -72,7 +72,7 @@
     return 0;
   }
 
-  security::v2::KeyChain keyChain;
+  KeyChain keyChain;
 
   shared_ptr<security::SafeBag> safeBag;
   if (input == "-")
diff --git a/tools/ndnsec/key-gen.cpp b/tools/ndnsec/key-gen.cpp
index 553f06c..2090f74 100644
--- a/tools/ndnsec/key-gen.cpp
+++ b/tools/ndnsec/key-gen.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -136,7 +136,7 @@
     return 2;
   }
 
-  security::v2::KeyChain keyChain;
+  KeyChain keyChain;
 
   security::Identity identity;
   security::Key key;
diff --git a/tools/ndnsec/list.cpp b/tools/ndnsec/list.cpp
index fbe1140..457fc2e 100644
--- a/tools/ndnsec/list.cpp
+++ b/tools/ndnsec/list.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -75,7 +75,7 @@
     std::cout << key.getName() << std::endl;
 
     if (m_verboseLevel >= 2) {
-      security::v2::Certificate defaultCert;
+      security::Certificate defaultCert;
       try {
         defaultCert = key.getDefaultCertificate();
       }
@@ -90,7 +90,7 @@
   }
 
   void
-  printCertificate(const security::v2::Certificate& cert, bool isDefault) const
+  printCertificate(const security::Certificate& cert, bool isDefault) const
   {
     if (isDefault)
       std::cout << "       +->* ";
@@ -152,7 +152,7 @@
 
   verboseLevel = std::max(verboseLevel, wantCert ? 2 : wantKey ? 1 : 0);
 
-  security::v2::KeyChain keyChain;
+  KeyChain keyChain;
 
   // TODO: add API to check for default identity (may be from the identity itself)
   security::Identity defaultIdentity;
diff --git a/tools/ndnsec/set-default.cpp b/tools/ndnsec/set-default.cpp
index d1647ed..128ae19 100644
--- a/tools/ndnsec/set-default.cpp
+++ b/tools/ndnsec/set-default.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -74,16 +74,16 @@
     return 2;
   }
 
-  security::v2::KeyChain keyChain;
+  KeyChain keyChain;
 
   if (wantSetDefaultKey) {
-    auto identity = keyChain.getPib().getIdentity(security::v2::extractIdentityFromKeyName(name));
+    auto identity = keyChain.getPib().getIdentity(security::extractIdentityFromKeyName(name));
     auto key = identity.getKey(name);
     keyChain.setDefaultKey(identity, key);
   }
   else if (wantSetDefaultCert) {
-    auto identity = keyChain.getPib().getIdentity(security::v2::extractIdentityFromCertName(name));
-    auto key = identity.getKey(security::v2::extractKeyNameFromCertName(name));
+    auto identity = keyChain.getPib().getIdentity(security::extractIdentityFromCertName(name));
+    auto key = identity.getKey(security::extractKeyNameFromCertName(name));
     auto cert = key.getCertificate(name);
     keyChain.setDefaultCertificate(key, cert);
   }
diff --git a/tools/ndnsec/sign-req.cpp b/tools/ndnsec/sign-req.cpp
index f9f97e9..3548228 100644
--- a/tools/ndnsec/sign-req.cpp
+++ b/tools/ndnsec/sign-req.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -69,7 +69,7 @@
     return 2;
   }
 
-  security::v2::KeyChain keyChain;
+  KeyChain keyChain;
 
   security::Identity identity;
   security::Key key;
@@ -78,12 +78,12 @@
     key = identity.getDefaultKey();
   }
   else {
-    identity = keyChain.getPib().getIdentity(security::v2::extractIdentityFromKeyName(name));
+    identity = keyChain.getPib().getIdentity(security::extractIdentityFromKeyName(name));
     key = identity.getKey(name);
   }
 
   // Create signing request (similar to self-signed certificate)
-  security::v2::Certificate certificate;
+  security::Certificate certificate;
 
   // set name
   Name certificateName = key.getName();
diff --git a/tools/ndnsec/unlock-tpm.cpp b/tools/ndnsec/unlock-tpm.cpp
index d79db7f..bcf7ca0 100644
--- a/tools/ndnsec/unlock-tpm.cpp
+++ b/tools/ndnsec/unlock-tpm.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -61,7 +61,7 @@
   }
 
 #ifdef NDN_CXX_HAVE_GETPASS
-  security::v2::KeyChain keyChain;
+  KeyChain keyChain;
 
   char* password = ::getpass("Password to unlock the TPM: ");
   if (password == nullptr) {
diff --git a/tools/ndnsec/util.cpp b/tools/ndnsec/util.cpp
index c07b509..0ff7e74 100644
--- a/tools/ndnsec/util.cpp
+++ b/tools/ndnsec/util.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -68,7 +68,7 @@
 #endif // NDN_CXX_HAVE_GETPASS
 }
 
-security::v2::Certificate
+security::Certificate
 getCertificateFromPib(const security::pib::Pib& pib, const Name& name,
                       bool isIdentityName, bool isKeyName, bool isCertName)
 {
@@ -78,26 +78,26 @@
            .getDefaultCertificate();
   }
   else if (isKeyName) {
-    return pib.getIdentity(security::v2::extractIdentityFromKeyName(name))
+    return pib.getIdentity(security::extractIdentityFromKeyName(name))
            .getKey(name)
            .getDefaultCertificate();
   }
   else if (isCertName) {
-    return pib.getIdentity(security::v2::extractIdentityFromCertName(name))
-           .getKey(security::v2::extractKeyNameFromCertName(name))
+    return pib.getIdentity(security::extractIdentityFromCertName(name))
+           .getKey(security::extractKeyNameFromCertName(name))
            .getCertificate(name);
   }
   NDN_CXX_UNREACHABLE;
 }
 
-security::v2::Certificate
+security::Certificate
 loadCertificate(const std::string& fileName)
 {
-  shared_ptr<security::v2::Certificate> cert;
+  shared_ptr<security::Certificate> cert;
   if (fileName == "-")
-    cert = io::load<security::v2::Certificate>(std::cin);
+    cert = io::load<security::Certificate>(std::cin);
   else
-    cert = io::load<security::v2::Certificate>(fileName);
+    cert = io::load<security::Certificate>(fileName);
 
   if (cert == nullptr) {
     NDN_THROW(CannotLoadCertificate(fileName));
diff --git a/tools/ndnsec/util.hpp b/tools/ndnsec/util.hpp
index 8aed837..4ce3c04 100644
--- a/tools/ndnsec/util.hpp
+++ b/tools/ndnsec/util.hpp
@@ -45,7 +45,7 @@
  * @throw std::invalid_argument name is invalid.
  * @throw Pib::Error certificate does not exist.
  */
-security::v2::Certificate
+security::Certificate
 getCertificateFromPib(const security::pib::Pib& pib, const Name& name,
                       bool isIdentityName, bool isKeyName, bool isCertName);
 
@@ -58,7 +58,7 @@
   }
 };
 
-security::v2::Certificate
+security::Certificate
 loadCertificate(const std::string& fileName);
 
 bool