build: switch to C++17

Change-Id: I119767c48c085c62556347ba6c11a85e30c32ced
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
index 95dfe37..a287116 100755
--- a/.jenkins.d/00-deps.sh
+++ b/.jenkins.d/00-deps.sh
@@ -35,7 +35,7 @@
     case $JOB_NAME in
         *code-coverage)
             sudo apt-get -qy install lcov python3-pip
-            pip3 install --user --upgrade --upgrade-strategy=eager 'gcovr~=5.0'
+            pip3 install --user --upgrade --upgrade-strategy=eager 'gcovr~=5.1'
             ;;
         *Docs)
             sudo apt-get -qy install doxygen graphviz python3-pip
diff --git a/.jenkins.d/30-coverage.sh b/.jenkins.d/30-coverage.sh
index f4e8769..e71deed 100755
--- a/.jenkins.d/30-coverage.sh
+++ b/.jenkins.d/30-coverage.sh
@@ -4,14 +4,13 @@
 if [[ $JOB_NAME == *"code-coverage" ]]; then
     # Generate an XML report (Cobertura format) and a detailed HTML report using gcovr
     # Note: trailing slashes are important in the paths below. Do not remove them!
-    gcovr -j$WAF_JOBS \
-          --object-directory build \
+    gcovr --object-directory build \
           --filter src/ \
           --exclude-throw-branches \
           --exclude-unreachable-branches \
-          --print-summary \
+          --cobertura build/coverage.xml \
           --html-details build/gcovr/ \
-          --xml build/coverage.xml
+          --print-summary
 
     # Generate a detailed HTML report using lcov
     lcov --quiet \
diff --git a/.jenkins.d/40-headers-check.sh b/.jenkins.d/40-headers-check.sh
index 343160a..8d997b6 100755
--- a/.jenkins.d/40-headers-check.sh
+++ b/.jenkins.d/40-headers-check.sh
@@ -17,7 +17,7 @@
 fi
 
 CXX=${CXX:-g++}
-STD=-std=c++14
+STD=-std=c++17
 CXXFLAGS="-O2 -Wall -Wno-unneeded-internal-declaration -Wno-unused-const-variable $(pkg-config --cflags libndn-cxx lib$PROJ)"
 INCLUDEDIR="$(pkg-config --variable=includedir lib$PROJ)"/$PROJ
 
diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index f086c17..7c6d282 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -136,7 +136,7 @@
     """
     def getGeneralFlags(self, conf):
         flags = super(GccBasicFlags, self).getGeneralFlags(conf)
-        flags['CXXFLAGS'] += ['-std=c++14']
+        flags['CXXFLAGS'] += ['-std=c++17']
         if Utils.unversioned_sys_platform() == 'linux':
             flags['LINKFLAGS'] += ['-fuse-ld=gold']
         elif Utils.unversioned_sys_platform() == 'freebsd':
diff --git a/README.md b/README.md
index 13b6f81..b0486c7 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
 
 [![CI](https://github.com/named-data/name-based-access-control/actions/workflows/ci.yml/badge.svg)](https://github.com/named-data/name-based-access-control/actions/workflows/ci.yml)
 [![Docs](https://github.com/named-data/name-based-access-control/actions/workflows/docs.yml/badge.svg)](https://github.com/named-data/name-based-access-control/actions/workflows/docs.yml)
-![Language](https://img.shields.io/badge/C%2B%2B-14-blue)
+![Language](https://img.shields.io/badge/C%2B%2B-17-blue)
 
 ## Reporting bugs
 
diff --git a/src/access-manager.cpp b/src/access-manager.cpp
index 3602c98..0093d57 100644
--- a/src/access-manager.cpp
+++ b/src/access-manager.cpp
@@ -23,10 +23,9 @@
 #include <ndn-cxx/security/signing-helpers.hpp>
 #include <ndn-cxx/util/logger.hpp>
 
-NDN_LOG_INIT(nac.AccessManager);
+namespace ndn::nac {
 
-namespace ndn {
-namespace nac {
+NDN_LOG_INIT(nac.AccessManager);
 
 AccessManager::AccessManager(const Identity& identity, const Name& dataset,
                              KeyChain& keyChain, Face& face)
@@ -123,5 +122,4 @@
   m_ims.erase(Name(m_nacKey.getName()).append(KDK).append(ENCRYPTED_BY).append(identity));
 }
 
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac
diff --git a/src/access-manager.hpp b/src/access-manager.hpp
index 22dc2cc..5bfb0b1 100644
--- a/src/access-manager.hpp
+++ b/src/access-manager.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2021, Regents of the University of California
+ * Copyright (c) 2014-2022, Regents of the University of California
  *
  * NAC 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
@@ -24,8 +24,7 @@
 
 #include <ndn-cxx/face.hpp>
 
-namespace ndn {
-namespace nac {
+namespace ndn::nac {
 
 /**
  * @brief Access Manager
@@ -131,7 +130,6 @@
   ScopedRegisteredPrefixHandle m_kdkReg;
 };
 
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac
 
 #endif // NDN_NAC_ACCESS_MANAGER_HPP
diff --git a/src/common.cpp b/src/common.cpp
index da4c5fd..45488b1 100644
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2018, Regents of the University of California
+/*
+ * Copyright (c) 2014-2022, Regents of the University of California
  *
  * NAC 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
@@ -19,8 +19,7 @@
 
 #include "common.hpp"
 
-namespace ndn {
-namespace nac {
+namespace ndn::nac {
 
 Name
 convertKekNameToKdkPrefix(const Name& kekName, const ErrorCallback& onFailure)
@@ -47,10 +46,9 @@
   }
 
   auto kekName = ckDataName.getSubName(ckName.size() + 1);
-  return std::make_tuple(convertKekNameToKdkPrefix(kekName, onFailure),
-                         kekName.getPrefix(-2),
-                         kekName.getPrefix(-2).append("KEY").append(kekName.get(-1)));
+  return {convertKekNameToKdkPrefix(kekName, onFailure),
+          kekName.getPrefix(-2),
+          kekName.getPrefix(-2).append("KEY").append(kekName.get(-1))};
 }
 
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac
diff --git a/src/common.hpp b/src/common.hpp
index 1f95504..5aebdeb 100644
--- a/src/common.hpp
+++ b/src/common.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020, Regents of the University of California
+ * Copyright (c) 2014-2022, Regents of the University of California
  *
  * NAC 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
@@ -63,8 +63,7 @@
 #include <boost/lexical_cast.hpp>
 #include <boost/noncopyable.hpp>
 
-namespace ndn {
-namespace nac {
+namespace ndn::nac {
 
 using security::Certificate;
 using security::DataValidationFailureCallback;
@@ -151,7 +150,6 @@
 std::tuple<Name, Name, Name>
 extractKdkInfoFromCkName(const Name& ckDataName, const Name& ckName, const ErrorCallback& onFailure);
 
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac
 
 #endif // NDN_NAC_COMMON_HPP
diff --git a/src/decryptor.cpp b/src/decryptor.cpp
index 74290c8..0becbe2 100644
--- a/src/decryptor.cpp
+++ b/src/decryptor.cpp
@@ -25,8 +25,7 @@
 #include <ndn-cxx/util/exception.hpp>
 #include <ndn-cxx/util/logger.hpp>
 
-namespace ndn {
-namespace nac {
+namespace ndn::nac {
 
 NDN_LOG_INIT(nac.Decryptor);
 
@@ -72,9 +71,7 @@
                      "Missing required InitialVector in the supplied EncryptedContent block");
   }
 
-  ContentKeys::iterator ck;
-  bool isNew = false;
-  std::tie(ck, isNew) = m_cks.emplace(ec.getKeyLocator(), ContentKey{});
+  auto [ck, isNew] = m_cks.emplace(ec.getKeyLocator(), ContentKey{});
 
   if (ck->second.isRetrieved) {
     doDecrypt(ec, ck->second.bits, onSuccess, onFailure);
@@ -101,17 +98,15 @@
   //   from the encrypted data          unknown (name in retrieved CK is used to determine KDK)
 
   const Name& ckName = ck->first;
-
   NDN_LOG_DEBUG("Fetching CK " << ckName);
 
   ck->second.pendingInterest = m_face.expressInterest(Interest(ckName)
                                                        .setMustBeFresh(false) // ?
                                                        .setCanBePrefix(true),
     [=] (const Interest& ckInterest, const Data& ckData) {
-      ck->second.pendingInterest = nullopt;
+      ck->second.pendingInterest = std::nullopt;
       // TODO: verify that the key is legit
-      Name kdkPrefix, kdkIdentity, kdkKeyName;
-      std::tie(kdkPrefix, kdkIdentity, kdkKeyName) =
+      auto [kdkPrefix, kdkIdentity, kdkKeyName] =
         extractKdkInfoFromCkName(ckData.getName(), ckInterest.getName(), onFailure);
       if (kdkPrefix.empty()) {
         return; // error has been already reported
@@ -131,13 +126,13 @@
       fetchKdk(ck, kdkPrefix, ckData, onFailure, N_RETRIES);
     },
     [=] (const Interest& i, const lp::Nack& nack) {
-      ck->second.pendingInterest = nullopt;
+      ck->second.pendingInterest = std::nullopt;
       onFailure(ErrorCode::CkRetrievalFailure,
                 "Retrieval of CK [" + i.getName().toUri() + "] failed. "
                 "Got NACK (" + boost::lexical_cast<std::string>(nack.getReason()) + ")");
     },
     [=] (const Interest& i) {
-      ck->second.pendingInterest = nullopt;
+      ck->second.pendingInterest = std::nullopt;
       if (nTriesLeft > 1) {
         fetchCk(ck, onFailure, nTriesLeft - 1);
       }
@@ -167,7 +162,7 @@
 
   ck->second.pendingInterest = m_face.expressInterest(Interest(kdkName).setMustBeFresh(true),
     [=] (const Interest&, const Data& kdkData) {
-      ck->second.pendingInterest = nullopt;
+      ck->second.pendingInterest = std::nullopt;
       // TODO: verify that the key is legit
 
       bool isOk = decryptAndImportKdk(kdkData, onFailure);
@@ -178,13 +173,13 @@
                                          onFailure);
     },
     [=] (const Interest& i, const lp::Nack& nack) {
-      ck->second.pendingInterest = nullopt;
+      ck->second.pendingInterest = std::nullopt;
       onFailure(ErrorCode::KdkRetrievalFailure,
                 "Retrieval of KDK [" + i.getName().toUri() + "] failed. "
                 "Got NACK (" + boost::lexical_cast<std::string>(nack.getReason()) + ")");
     },
     [=] (const Interest& i) {
-      ck->second.pendingInterest = nullopt;
+      ck->second.pendingInterest = std::nullopt;
       if (nTriesLeft > 1) {
         fetchKdk(ck, kdkPrefix, ckData, onFailure, nTriesLeft - 1);
       }
@@ -264,5 +259,4 @@
   onSuccess(os.buf());
 }
 
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac
diff --git a/src/decryptor.hpp b/src/decryptor.hpp
index edc6f2d..a8ea7c3 100644
--- a/src/decryptor.hpp
+++ b/src/decryptor.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019, Regents of the University of California
+ * Copyright (c) 2014-2022, Regents of the University of California
  *
  * NAC 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
@@ -25,8 +25,7 @@
 
 #include <ndn-cxx/face.hpp>
 
-namespace ndn {
-namespace nac {
+namespace ndn::nac {
 
 /**
  * @brief NAC Decryptor
@@ -44,7 +43,7 @@
   {
     bool isRetrieved = false;
     Buffer bits;
-    optional<PendingInterestHandle> pendingInterest;
+    std::optional<PendingInterestHandle> pendingInterest;
 
     struct PendingDecrypt
     {
@@ -111,7 +110,6 @@
   ContentKeys m_cks;
 };
 
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac
 
 #endif // NDN_NAC_DECRYPTOR_HPP
diff --git a/src/encrypted-content.cpp b/src/encrypted-content.cpp
index beaeda5..2bd8b27 100644
--- a/src/encrypted-content.cpp
+++ b/src/encrypted-content.cpp
@@ -23,12 +23,11 @@
 #include <ndn-cxx/util/concepts.hpp>
 #include <ndn-cxx/util/exception.hpp>
 
-namespace ndn {
-namespace nac {
+namespace ndn::nac {
 
 BOOST_CONCEPT_ASSERT((WireEncodable<EncryptedContent>));
 BOOST_CONCEPT_ASSERT((WireDecodable<EncryptedContent>));
-static_assert(std::is_base_of<ndn::tlv::Error, EncryptedContent::Error>::value,
+static_assert(std::is_base_of_v<ndn::tlv::Error, EncryptedContent::Error>,
               "EncryptedContent::Error must inherit from tlv::Error");
 
 EncryptedContent::EncryptedContent(const Block& block)
@@ -183,19 +182,14 @@
   if (!wire.hasWire()) {
     NDN_THROW(Error("The supplied block does not contain wire format"));
   }
+  if (wire.type() != tlv::EncryptedContent) {
+    NDN_THROW(Error("EncryptedContent", wire.type()));
+  }
 
-  m_payload.reset();
-  m_iv.reset();
-  m_payloadKey.reset();
-
+  *this = {};
   m_wire = wire;
   m_wire.parse();
 
-  if (m_wire.type() != tlv::EncryptedContent) {
-    NDN_THROW(Error("Unexpected TLV type (expecting EncryptedContent, got " +
-                    ndn::to_string(m_wire.type()) + ")"));
-  }
-
   auto block = m_wire.find(tlv::EncryptedPayload);
   if (block != m_wire.elements_end()) {
     m_payload = *block;
@@ -220,5 +214,4 @@
   }
 }
 
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac
diff --git a/src/encrypted-content.hpp b/src/encrypted-content.hpp
index 5ba0ab1..03b85d5 100644
--- a/src/encrypted-content.hpp
+++ b/src/encrypted-content.hpp
@@ -24,23 +24,22 @@
 
 #include <ndn-cxx/encoding/tlv.hpp>
 
-namespace ndn {
-namespace nac {
+namespace ndn::nac {
 
 /**
  * @brief Encrypted content
  *
- * <code>
- *     EncryptedContent ::= ENCRYPTED-CONTENT-TYPE TLV-LENGTH
- *                            InitializationVector
- *                            EncryptedPayload
- *                            EncryptedPayloadKey
- *                            Name
+ * @verbatim
+ * EncryptedContent ::= ENCRYPTED-CONTENT-TYPE TLV-LENGTH
+ *                        InitializationVector
+ *                        EncryptedPayload
+ *                        EncryptedPayloadKey
+ *                        Name
  *
- *     InitializationVector ::= INITIALIZATION-VECTOR-TYPE TLV-LENGTH(=N) BYTE{N}
- *     EncryptedPayload ::= ENCRYPTED-PAYLOAD-TYPE TLV-LENGTH(=N) BYTE{N}
- *     EncryptedPayloadKey ::= ENCRYPTED-PAYLOAD-KEY-TYPE TLV-LENGTH(=N) BYTE{N}
- * </code>
+ * InitializationVector ::= INITIALIZATION-VECTOR-TYPE TLV-LENGTH(=N) BYTE{N}
+ * EncryptedPayload ::= ENCRYPTED-PAYLOAD-TYPE TLV-LENGTH(=N) BYTE{N}
+ * EncryptedPayloadKey ::= ENCRYPTED-PAYLOAD-KEY-TYPE TLV-LENGTH(=N) BYTE{N}
+ * @endverbatim
  */
 class EncryptedContent
 {
@@ -149,7 +148,6 @@
   mutable Block m_wire;
 };
 
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac
 
 #endif // NDN_NAC_ENCRYPTED_CONTENT_HPP
diff --git a/src/encryptor.cpp b/src/encryptor.cpp
index b35a744..04febf0 100644
--- a/src/encryptor.cpp
+++ b/src/encryptor.cpp
@@ -24,8 +24,7 @@
 #include <ndn-cxx/security/transform/stream-sink.hpp>
 #include <ndn-cxx/util/logger.hpp>
 
-namespace ndn {
-namespace nac {
+namespace ndn::nac {
 
 NDN_LOG_INIT(nac.Encryptor);
 
@@ -207,5 +206,4 @@
   }
 }
 
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac
diff --git a/src/encryptor.hpp b/src/encryptor.hpp
index 1b177eb..d0d1415 100644
--- a/src/encryptor.hpp
+++ b/src/encryptor.hpp
@@ -23,13 +23,12 @@
 #include "common.hpp"
 #include "encrypted-content.hpp"
 
-namespace ndn {
-namespace nac {
+namespace ndn::nac {
 
 /**
  * @brief NAC Encryptor
  *
- * Encryptor encrypts the requested content and returns ``EncryptedContent`` element.
+ * Encryptor encrypts the requested content and returns an EncryptedContent element.
  */
 class Encryptor
 {
@@ -135,7 +134,7 @@
   SigningInfo m_ckDataSigningInfo;
 
   bool m_isKekRetrievalInProgress;
-  optional<Data> m_kek;
+  std::optional<Data> m_kek;
   ErrorCallback m_onFailure;
 
   InMemoryStoragePersistent m_ims; // for encrypted CKs
@@ -147,7 +146,6 @@
   Scheduler m_scheduler;
 };
 
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac
 
 #endif // NDN_NAC_ENCRYPTOR_HPP
diff --git a/src/version.hpp.in b/src/version.hpp.in
index 2f002c9..2cebe55 100644
--- a/src/version.hpp.in
+++ b/src/version.hpp.in
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020, Regents of the University of California
+ * Copyright (c) 2014-2022, Regents of the University of California
  *
  * NAC 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
@@ -20,49 +20,49 @@
 #ifndef NDN_NAC_VERSION_HPP
 #define NDN_NAC_VERSION_HPP
 
-namespace ndn {
-namespace nac {
+// ndn-nac version follows Semantic Versioning 2.0.0
+// https://semver.org/spec/v2.0.0.html
 
-/** ndn-nac version follows Semantic Versioning 2.0.0 specification
- *  http://semver.org/
- */
-
-/** \brief ndn-nac version represented as an integer
+/**
+ * \brief ndn-nac version represented as an integer.
  *
- *  MAJOR*1000000 + MINOR*1000 + PATCH
+ * Equivalent to: #NDN_NAC_VERSION_MAJOR*1000000 + #NDN_NAC_VERSION_MINOR*1000 + #NDN_NAC_VERSION_PATCH
  */
 #define NDN_NAC_VERSION @VERSION@
 
-/** \brief ndn-nac version represented as a string
+/// The major version of ndn-nac
+#define NDN_NAC_VERSION_MAJOR @VERSION_MAJOR@
+/// The minor version of ndn-nac
+#define NDN_NAC_VERSION_MINOR @VERSION_MINOR@
+/// The patch version of ndn-nac
+#define NDN_NAC_VERSION_PATCH @VERSION_PATCH@
+
+/**
+ * \brief ndn-nac version represented as a string.
  *
- *  MAJOR.MINOR.PATCH
+ * Format:
+ * @code
+ * MAJOR.MINOR.PATCH
+ * @endcode
  */
 #define NDN_NAC_VERSION_STRING "@VERSION_STRING@"
 
-/** \brief ndn-nac version string, including git commit information, if ndn-nac is build from
- *         specific git commit
+/**
+ * \brief ndn-nac version string, including git commit information if ndn-nac is built from a
+ *        specific git commit.
  *
- * NDN_NAC_VERSION_BUILD_STRING is obtained using the following command (`ndn-nac-` prefix is
- * afterwards removed):
+ * #NDN_NAC_VERSION_BUILD_STRING is obtained using the following command (`ndn-nac-` prefix is
+ * afterwards removed): ``git describe --match 'ndn-nac-*'``
  *
- *    `git describe --match 'ndn-nac-*'`
+ * When ndn-nac is not built from git, #NDN_NAC_VERSION_BUILD_STRING equals #NDN_NAC_VERSION_STRING.
  *
- * When ndn-nac is built not from git, NDN_NAC_VERSION_BUILD_STRING equals NDN_NAC_VERSION_STRING
- *
+ * Format:
+ * @code
  * MAJOR.MINOR.PATCH(-release-candidate-tag)(-(number-of-commits-since-tag)-COMMIT-HASH)
+ * @endcode
  *
- * Example, 0.1.0-rc1-1-g5c86570
+ * Example: 0.1.0-rc1-1-g5c86570
  */
 #define NDN_NAC_VERSION_BUILD_STRING "@VERSION_BUILD@"
 
-/// MAJOR version
-#define NDN_NAC_VERSION_MAJOR @VERSION_MAJOR@
-/// MINOR version
-#define NDN_NAC_VERSION_MINOR @VERSION_MINOR@
-/// PATCH version
-#define NDN_NAC_VERSION_PATCH @VERSION_PATCH@
-
-} // namespace nac
-} // namespace ndn
-
 #endif // NDN_NAC_VERSION_HPP
diff --git a/tests/clock-fixture.cpp b/tests/clock-fixture.cpp
index f0f407b..abad20c 100644
--- a/tests/clock-fixture.cpp
+++ b/tests/clock-fixture.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020, Regents of the University of California
+ * Copyright (c) 2014-2022, Regents of the University of California
  *
  * NAC 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
@@ -19,9 +19,7 @@
 
 #include "tests/clock-fixture.hpp"
 
-namespace ndn {
-namespace nac {
-namespace tests {
+namespace ndn::nac::tests {
 
 ClockFixture::ClockFixture()
   : m_steadyClock(make_shared<time::UnitTestSteadyClock>())
@@ -51,6 +49,4 @@
   }
 }
 
-} // namespace tests
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac::tests
diff --git a/tests/clock-fixture.hpp b/tests/clock-fixture.hpp
index c20b8d9..b6b40b1 100644
--- a/tests/clock-fixture.hpp
+++ b/tests/clock-fixture.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020, Regents of the University of California
+ * Copyright (c) 2014-2022, Regents of the University of California
  *
  * NAC 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
@@ -22,11 +22,10 @@
 
 #include <ndn-cxx/util/time-unit-test-clock.hpp>
 
-namespace ndn {
-namespace nac {
-namespace tests {
+namespace ndn::nac::tests {
 
-/** \brief A test fixture that overrides steady clock and system clock.
+/**
+ * \brief A test fixture that overrides steady clock and system clock.
  */
 class ClockFixture
 {
@@ -78,8 +77,6 @@
   shared_ptr<time::UnitTestSystemClock> m_systemClock;
 };
 
-} // namespace tests
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac::tests
 
 #endif // NAC_TESTS_CLOCK_FIXTURE_HPP
diff --git a/tests/io-key-chain-fixture.hpp b/tests/io-key-chain-fixture.hpp
index fa5beab..c88a700 100644
--- a/tests/io-key-chain-fixture.hpp
+++ b/tests/io-key-chain-fixture.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020, Regents of the University of California
+ * Copyright (c) 2014-2022, Regents of the University of California
  *
  * NAC 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
@@ -25,9 +25,7 @@
 
 #include <boost/asio/io_service.hpp>
 
-namespace ndn {
-namespace nac {
-namespace tests {
+namespace ndn::nac::tests {
 
 class IoKeyChainFixture : public ClockFixture, public KeyChainFixture
 {
@@ -49,8 +47,6 @@
   boost::asio::io_service m_io;
 };
 
-} // namespace tests
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac::tests
 
 #endif // NAC_TESTS_IO_KEY_CHAIN_FIXTURE_HPP
diff --git a/tests/key-chain-fixture.cpp b/tests/key-chain-fixture.cpp
index b416524..3db4c8a 100644
--- a/tests/key-chain-fixture.cpp
+++ b/tests/key-chain-fixture.cpp
@@ -23,9 +23,7 @@
 
 #include <boost/filesystem.hpp>
 
-namespace ndn {
-namespace nac {
-namespace tests {
+namespace ndn::nac::tests {
 
 using namespace ndn::security;
 
@@ -42,30 +40,6 @@
   }
 }
 
-Certificate
-KeyChainFixture::makeCert(const Key& key, const std::string& issuer, const Key& signingKey)
-{
-  Certificate cert;
-  cert.setName(Name(key.getName())
-               .append(issuer)
-               .appendVersion());
-
-  // set metainfo
-  cert.setContentType(tlv::ContentType_Key);
-  cert.setFreshnessPeriod(1_h);
-
-  // set content
-  cert.setContent(key.getPublicKey());
-
-  // set signature info
-  ndn::SignatureInfo info;
-  auto now = time::system_clock::now();
-  info.setValidityPeriod(ValidityPeriod(now - 30_days, now + 30_days));
-
-  m_keyChain.sign(cert, signingByKey(signingKey ? signingKey : key).setSignatureInfo(info));
-  return cert;
-}
-
 bool
 KeyChainFixture::saveCert(const Data& cert, const std::string& filename)
 {
@@ -114,6 +88,4 @@
   return saveIdentityCert(id, filename);
 }
 
-} // namespace tests
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac::tests
diff --git a/tests/key-chain-fixture.hpp b/tests/key-chain-fixture.hpp
index ad3c6a1..7d6c16b 100644
--- a/tests/key-chain-fixture.hpp
+++ b/tests/key-chain-fixture.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020, Regents of the University of California
+ * Copyright (c) 2014-2022, Regents of the University of California
  *
  * NAC 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
@@ -21,11 +21,8 @@
 #define NAC_TESTS_KEY_CHAIN_FIXTURE_HPP
 
 #include <ndn-cxx/security/key-chain.hpp>
-#include <ndn-cxx/security/signing-helpers.hpp>
 
-namespace ndn {
-namespace nac {
-namespace tests {
+namespace ndn::nac::tests {
 
 /**
  * @brief A fixture providing an in-memory KeyChain.
@@ -42,16 +39,6 @@
 
 public:
   /**
-   * @brief Creates and returns a certificate for a given key
-   * @param key The key for which to make a certificate
-   * @param issuer The IssuerId to include in the certificate name
-   * @param signingKey The key with which to sign the certificate; if not provided, the
-   *                   certificate will be self-signed
-   */
-  Certificate
-  makeCert(const Key& key, const std::string& issuer, const Key& signingKey = Key());
-
-  /**
    * @brief Saves an NDN certificate to a file
    * @return true if successful, false otherwise
    */
@@ -88,8 +75,6 @@
   std::vector<std::string> m_certFiles;
 };
 
-} // namespace tests
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac::tests
 
 #endif // NAC_TESTS_KEY_CHAIN_FIXTURE_HPP
diff --git a/tests/unit/common.t.cpp b/tests/unit/common.t.cpp
index 3297cd4..c4d995f 100644
--- a/tests/unit/common.t.cpp
+++ b/tests/unit/common.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020, Regents of the University of California
+ * Copyright (c) 2014-2022, Regents of the University of California
  *
  * This file is part of NAC (Name-Based Access Control for NDN).
  * See AUTHORS.md for complete list of NAC authors and contributors.
@@ -21,16 +21,14 @@
 
 #include "tests/boost-test.hpp"
 
-namespace ndn {
-namespace nac {
-namespace tests {
+namespace ndn::nac::tests {
 
 BOOST_AUTO_TEST_SUITE(TestCommon)
 
 BOOST_AUTO_TEST_CASE(Helpers)
 {
   bool hasFailed = false;
-  auto onFailed = [&] (auto...) { hasFailed = true; };
+  auto onFailed = [&] (auto&&...) { hasFailed = true; };
 
   auto kdkPrefix = convertKekNameToKdkPrefix(Name("/access/prefix/NAC/dataset/KEK/id"), onFailed);
 
@@ -62,6 +60,4 @@
 
 BOOST_AUTO_TEST_SUITE_END()
 
-} // namespace tests
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac::tests
diff --git a/tests/unit/encryptor.t.cpp b/tests/unit/encryptor.t.cpp
index d9bafba..02ae88b 100644
--- a/tests/unit/encryptor.t.cpp
+++ b/tests/unit/encryptor.t.cpp
@@ -23,10 +23,12 @@
 #include "tests/io-key-chain-fixture.hpp"
 #include "tests/unit/static-data.hpp"
 
-#include <iostream>
+#include <ndn-cxx/security/signing-helpers.hpp>
 #include <ndn-cxx/util/dummy-client-face.hpp>
 #include <ndn-cxx/util/string-helper.hpp>
 
+#include <iostream>
+
 namespace ndn {
 namespace nac {
 namespace tests {
diff --git a/tools/ndn-nac/add-member.cpp b/tools/ndn-nac/add-member.cpp
index c6d0347..4d82044 100644
--- a/tools/ndn-nac/add-member.cpp
+++ b/tools/ndn-nac/add-member.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2020, Regents of the University of California
+/*
+ * Copyright (c) 2014-2022, Regents of the University of California
  *
  * NAC 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
@@ -20,8 +20,7 @@
 #include "ndn-nac.hpp"
 #include "access-manager.hpp"
 
-namespace ndn {
-namespace nac {
+namespace ndn::nac {
 
 int
 nac_add_member(int argc, char** argv)
@@ -103,5 +102,4 @@
   }
 }
 
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac
diff --git a/tools/ndn-nac/dump-kek.cpp b/tools/ndn-nac/dump-kek.cpp
index afc8047..a1b9d2a 100644
--- a/tools/ndn-nac/dump-kek.cpp
+++ b/tools/ndn-nac/dump-kek.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2020, Regents of the University of California
+/*
+ * Copyright (c) 2014-2022, Regents of the University of California
  *
  * NAC 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
@@ -20,8 +20,7 @@
 #include "ndn-nac.hpp"
 #include "access-manager.hpp"
 
-namespace ndn {
-namespace nac {
+namespace ndn::nac {
 
 int
 nac_dump_kek(int argc, char** argv)
@@ -95,5 +94,4 @@
   }
 }
 
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac
diff --git a/tools/ndn-nac/ndn-nac.hpp b/tools/ndn-nac/ndn-nac.hpp
index a80c531..007022f 100644
--- a/tools/ndn-nac/ndn-nac.hpp
+++ b/tools/ndn-nac/ndn-nac.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2021, Regents of the University of California
+ * Copyright (c) 2014-2022, Regents of the University of California
  *
  * NAC 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
@@ -32,8 +32,7 @@
 #include <ndn-cxx/util/exception.hpp>
 #include <ndn-cxx/util/io.hpp>
 
-namespace ndn {
-namespace nac {
+namespace ndn::nac {
 
 int
 nac_dump_kek(int argc, char** argv);
@@ -61,7 +60,6 @@
   }
 }
 
-} // namespace nac
-} // namespace ndn
+} // namespace ndn::nac
 
 #endif // NAC_TOOLS_NDN_NAC_NDN_NAC_HPP