diff --git a/tools/ndn-nac/add-member.cpp b/tools/ndn-nac/add-member.cpp
new file mode 100644
index 0000000..cc8455c
--- /dev/null
+++ b/tools/ndn-nac/add-member.cpp
@@ -0,0 +1,107 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2018, 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
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * NAC 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 NAC library authors and contributors.
+ */
+
+#include "ndn-nac.hpp"
+#include "access-manager.hpp"
+
+namespace ndn {
+namespace nac {
+
+int
+nac_add_member(int argc, char** argv)
+{
+  namespace po = boost::program_options;
+
+  Name identityName;
+  Name datasetName;
+  std::string output;
+  std::string member;
+
+  po::options_description description("General Usage\n"
+                                      "  ndn-nac add-member [-h] [-o output] [-d dataset] [-i] identity [-m] memberCert\n"
+                                      "General options");
+  description.add_options()
+    ("help,h", "Produce help message")
+    ("output,o", po::value<std::string>(&output), "(Optional) output file, stdout if not specified")
+    ("identity,i", po::value<Name>(&identityName), "Data owner's namespace identity")
+    ("dataset,d", po::value<Name>(&datasetName), "Name of dataset to control")
+    ("member,m", po::value<std::string>(&member), "File with member's certificate, stdin if -")
+    ;
+
+  po::positional_options_description p;
+  p.add("identity", 1);
+  p.add("member", 1);
+
+  po::variables_map vm;
+  try {
+    po::store(po::command_line_parser(argc, argv).options(description).positional(p).run(), vm);
+    po::notify(vm);
+  }
+  catch (const std::exception& e) {
+    std::cerr << "ERROR: " << e.what() << std::endl;
+    std::cerr << description << std::endl;
+    return 1;
+  }
+
+  if (vm.count("help") != 0) {
+    std::cerr << description << std::endl;
+    return 0;
+  }
+
+  if (vm.count("identity") == 0) {
+    std::cerr << "ERROR: identity must be specified" << std::endl;
+    std::cerr << description << std::endl;
+    return 1;
+  }
+
+  if (vm.count("member") == 0) {
+    std::cerr << "ERROR: member must be specified" << std::endl;
+    std::cerr << description << std::endl;
+    return 1;
+  }
+
+  if (vm.count("output") == 0)
+    output = "-";
+
+  try {
+    security::v2::KeyChain keyChain;
+    security::Identity id = keyChain.getPib().getIdentity(identityName);
+
+    auto cert = loadCertificate(member);
+
+    util::DummyClientFace face(keyChain); // to avoid any real IO
+    AccessManager manager(id, datasetName, keyChain, face);
+
+    auto kdk = manager.addMember(cert);
+
+    if (output == "-")
+      io::save(kdk, std::cout);
+    else
+      io::save(kdk, output);
+
+    return 0;
+  }
+  catch (const std::runtime_error& e) {
+    std::cerr << "ERROR: " << e.what() << std::endl;
+    return 1;
+  }
+}
+
+} // namespace nac
+} // namespace ndn
diff --git a/tools/ndn-nac/dump-kek.cpp b/tools/ndn-nac/dump-kek.cpp
new file mode 100644
index 0000000..5d3c35e
--- /dev/null
+++ b/tools/ndn-nac/dump-kek.cpp
@@ -0,0 +1,99 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2018, 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
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * NAC 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 NAC library authors and contributors.
+ */
+
+#include "ndn-nac.hpp"
+#include "access-manager.hpp"
+
+namespace ndn {
+namespace nac {
+
+int
+nac_dump_kek(int argc, char** argv)
+{
+  namespace po = boost::program_options;
+
+  Name identityName;
+  Name datasetName;
+  std::string output;
+
+  po::options_description description("General Usage\n"
+                                      "  ndn-nac dump-kek [-h] [-o output] [-d dataset] [-i] identity \n"
+                                      "General options");
+  description.add_options()
+    ("help,h", "Produce help message")
+    ("output,o", po::value<std::string>(&output), "(Optional) output file, stdout if not specified")
+    ("identity,i", po::value<Name>(&identityName), "Data owner's namespace identity")
+    ("dataset,d", po::value<Name>(&datasetName), "Name of dataset to control")
+    ;
+
+  po::positional_options_description p;
+  p.add("identity", 1);
+
+  po::variables_map vm;
+  try {
+    po::store(po::command_line_parser(argc, argv).options(description).positional(p).run(), vm);
+    po::notify(vm);
+  }
+  catch (const std::exception& e) {
+    std::cerr << "ERROR: " << e.what() << std::endl;
+    std::cerr << description << std::endl;
+    return 1;
+  }
+
+  if (vm.count("help") != 0) {
+    std::cerr << description << std::endl;
+    return 0;
+  }
+
+  if (vm.count("identity") == 0) {
+    std::cerr << "ERROR: identity must be specified" << std::endl;
+    std::cerr << description << std::endl;
+    return 1;
+  }
+
+  if (vm.count("output") == 0)
+    output = "-";
+
+  try {
+    security::v2::KeyChain keyChain;
+    security::Identity id = keyChain.getPib().getIdentity(identityName);
+
+    util::DummyClientFace face(keyChain); // to avoid any real IO
+    AccessManager manager(id, datasetName, keyChain, face);
+
+    if (manager.size() != 1) {
+      std::cerr << "ERROR: Incorrect state of AccessManager instance (expect 1 KDK)" << std::endl;
+      return 2;
+    }
+
+    if (output == "-")
+      io::save(*manager.begin(), std::cout);
+    else
+      io::save(*manager.begin(), output);
+
+    return 0;
+  }
+  catch (const std::runtime_error& e) {
+    std::cerr << "ERROR: " << e.what() << std::endl;
+    return 1;
+  }
+}
+
+} // namespace nac
+} // namespace ndn
diff --git a/tools/ndn-nac/main.cpp b/tools/ndn-nac/main.cpp
new file mode 100644
index 0000000..0ebe9ed
--- /dev/null
+++ b/tools/ndn-nac/main.cpp
@@ -0,0 +1,76 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2018, 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
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * NAC 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 NAC library authors and contributors.
+ */
+
+#include "ndn-nac.hpp"
+#include "version.hpp"
+
+#include <boost/exception/get_error_info.hpp>
+#include <ndn-cxx/util/logger.hpp>
+
+NDN_LOG_INIT(nac.Cmd);
+
+std::string nac_helper = R"STR(
+  help         Show all commands
+  version      Show version and exit
+  dump-kek     Dump KEK
+  add-member   Create KDK for the member
+)STR";
+
+int
+main(int argc, char** argv)
+{
+  if (argc < 2) {
+    std::cerr << nac_helper << std::endl;
+    return 1;
+  }
+
+  using namespace ndn::nac;
+
+  std::string command(argv[1]);
+  try {
+    if (command == "help")              { std::cout << nac_helper << std::endl; }
+    else if (command == "version")      { std::cout << NDN_NAC_VERSION_BUILD_STRING << std::endl; }
+    else if (command == "dump-kek")     { return nac_dump_kek(argc - 1, argv + 1); }
+    else if (command == "add-member")   { return nac_add_member(argc - 1, argv + 1); }
+    else {
+      std::cerr << nac_helper << std::endl;
+      return 1;
+    }
+  }
+  catch (const std::exception& e) {
+
+    std::cerr << "ERROR: " << e.what();
+
+    std::ostringstream extendedError;
+    const char* const* file = boost::get_error_info<boost::throw_file>(e);
+    const int* line = boost::get_error_info<boost::throw_line>(e);
+    const char* const* func = boost::get_error_info<boost::throw_function>(e);
+    if (file && line) {
+      extendedError << " [from " << *file << ":" << *line;
+      if (func) {
+        extendedError << " in " << *func;
+      }
+      extendedError << "]";
+    }
+    NDN_LOG_ERROR(e.what() << extendedError.str());
+    return 1;
+  }
+
+  return 0;
+}
diff --git a/tools/ndn-nac/ndn-nac.hpp b/tools/ndn-nac/ndn-nac.hpp
new file mode 100644
index 0000000..3f70bbd
--- /dev/null
+++ b/tools/ndn-nac/ndn-nac.hpp
@@ -0,0 +1,65 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2018, 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
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * NAC 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 NAC library authors and contributors.
+ */
+
+#ifndef NAC_TOOLS_NDN_NAC_NDN_NAC_HPP
+#define NAC_TOOLS_NDN_NAC_NDN_NAC_HPP
+
+#include "common.hpp"
+
+#include <fstream>
+#include <iostream>
+#include <string>
+
+#include <boost/asio.hpp>
+#include <boost/exception/all.hpp>
+#include <boost/program_options/options_description.hpp>
+#include <boost/program_options/parsers.hpp>
+#include <boost/program_options/variables_map.hpp>
+
+#include <ndn-cxx/util/dummy-client-face.hpp>
+#include <ndn-cxx/util/io.hpp>
+
+namespace ndn {
+namespace nac {
+
+int
+nac_dump_kek(int argc, char** argv);
+
+int
+nac_add_member(int argc, char** argv);
+
+inline security::v2::Certificate
+loadCertificate(const std::string& fileName)
+{
+  shared_ptr<security::v2::Certificate> cert;
+  if (fileName == "-")
+    cert = io::load<security::v2::Certificate>(std::cin);
+  else
+    cert = io::load<security::v2::Certificate>(fileName);
+
+  if (cert == nullptr) {
+    BOOST_THROW_EXCEPTION(std::runtime_error("Cannot load certificate from " + fileName));
+  }
+  return *cert;
+}
+
+} // namespace nac
+} // namespace ndn
+
+#endif // NAC_TOOLS_NDN_NAC_NDN_NAC_HPP
