diff --git a/ndn-cxx/detail/overload.hpp b/ndn-cxx/detail/overload.hpp
new file mode 100644
index 0000000..a12c9d8
--- /dev/null
+++ b/ndn-cxx/detail/overload.hpp
@@ -0,0 +1,113 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2013-2019 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.
+ */
+
+#ifndef NDN_DETAIL_OVERLOAD_HPP
+#define NDN_DETAIL_OVERLOAD_HPP
+
+#include <boost/version.hpp>
+
+#if BOOST_VERSION >= 106100
+#include <boost/hana/functional/overload.hpp>
+
+namespace ndn {
+namespace detail {
+constexpr boost::hana::make_overload_t overload{};
+} // namespace detail
+} // namespace ndn
+
+#else
+#include <type_traits>
+
+namespace ndn {
+namespace detail {
+namespace hana_backports {
+
+// The following code is copied from the Boost.Hana library.
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See http://boost.org/LICENSE_1_0.txt)
+
+//! Pick one of several functions to call based on overload resolution.
+//!
+//! Specifically, `overload(f1, f2, ..., fn)` is a function object such
+//! that
+//! @code
+//!     overload(f1, f2, ..., fn)(x...) == fk(x...)
+//! @endcode
+//!
+//! where `fk` is the function of `f1, ..., fn` that would be called if
+//! overload resolution was performed amongst that set of functions only.
+//! If more than one function `fk` would be picked by overload resolution,
+//! then the call is ambiguous.
+#ifndef DOXYGEN
+template <typename F, typename ...G>
+struct overload_t
+    : overload_t<F>::type
+    , overload_t<G...>::type
+{
+  using type = overload_t;
+  using overload_t<F>::type::operator();
+  using overload_t<G...>::type::operator();
+
+  template <typename F_, typename ...G_>
+  constexpr explicit overload_t(F_&& f, G_&& ...g)
+    : overload_t<F>::type(static_cast<F_&&>(f))
+    , overload_t<G...>::type(static_cast<G_&&>(g)...)
+  { }
+};
+
+template <typename F>
+struct overload_t<F> { using type = F; };
+
+template <typename R, typename ...Args>
+struct overload_t<R(*)(Args...)> {
+  using type = overload_t;
+  R (*fptr_)(Args...);
+
+  explicit constexpr overload_t(R (*fp)(Args...))
+    : fptr_(fp)
+  { }
+
+  constexpr R operator()(Args ...args) const
+  { return fptr_(static_cast<Args&&>(args)...); }
+};
+
+struct make_overload_t {
+  template <typename ...F,
+    typename Overload = typename overload_t<
+      typename std::decay<F>::type...
+    >::type
+  >
+  constexpr Overload operator()(F&& ...f) const {
+    return Overload(static_cast<F&&>(f)...);
+  }
+};
+#endif // DOXYGEN
+
+} // namespace hana_backports
+
+constexpr hana_backports::make_overload_t overload{};
+
+} // namespace detail
+} // namespace ndn
+
+#endif // BOOST_VERSION >= 106100
+#endif // NDN_DETAIL_OVERLOAD_HPP
diff --git a/ndn-cxx/key-locator.cpp b/ndn-cxx/key-locator.cpp
index 5fe3b95..a482e19 100644
--- a/ndn-cxx/key-locator.cpp
+++ b/ndn-cxx/key-locator.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ndn-cxx/key-locator.hpp"
+#include "ndn-cxx/detail/overload.hpp"
 #include "ndn-cxx/encoding/block-helpers.hpp"
 #include "ndn-cxx/util/string-helper.hpp"
 
@@ -32,10 +33,9 @@
 static_assert(std::is_base_of<tlv::Error, KeyLocator::Error>::value,
               "KeyLocator::Error must inherit from tlv::Error");
 
-KeyLocator::KeyLocator()
-  : m_type(KeyLocator_None)
-{
-}
+const size_t MAX_KEY_DIGEST_OCTETS_TO_SHOW = 5;
+
+KeyLocator::KeyLocator() = default;
 
 KeyLocator::KeyLocator(const Block& wire)
 {
@@ -43,31 +43,25 @@
 }
 
 KeyLocator::KeyLocator(const Name& name)
+  : m_locator(name)
 {
-  setName(name);
 }
 
 template<encoding::Tag TAG>
 size_t
 KeyLocator::wireEncode(EncodingImpl<TAG>& encoder) const
 {
-  // KeyLocator ::= KEY-LOCATOR-TYPE TLV-LENGTH (Name | KeyDigest)
-  // KeyDigest ::= KEY-DIGEST-TYPE TLV-LENGTH BYTE+
+  // KeyLocator = KEY-LOCATOR-TYPE TLV-LENGTH (Name / KeyDigest)
+  // KeyDigest = KEY-DIGEST-TYPE TLV-LENGTH *OCTET
 
   size_t totalLength = 0;
 
-  switch (m_type) {
-  case KeyLocator_None:
-    break;
-  case KeyLocator_Name:
-    totalLength += m_name.wireEncode(encoder);
-    break;
-  case KeyLocator_KeyDigest:
-    totalLength += encoder.prependBlock(m_keyDigest);
-    break;
-  default:
-    NDN_THROW(Error("Unsupported KeyLocator type " + to_string(m_type)));
-  }
+  auto visitor = detail::overload(
+    []  (monostate)           {}, // nothing to encode, TLV-VALUE is empty
+    [&] (const Name& name)    { totalLength += name.wireEncode(encoder); },
+    [&] (const Block& digest) { totalLength += encoder.prependBlock(digest); },
+    []  (uint32_t type)       { NDN_THROW(Error("Unsupported KeyLocator type " + to_string(type))); });
+  visit(visitor, m_locator);
 
   totalLength += encoder.prependVarNumber(totalLength);
   totalLength += encoder.prependVarNumber(tlv::KeyLocator);
@@ -98,118 +92,125 @@
   if (wire.type() != tlv::KeyLocator)
     NDN_THROW(Error("KeyLocator", wire.type()));
 
+  clear();
   m_wire = wire;
   m_wire.parse();
 
-  if (m_wire.elements().empty()) {
-    m_type = KeyLocator_None;
+  auto element = m_wire.elements_begin();
+  if (element == m_wire.elements().end()) {
     return;
   }
 
-  switch (m_wire.elements_begin()->type()) {
+  switch (element->type()) {
   case tlv::Name:
-    m_type = KeyLocator_Name;
-    m_name.wireDecode(*m_wire.elements_begin());
+    m_locator.emplace<Name>(*element);
     break;
   case tlv::KeyDigest:
-    m_type = KeyLocator_KeyDigest;
-    m_keyDigest = *m_wire.elements_begin();
+    m_locator.emplace<Block>(*element);
     break;
   default:
-    m_type = KeyLocator_Unknown;
+    m_locator = element->type();
     break;
   }
 }
 
+uint32_t
+KeyLocator::getType() const
+{
+  switch (m_locator.index()) {
+  case 0:
+    return tlv::Invalid;
+  case 1:
+    return tlv::Name;
+  case 2:
+    return tlv::KeyDigest;
+  case 3:
+    return get<uint32_t>(m_locator);
+  default:
+    BOOST_ASSERT(false);
+  }
+}
+
 KeyLocator&
 KeyLocator::clear()
 {
+  m_locator = monostate{};
   m_wire.reset();
-  m_type = KeyLocator_None;
-  m_name.clear();
-  m_keyDigest.reset();
   return *this;
 }
 
 const Name&
 KeyLocator::getName() const
 {
-  if (m_type != KeyLocator_Name)
-    NDN_THROW(Error("KeyLocator type is not Name"));
-
-  return m_name;
+  try {
+    return get<Name>(m_locator);
+  }
+  catch (const bad_variant_access&) {
+    NDN_THROW(Error("KeyLocator does not contain a Name"));
+  }
 }
 
 KeyLocator&
 KeyLocator::setName(const Name& name)
 {
-  this->clear();
-  m_type = KeyLocator_Name;
-  m_name = name;
+  m_locator = name;
+  m_wire.reset();
   return *this;
 }
 
 const Block&
 KeyLocator::getKeyDigest() const
 {
-  if (m_type != KeyLocator_KeyDigest)
-    NDN_THROW(Error("KeyLocator type is not KeyDigest"));
-
-  return m_keyDigest;
+  try {
+    return get<Block>(m_locator);
+  }
+  catch (const bad_variant_access&) {
+    NDN_THROW(Error("KeyLocator does not contain a KeyDigest"));
+  }
 }
 
 KeyLocator&
 KeyLocator::setKeyDigest(const Block& keyDigest)
 {
-  if (keyDigest.type() != tlv::KeyDigest)
-    NDN_THROW(Error("KeyDigest", keyDigest.type()));
-
-  this->clear();
-  m_type = KeyLocator_KeyDigest;
-  m_keyDigest = keyDigest;
+  if (keyDigest.type() != tlv::KeyDigest) {
+    NDN_THROW(std::invalid_argument("Invalid KeyDigest block of type " + to_string(keyDigest.type())));
+  }
+  m_locator = keyDigest;
+  m_wire.reset();
   return *this;
 }
 
 KeyLocator&
 KeyLocator::setKeyDigest(const ConstBufferPtr& keyDigest)
 {
-  // WARNING: ConstBufferPtr is shared_ptr<const Buffer>
-  // This function takes a constant reference of a shared pointer.
-  // It MUST NOT change the reference count of that shared pointer.
-
-  return this->setKeyDigest(makeBinaryBlock(tlv::KeyDigest, keyDigest->data(), keyDigest->size()));
-}
-
-bool
-KeyLocator::operator==(const KeyLocator& other) const
-{
-  return wireEncode() == other.wireEncode();
+  BOOST_ASSERT(keyDigest != nullptr);
+  m_locator = makeBinaryBlock(tlv::KeyDigest, keyDigest->data(), keyDigest->size());
+  m_wire.reset();
+  return *this;
 }
 
 std::ostream&
 operator<<(std::ostream& os, const KeyLocator& keyLocator)
 {
-  switch (keyLocator.getType()) {
-    case KeyLocator::KeyLocator_Name: {
-      return os << "Name=" << keyLocator.getName();
-    }
-    case KeyLocator::KeyLocator_KeyDigest: {
-      const size_t MAX_DIGEST_OCTETS_TO_SHOW = 5;
-      const Block& digest = keyLocator.getKeyDigest();
-      os << "KeyDigest=" << toHex(digest.value(), digest.value_size()).substr(0, MAX_DIGEST_OCTETS_TO_SHOW * 2);
-      if (digest.value_size() > MAX_DIGEST_OCTETS_TO_SHOW) {
+  auto visitor = detail::overload(
+    [&] (monostate) {
+      os << "None";
+    },
+    [&] (const Name& name) {
+      os << "Name=" << name;
+    },
+    [&] (const Block& digest) {
+      os << "KeyDigest=";
+      printHex(os, digest.value(), std::min(digest.value_size(), MAX_KEY_DIGEST_OCTETS_TO_SHOW));
+      if (digest.value_size() > MAX_KEY_DIGEST_OCTETS_TO_SHOW) {
         os << "...";
       }
-      return os;
-    }
-    case KeyLocator::KeyLocator_None: {
-      return os << "None";
-    }
-    case KeyLocator::KeyLocator_Unknown: {
-      return os << "Unknown";
-    }
-  }
-  return os << "Unknown";
+    },
+    [&] (uint32_t type) {
+      os << "Unknown(" << type << ")";
+    });
+  visit(visitor, keyLocator.m_locator);
+  return os;
 }
 
 } // namespace ndn
diff --git a/ndn-cxx/key-locator.hpp b/ndn-cxx/key-locator.hpp
index 3c7b487..417c21d 100644
--- a/ndn-cxx/key-locator.hpp
+++ b/ndn-cxx/key-locator.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2019 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -23,7 +23,6 @@
 #define NDN_KEY_LOCATOR_HPP
 
 #include "ndn-cxx/name.hpp"
-#include "ndn-cxx/encoding/encoding-buffer.hpp"
 
 namespace ndn {
 
@@ -36,52 +35,49 @@
     using tlv::Error::Error;
   };
 
-  enum Type {
-    /** \brief indicates KeyLocator is empty (internal use only)
-     */
-    KeyLocator_None = 65535,
-    /** \brief indicates KeyLocator contains a Name
-     */
-    KeyLocator_Name = 0,
-    /** \brief indicates KeyLocator contains a KeyDigest
-     */
-    KeyLocator_KeyDigest = 1,
-    /** \brief indicates KeyLocator contains an unknown element
-     */
-    KeyLocator_Unknown = 255
+  enum
+#ifndef DOXYGEN
+  [[deprecated]] // apparently doxygen can't handle this attribute on enums
+#endif
+  Type {
+    /// KeyLocator is empty
+    KeyLocator_None = tlv::Invalid,
+    /// KeyLocator contains a Name
+    KeyLocator_Name = tlv::Name,
+    /// KeyLocator contains a KeyDigest
+    KeyLocator_KeyDigest = tlv::KeyDigest,
   };
 
 public: // constructors
-  /** \brief construct an empty KeyLocator
+  /** \brief Construct an empty KeyLocator.
+   *  \post `empty() == true`
    */
   KeyLocator();
 
-  /** \brief construct from wire encoding
+  /** \brief Construct from Name.
+   *  \note Implicit conversion is permitted.
+   *  \post `getType() == tlv::Name`
+   */
+  KeyLocator(const Name& name);
+
+  /** \brief Construct from wire encoding.
    */
   explicit
   KeyLocator(const Block& wire);
 
-  /** \brief construct from Name
-   *  \note implicit conversion is permitted
-   */
-  KeyLocator(const Name& name);
-
 public: // encode and decode
-  /** \brief prepend wire encoding
-   *  \param encoder EncodingBuffer or Estimator
+  /** \brief Prepend wire encoding to \p encoder.
    */
   template<encoding::Tag TAG>
   size_t
   wireEncode(EncodingImpl<TAG>& encoder) const;
 
-  /** \return wire encoding
-   */
   const Block&
   wireEncode() const;
 
-  /** \brief decode from wire encoding
+  /** \brief Decode from wire encoding.
    *  \throw Error outer TLV type is not KeyLocator
-   *  \note No error is thrown for unrecognized inner TLV, but type becomes KeyLocator_Unknown.
+   *  \note No error is raised for an unrecognized nested TLV, but attempting to reencode will throw.
    */
   void
   wireDecode(const Block& wire);
@@ -90,72 +86,81 @@
   bool
   empty() const
   {
-    return m_type == KeyLocator_None;
+    return holds_alternative<monostate>(m_locator);
   }
 
-  Type
-  getType() const
-  {
-    return m_type;
-  }
+  uint32_t
+  getType() const;
 
-  /** \brief clear KeyLocator
-   *  \details type becomes KeyLocator_None
+  /** \brief Reset KeyLocator to its default-constructed state.
+   *  \post `empty() == true`
+   *  \post `getType() == tlv::Invalid`
    *  \return self
    */
   KeyLocator&
   clear();
 
-  /** \brief get Name element
-   *  \throw Error if type is not KeyLocator_Name
+  /** \brief Get nested Name element.
+   *  \throw Error if type is not tlv::Name
    */
   const Name&
   getName() const;
 
-  /** \brief set Name element
-   *  \details type becomes KeyLocator_Name
+  /** \brief Set nested Name element.
+   *  \post `getType() == tlv::Name`
    *  \return self
    */
   KeyLocator&
   setName(const Name& name);
 
-  /** \brief get KeyDigest element
-   *  \throw Error if type is not KeyLocator_KeyDigest
+  /** \brief Get nested KeyDigest element.
+   *  \throw Error if type is not tlv::KeyDigest
    */
   const Block&
   getKeyDigest() const;
 
-  /** \brief set KeyDigest element
-   *  \details type becomes KeyLocator_KeyDigest
-   *  \throw Error if Block type is not KeyDigest
+  /** \brief Set nested KeyDigest element (whole TLV).
+   *  \post `getType() == tlv::KeyDigest`
+   *  \throw std::invalid_argument Block type is not tlv::KeyDigest
    *  \return self
    */
   KeyLocator&
   setKeyDigest(const Block& keyDigest);
 
-  /** \brief set KeyDigest value
-   *  \details type becomes KeyLocator_KeyDigest
+  /** \brief Set nested KeyDigest element value.
+   *  \param keyDigest buffer to use as TLV-VALUE of the nested KeyDigest element.
+   *  \post `getType() == tlv::KeyDigest`
    *  \return self
    */
   KeyLocator&
   setKeyDigest(const ConstBufferPtr& keyDigest);
 
-public: // EqualityComparable concept
-  bool
-  operator==(const KeyLocator& other) const;
+private: // non-member operators
+  // NOTE: the following "hidden friend" operators are available via
+  //       argument-dependent lookup only and must be defined inline.
 
-  bool
-  operator!=(const KeyLocator& other) const
+  friend bool
+  operator==(const KeyLocator& lhs, const KeyLocator& rhs)
   {
-    return !this->operator==(other);
+    return lhs.m_locator == rhs.m_locator;
+  }
+
+  friend bool
+  operator!=(const KeyLocator& lhs, const KeyLocator& rhs)
+  {
+    return lhs.m_locator != rhs.m_locator;
   }
 
 private:
-  Type m_type;
-  Name m_name;
-  Block m_keyDigest;
+  // - monostate represents an empty KeyLocator, without any nested TLVs
+  // - Name is used when the nested TLV contains a name
+  // - Block is used when the nested TLV is a KeyDigest
+  // - in all other (unsupported) cases the nested TLV type is stored as uint32_t
+  variant<monostate, Name, Block, uint32_t> m_locator;
 
   mutable Block m_wire;
+
+  friend std::ostream& operator<<(std::ostream&, const KeyLocator&);
 };
 
 NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(KeyLocator);
diff --git a/tests/unit/key-locator.t.cpp b/tests/unit/key-locator.t.cpp
index 94d263e..a94869e 100644
--- a/tests/unit/key-locator.t.cpp
+++ b/tests/unit/key-locator.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2019 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -33,14 +33,13 @@
 BOOST_AUTO_TEST_CASE(TypeNone)
 {
   KeyLocator a;
-  BOOST_CHECK_EQUAL(a.getType(), KeyLocator::KeyLocator_None);
+  BOOST_CHECK_EQUAL(a.empty(), true);
+  BOOST_CHECK_EQUAL(a.getType(), tlv::Invalid);
   BOOST_CHECK_THROW(a.getName(), KeyLocator::Error);
   BOOST_CHECK_THROW(a.getKeyDigest(), KeyLocator::Error);
 
-  Block wire;
-  BOOST_REQUIRE_NO_THROW(wire = a.wireEncode());
-
-  // These octets are obtained by the snippet below.
+  Block wire = a.wireEncode();
+  // These octets are obtained from the snippet below.
   // This check is intended to detect unexpected encoding change in the future.
   // for (auto it = wire.begin(); it != wire.end(); ++it) {
   //   printf("0x%02x, ", *it);
@@ -53,10 +52,10 @@
 
   KeyLocator b(wire);
   BOOST_CHECK_EQUAL(a, b);
-  BOOST_CHECK_EQUAL(b.getType(), KeyLocator::KeyLocator_None);
+  BOOST_CHECK_EQUAL(a.empty(), true);
+  BOOST_CHECK_EQUAL(b.getType(), tlv::Invalid);
   BOOST_CHECK_THROW(b.getName(), KeyLocator::Error);
   BOOST_CHECK_THROW(b.getKeyDigest(), KeyLocator::Error);
-
   BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(b), "None");
 }
 
@@ -64,14 +63,13 @@
 {
   KeyLocator a;
   a.setName("/N");
-  BOOST_CHECK_EQUAL(a.getType(), KeyLocator::KeyLocator_Name);
+  BOOST_CHECK_EQUAL(a.empty(), false);
+  BOOST_CHECK_EQUAL(a.getType(), tlv::Name);
   BOOST_CHECK_EQUAL(a.getName(), Name("/N"));
   BOOST_CHECK_THROW(a.getKeyDigest(), KeyLocator::Error);
 
-  Block wire;
-  BOOST_REQUIRE_NO_THROW(wire = a.wireEncode());
-
-  // These octets are obtained by the snippet below.
+  Block wire = a.wireEncode();
+  // These octets are obtained from the snippet below.
   // This check is intended to detect unexpected encoding change in the future.
   // for (auto it = wire.begin(); it != wire.end(); ++it) {
   //   printf("0x%02x, ", *it);
@@ -84,29 +82,30 @@
 
   KeyLocator b(wire);
   BOOST_CHECK_EQUAL(a, b);
-  BOOST_CHECK_EQUAL(b.getType(), KeyLocator::KeyLocator_Name);
+  BOOST_CHECK_EQUAL(b.getType(), tlv::Name);
   BOOST_CHECK_EQUAL(b.getName(), Name("/N"));
   BOOST_CHECK_THROW(b.getKeyDigest(), KeyLocator::Error);
-
   BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(b), "Name=/N");
+
+  KeyLocator c("/N");
+  BOOST_CHECK_EQUAL(a, c);
 }
 
 BOOST_AUTO_TEST_CASE(TypeKeyDigest)
 {
   std::string digestOctets = "\x12\x34\x56\x78\x9a\xbc\xde\xf1\x23\x45";
-  ConstBufferPtr digestBuffer = make_shared<Buffer>(digestOctets.c_str(), digestOctets.size());
-  Block expectedDigestBlock = makeBinaryBlock(tlv::KeyDigest, digestOctets.c_str(), digestOctets.size());
+  ConstBufferPtr digestBuffer = make_shared<Buffer>(digestOctets.data(), digestOctets.size());
+  Block expectedDigestBlock = makeBinaryBlock(tlv::KeyDigest, digestOctets.data(), digestOctets.size());
 
   KeyLocator a;
   a.setKeyDigest(digestBuffer);
-  BOOST_CHECK_EQUAL(a.getType(), KeyLocator::KeyLocator_KeyDigest);
+  BOOST_CHECK_EQUAL(a.empty(), false);
+  BOOST_CHECK_EQUAL(a.getType(), tlv::KeyDigest);
   BOOST_CHECK_EQUAL(a.getKeyDigest(), expectedDigestBlock);
   BOOST_CHECK_THROW(a.getName(), KeyLocator::Error);
 
-  Block wire;
-  BOOST_REQUIRE_NO_THROW(wire = a.wireEncode());
-
-  // These octets are obtained by the snippet below.
+  Block wire = a.wireEncode();
+  // These octets are obtained from the snippet below.
   // This check is intended to detect unexpected encoding change in the future.
   // for (auto it = wire.begin(); it != wire.end(); ++it) {
   //   printf("0x%02x, ", *it);
@@ -119,17 +118,45 @@
 
   KeyLocator b(wire);
   BOOST_CHECK_EQUAL(a, b);
-  BOOST_CHECK_EQUAL(b.getType(), KeyLocator::KeyLocator_KeyDigest);
+  BOOST_CHECK_EQUAL(b.getType(), tlv::KeyDigest);
   BOOST_CHECK_EQUAL(b.getKeyDigest(), expectedDigestBlock);
   BOOST_CHECK_THROW(b.getName(), KeyLocator::Error);
-
   BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(b), "KeyDigest=123456789A...");
 
-  std::string shortDigest = "\xbc\xde\xf1";
-  b.setKeyDigest(make_shared<Buffer>(shortDigest.c_str(), shortDigest.size()));
+  b.setKeyDigest("1D03BCDEF1"_block);
+  BOOST_CHECK_EQUAL(b.getType(), tlv::KeyDigest);
+  BOOST_CHECK_EQUAL(b.getKeyDigest(), "1D03BCDEF1"_block);
+  BOOST_CHECK_THROW(b.getName(), KeyLocator::Error);
   BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(b), "KeyDigest=BCDEF1");
 }
 
+BOOST_AUTO_TEST_CASE(TypeUnknown)
+{
+  const auto wire = "1C037F01CC"_block;
+  KeyLocator a(wire);
+  BOOST_CHECK_EQUAL(a.empty(), false);
+  BOOST_CHECK_EQUAL(a.getType(), 127);
+
+  KeyLocator b(wire);
+  BOOST_CHECK_EQUAL(a, b);
+  BOOST_CHECK_EQUAL(b.getType(), 127);
+  BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(b), "Unknown(127)");
+
+  b.setName("/N");
+  BOOST_CHECK_NE(a, b);
+}
+
+BOOST_AUTO_TEST_CASE(Clear)
+{
+  KeyLocator a("/foo");
+  BOOST_CHECK_EQUAL(a.empty(), false);
+
+  a.clear();
+  BOOST_CHECK_EQUAL(a.empty(), true);
+  BOOST_CHECK_EQUAL(a.getType(), tlv::Invalid);
+  BOOST_CHECK_EQUAL(a, KeyLocator{});
+}
+
 BOOST_AUTO_TEST_CASE(Equality)
 {
   KeyLocator a;
@@ -149,8 +176,8 @@
   BOOST_CHECK_EQUAL(a == b, true);
   BOOST_CHECK_EQUAL(a != b, false);
 
-  char digestOctets[] = "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD";
-  ConstBufferPtr digestBuffer = make_shared<Buffer>(digestOctets, 8);
+  const char digestOctets[] = "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD";
+  auto digestBuffer = make_shared<Buffer>(digestOctets, 8);
 
   a.setKeyDigest(digestBuffer);
   BOOST_CHECK_EQUAL(a == b, false);
@@ -161,26 +188,6 @@
   BOOST_CHECK_EQUAL(a != b, false);
 }
 
-BOOST_AUTO_TEST_CASE(UnknownType)
-{
-  static const uint8_t wireOctets[] = {
-    0x1c, 0x03, 0x7f, 0x01, 0xcc
-  };
-  Block wire(wireOctets, sizeof(wireOctets));
-  KeyLocator a(wire);
-  BOOST_CHECK_EQUAL(a.getType(), KeyLocator::KeyLocator_Unknown);
-
-  KeyLocator b(wire);
-  BOOST_CHECK_EQUAL(a == b, true);
-  BOOST_CHECK_EQUAL(a != b, false);
-
-  BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(b), "Unknown");
-
-  b.setName("/N");
-  BOOST_CHECK_EQUAL(a == b, false);
-  BOOST_CHECK_EQUAL(a != b, true);
-}
-
 BOOST_AUTO_TEST_SUITE_END() // TestKeyLocator
 
 } // namespace tests
