diff --git a/src/data.cpp b/src/data.cpp
index 36fdfd4..649eb7a 100644
--- a/src/data.cpp
+++ b/src/data.cpp
@@ -32,13 +32,9 @@
 static_assert(std::is_base_of<tlv::Error, Data::Error>::value,
               "Data::Error must inherit from tlv::Error");
 
-Data::Data()
-  : m_content(tlv::Content) // empty content
-{
-}
-
 Data::Data(const Name& name)
   : m_name(name)
+  , m_content(tlv::Content)
 {
 }
 
@@ -49,28 +45,24 @@
 
 template<encoding::Tag TAG>
 size_t
-Data::wireEncode(EncodingImpl<TAG>& encoder, bool unsignedPortion/* = false*/) const
+Data::wireEncode(EncodingImpl<TAG>& encoder, bool wantUnsignedPortionOnly) const
 {
-  size_t totalLength = 0;
-
   // Data ::= DATA-TLV TLV-LENGTH
   //            Name
   //            MetaInfo
   //            Content
-  //            Signature
+  //            SignatureInfo
+  //            SignatureValue
 
-  // (reverse encoding)
+  size_t totalLength = 0;
 
-  if (!unsignedPortion && !m_signature)
-    {
-      BOOST_THROW_EXCEPTION(Error("Requested wire format, but data packet has not been signed yet"));
+  // SignatureValue
+  if (!wantUnsignedPortionOnly) {
+    if (!m_signature) {
+      BOOST_THROW_EXCEPTION(Error("Requested wire format, but Data has not been signed"));
     }
-
-  if (!unsignedPortion)
-    {
-      // SignatureValue
-      totalLength += encoder.prependBlock(m_signature.getValue());
-    }
+    totalLength += encoder.prependBlock(m_signature.getValue());
+  }
 
   // SignatureInfo
   totalLength += encoder.prependBlock(m_signature.getInfo());
@@ -84,23 +76,20 @@
   // Name
   totalLength += getName().wireEncode(encoder);
 
-  if (!unsignedPortion)
-    {
-      totalLength += encoder.prependVarNumber(totalLength);
-      totalLength += encoder.prependVarNumber(tlv::Data);
-    }
+  if (!wantUnsignedPortionOnly) {
+    totalLength += encoder.prependVarNumber(totalLength);
+    totalLength += encoder.prependVarNumber(tlv::Data);
+  }
   return totalLength;
 }
 
-
 template size_t
 Data::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder,
-                                       bool unsignedPortion) const;
+                                       bool wantUnsignedPortionOnly) const;
 
 template size_t
 Data::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder,
-                                         bool unsignedPortion) const;
-
+                                         bool wantUnsignedPortionOnly) const;
 
 const Block&
 Data::wireEncode(EncodingBuffer& encoder, const Block& signatureValue) const
@@ -138,12 +127,6 @@
   m_wire = wire;
   m_wire.parse();
 
-  // Data ::= DATA-TLV TLV-LENGTH
-  //            Name
-  //            MetaInfo
-  //            Content
-  //            Signature
-
   // Name
   m_name.wireDecode(m_wire.get(tlv::Name));
 
@@ -153,26 +136,14 @@
   // Content
   m_content = m_wire.get(tlv::Content);
 
-  ///////////////
-  // Signature //
-  ///////////////
-
   // SignatureInfo
   m_signature.setInfo(m_wire.get(tlv::SignatureInfo));
 
   // SignatureValue
   Block::element_const_iterator val = m_wire.find(tlv::SignatureValue);
-  if (val != m_wire.elements_end())
+  if (val != m_wire.elements_end()) {
     m_signature.setValue(*val);
-}
-
-Data&
-Data::setName(const Name& name)
-{
-  onChanged();
-  m_name = name;
-
-  return *this;
+  }
 }
 
 const Name&
@@ -180,8 +151,7 @@
 {
   if (m_fullName.empty()) {
     if (!m_wire.hasWire()) {
-      BOOST_THROW_EXCEPTION(Error("Full name requested, but Data packet does not have wire format "
-                                  "(e.g., not signed)"));
+      BOOST_THROW_EXCEPTION(Error("Cannot compute full name because Data has no wire encoding (not signed)"));
     }
     m_fullName = m_name;
     m_fullName.appendImplicitSha256Digest(util::Sha256::computeDigest(m_wire.wire(), m_wire.size()));
@@ -190,130 +160,116 @@
   return m_fullName;
 }
 
+void
+Data::resetWire()
+{
+  m_wire.reset();
+  m_fullName.clear();
+}
+
+Data&
+Data::setName(const Name& name)
+{
+  resetWire();
+  m_name = name;
+  return *this;
+}
+
 Data&
 Data::setMetaInfo(const MetaInfo& metaInfo)
 {
-  onChanged();
+  resetWire();
   m_metaInfo = metaInfo;
-
-  return *this;
-}
-
-Data&
-Data::setContentType(uint32_t type)
-{
-  onChanged();
-  m_metaInfo.setType(type);
-
-  return *this;
-}
-
-Data&
-Data::setFreshnessPeriod(const time::milliseconds& freshnessPeriod)
-{
-  onChanged();
-  m_metaInfo.setFreshnessPeriod(freshnessPeriod);
-
-  return *this;
-}
-
-Data&
-Data::setFinalBlockId(const name::Component& finalBlockId)
-{
-  onChanged();
-  m_metaInfo.setFinalBlockId(finalBlockId);
-
   return *this;
 }
 
 const Block&
 Data::getContent() const
 {
-  if (m_content.empty())
-    m_content = makeEmptyBlock(tlv::Content);
-
-  if (!m_content.hasWire())
-    m_content.encode();
+  if (!m_content.hasWire()) {
+    const_cast<Block&>(m_content).encode();
+  }
   return m_content;
 }
 
 Data&
-Data::setContent(const uint8_t* content, size_t contentLength)
+Data::setContent(const Block& block)
 {
-  onChanged();
+  resetWire();
 
-  m_content = makeBinaryBlock(tlv::Content, content, contentLength);
-
-  return *this;
-}
-
-Data&
-Data::setContent(const ConstBufferPtr& contentValue)
-{
-  onChanged();
-
-  m_content = Block(tlv::Content, contentValue); // not a real wire encoding yet
-
-  return *this;
-}
-
-Data&
-Data::setContent(const Block& content)
-{
-  onChanged();
-
-  if (content.type() == tlv::Content)
-    m_content = content;
+  if (block.type() == tlv::Content) {
+    m_content = block;
+  }
   else {
-    m_content = Block(tlv::Content, content);
+    m_content = Block(tlv::Content, block);
   }
 
   return *this;
 }
 
 Data&
+Data::setContent(const uint8_t* value, size_t valueSize)
+{
+  resetWire();
+  m_content = makeBinaryBlock(tlv::Content, value, valueSize);
+  return *this;
+}
+
+Data&
+Data::setContent(const ConstBufferPtr& value)
+{
+  resetWire();
+  m_content = Block(tlv::Content, value);
+  return *this;
+}
+
+Data&
 Data::setSignature(const Signature& signature)
 {
-  onChanged();
+  resetWire();
   m_signature = signature;
-
   return *this;
 }
 
 Data&
 Data::setSignatureValue(const Block& value)
 {
-  onChanged();
+  resetWire();
   m_signature.setValue(value);
-
   return *this;
 }
 
-void
-Data::onChanged()
+Data&
+Data::setContentType(uint32_t type)
 {
-  // The values have changed, so the wire format is invalidated
+  resetWire();
+  m_metaInfo.setType(type);
+  return *this;
+}
 
-  // !!!Note!!! Signature is not invalidated and it is responsibility of
-  // the application to do proper re-signing if necessary
+Data&
+Data::setFreshnessPeriod(const time::milliseconds& freshnessPeriod)
+{
+  resetWire();
+  m_metaInfo.setFreshnessPeriod(freshnessPeriod);
+  return *this;
+}
 
-  m_wire.reset();
-  m_fullName.clear();
+Data&
+Data::setFinalBlockId(const name::Component& finalBlockId)
+{
+  resetWire();
+  m_metaInfo.setFinalBlockId(finalBlockId);
+  return *this;
 }
 
 bool
-Data::operator==(const Data& other) const
+operator==(const Data& lhs, const Data& rhs)
 {
-  return getName() == other.getName() &&
-    getMetaInfo() == other.getMetaInfo() &&
-    getContent() == other.getContent() &&
-    getSignature() == other.getSignature();
-}
-
-bool
-Data::operator!=(const Data& other) const
-{
-  return !(*this == other);
+  return lhs.getName() == rhs.getName() &&
+         lhs.getMetaInfo() == rhs.getMetaInfo() &&
+         lhs.getContent() == rhs.getContent() &&
+         lhs.getSignature() == rhs.getSignature();
 }
 
 std::ostream&
@@ -322,8 +278,8 @@
   os << "Name: " << data.getName() << "\n";
   os << "MetaInfo: " << data.getMetaInfo() << "\n";
   os << "Content: (size: " << data.getContent().value_size() << ")\n";
-  os << "Signature: (type: " << data.getSignature().getType() <<
-    ", value_length: "<< data.getSignature().getValue().value_size() << ")";
+  os << "Signature: (type: " << data.getSignature().getType()
+     << ", value_length: "<< data.getSignature().getValue().value_size() << ")";
   os << std::endl;
 
   return os;
diff --git a/src/data.hpp b/src/data.hpp
index b381c4e..8f55ca2 100644
--- a/src/data.hpp
+++ b/src/data.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).
  *
@@ -22,17 +22,15 @@
 #ifndef NDN_DATA_HPP
 #define NDN_DATA_HPP
 
-#include "name.hpp"
-#include "encoding/block.hpp"
-
-#include "signature.hpp"
 #include "meta-info.hpp"
-#include "key-locator.hpp"
+#include "name.hpp"
+#include "signature.hpp"
 #include "tag-host.hpp"
+#include "encoding/block.hpp"
 
 namespace ndn {
 
-/** @brief represents a Data packet
+/** @brief Represents a Data packet
  */
 class Data : public TagHost, public enable_shared_from_this<Data>
 {
@@ -47,75 +45,37 @@
     }
   };
 
-  /**
-   * @brief Create an empty Data object
-   *
-   * Note that in certain contexts that use Data::shared_from_this(), Data must be
-   * created using `make_shared`:
-   *
-   *     shared_ptr<Data> data = make_shared<Data>();
-   *
-   * Otherwise, Data::shared_from_this() will throw an exception.
+  /** @brief Create a new Data with the given name and empty Content
+   *  @warning In certain contexts that use Data::shared_from_this(), Data must be created
+   *           using `make_shared`. Otherwise, .shared_from_this() will trigger undefined behavior.
    */
-  Data();
+  Data(const Name& name = Name());
 
-  /**
-   * @brief Create a new Data object with the given name
-   *
-   * @param name A reference to the name
-   *
-   * Note that in certain contexts that use Data::shared_from_this(), Data must be
-   * created using `make_shared`:
-   *
-   *     shared_ptr<Data> data = make_shared<Data>(name);
-   *
-   * Otherwise, Data::shared_from_this() will throw an exception.
-   */
-  Data(const Name& name);
-
-  /**
-   * @brief Create a new Data object from wire encoding
-   *
-   * Note that in certain contexts that use Data::shared_from_this(), Data must be
-   * created using `make_shared`:
-   *
-   *     shared_ptr<Data> data = make_shared<Data>(wire);
-   *
-   * Otherwise, Data::shared_from_this() will throw an exception.
+  /** @brief Create from wire encoding
+   *  @warning In certain contexts that use Data::shared_from_this(), Data must be created
+   *           using `make_shared`. Otherwise, .shared_from_this() will trigger undefined behavior.
    */
   explicit
   Data(const Block& wire);
 
-  /**
-   * @brief Fast encoding or block size estimation
-   *
-   * @param encoder                 EncodingEstimator or EncodingBuffer instance
-   * @param wantUnsignedPortionOnly Request only unsigned portion to be encoded in block.
-   *                                If true, only Name, MetaInfo, Content, and SignatureInfo
-   *                                blocks will be encoded into the block. Note that there
-   *                                will be no outer TLV header of the Data packet.
+  /** @brief Fast encoding or block size estimation
+   *  @param encoder EncodingEstimator or EncodingBuffer instance
+   *  @param wantUnsignedPortionOnly If true, only prepends Name, MetaInfo, Content, and
+   *         SignatureInfo to @p encoder, but omit SignatureValue and outmost Type-Length of Data
+   *         element. This is intended to be used with wireEncode(encoder, signatureValue).
+   *  @throw Error SignatureBits are not provided and wantUnsignedPortionOnly is false.
    */
   template<encoding::Tag TAG>
   size_t
   wireEncode(EncodingImpl<TAG>& encoder, bool wantUnsignedPortionOnly = false) const;
 
-  /**
-   * @brief Encode to a wire format
-   */
-  const Block&
-  wireEncode() const;
-
-  /**
-   * @brief Finalize Data packet encoding with the specified SignatureValue
+  /** @brief Finalize Data packet encoding with the specified SignatureValue
+   *  @param encoder EncodingBuffer containing Name, MetaInfo, Content, and SignatureInfo, but
+   *                 without SignatureValue or outmost Type-Length of Data element
+   *  @param signatureValue SignatureValue element
    *
-   * @param encoder        EncodingBuffer instance, containing Name, MetaInfo, Content, and
-   *                       SignatureInfo (without outer TLV header of the Data packet).
-   * @param signatureValue SignatureValue block to be added to Data packet to finalize
-   *                       the wire encoding
-   *
-   * This method is intended to be used in concert with Data::wireEncode(EncodingBuffer&, true)
-   * method to optimize Data packet wire format creation:
-   *
+   *  This method is intended to be used in concert with Data::wireEncode(encoder, true)
+   *  @code
    *     Data data;
    *     ...
    *     EncodingBuffer encoder;
@@ -123,233 +83,175 @@
    *     ...
    *     Block signatureValue = <sign_over_unsigned_portion>(encoder.buf(), encoder.size());
    *     data.wireEncode(encoder, signatureValue)
+   *  @endcode
    */
   const Block&
   wireEncode(EncodingBuffer& encoder, const Block& signatureValue) const;
 
-  /**
-   * @brief Decode from the wire format
+  /** @brief Encode to a wire format
+   */
+  const Block&
+  wireEncode() const;
+
+  /** @brief Decode from the wire format
    */
   void
   wireDecode(const Block& wire);
 
-  /**
-   * @brief Check if Data is already has wire encoding
+  /** @brief Check if already has wire
    */
   bool
-  hasWire() const;
+  hasWire() const
+  {
+    return m_wire.hasWire();
+  }
 
-  ////////////////////////////////////////////////////////////////////
-
-  /**
-   * @brief Get name of the Data packet
-   */
-  const Name&
-  getName() const;
-
-  /**
-   * @brief Set name to a copy of the given Name
-   *
-   * @return This Data so that you can chain calls to update values
-   */
-  Data&
-  setName(const Name& name);
-
-  //
-
-  /**
-   * @brief Get full name of Data packet, including the implicit digest
-   *
-   * @throws Error if Data packet doesn't have a full name yet (wire encoding has not been
-   *         yet created)
+  /** @brief Get full name including implicit digest
+   *  @pre hasWire() == true; i.e. wireEncode() must have been called
+   *  @throw Error Data has no wire encoding
    */
   const Name&
   getFullName() const;
 
-  /**
-   * @brief Get MetaInfo block from Data packet
+public: // Data fields
+  /** @brief Get name
+   */
+  const Name&
+  getName() const
+  {
+    return m_name;
+  }
+
+  /** @brief Set name
+   *  @return a reference to this Data, to allow chaining
+   */
+  Data&
+  setName(const Name& name);
+
+  /** @brief Get MetaInfo
    */
   const MetaInfo&
-  getMetaInfo() const;
+  getMetaInfo() const
+  {
+    return m_metaInfo;
+  }
 
-  /**
-   * @brief Set metaInfo to a copy of the given MetaInfo
-   *
-   * @return This Data so that you can chain calls to update values.
+  /** @brief Set MetaInfo
+   *  @return a reference to this Data, to allow chaining
    */
   Data&
   setMetaInfo(const MetaInfo& metaInfo);
 
-  //
-
-  ///////////////////////////////////////////////////////////////
-  ///////////////////////////////////////////////////////////////
-  ///////////////////////////////////////////////////////////////
-  // MetaInfo proxy methods
-
-  uint32_t
-  getContentType() const;
-
-  Data&
-  setContentType(uint32_t type);
-
-  //
-
-  const time::milliseconds&
-  getFreshnessPeriod() const;
-
-  Data&
-  setFreshnessPeriod(const time::milliseconds& freshnessPeriod);
-
-  //
-
-  const name::Component&
-  getFinalBlockId() const;
-
-  Data&
-  setFinalBlockId(const name::Component& finalBlockId);
-
-  //
-  ///////////////////////////////////////////////////////////////
-  ///////////////////////////////////////////////////////////////
-  ///////////////////////////////////////////////////////////////
-
-  /**
-   * @brief Get content Block
+  /** @brief Get Content
    *
-   * To access content value, one can use value()/value_size() or
-   * value_begin()/value_end() methods of the Block class
+   *  The Content value is accessible through value()/value_size() or value_begin()/value_end()
+   *  methods of the Block class.
    */
   const Block&
   getContent() const;
 
-  /**
-   * @brief Set the content from the buffer (buffer will be copied)
+  /** @brief Set Content from a block
    *
-   * @param buffer Pointer to first byte of the buffer
-   * @param bufferSize Size of the buffer
+   *  If block's TLV-TYPE is Content, it will be used directly as Data's Content element.
+   *  If block's TLV-TYPE is not Content, it will be nested into a Content element.
    *
-   * @return This Data so that you can chain calls to update values.
-   */
-  Data&
-  setContent(const uint8_t* buffer, size_t bufferSize);
-
-  /**
-   * @brief Set the content from the block
-   *
-   * Depending on type of the supplied block, there are two cases:
-   *
-   * - if block.type() == tlv::Content, then block will be used directly as Data packet's
-   *   content (no extra copying)
-   *
-   * - if block.type() != tlv::Content, then this method will create a new Block with type
-   *   tlv::Content and put block as a nested element in the content Block.
-   *
-   * @param block The Block containing the content to assign
-   *
-   * @return This Data so that you can chain calls to update values.
+   *  @return a reference to this Data, to allow chaining
    */
   Data&
   setContent(const Block& block);
 
-  /**
-   * @brief Set the content from the pointer to immutable buffer
-   *
-   * This method will create a Block with tlv::Content and set contentValue as a payload
-   * for this block.  Note that this method is very different from setContent(const
-   * Block&), since it does not require that payload should be a valid TLV element.
-   *
-   * @param contentValue The pointer to immutable buffer containing the content to assign
-   *
-   * @return This Data so that you can chain calls to update values.
+  /** @brief Copy Content value from raw buffer
+   *  @param value pointer to the first octet of the value
+   *  @param valueSize size of the raw buffer
+   *  @return a reference to this Data, to allow chaining
    */
   Data&
-  setContent(const ConstBufferPtr& contentValue);
+  setContent(const uint8_t* value, size_t valueSize);
 
-  //
+  /** @brief Set Content from wire buffer
+   *  @param value Content value, which does not need to be a TLV element
+   *  @return a reference to this Data, to allow chaining
+   */
+  Data&
+  setContent(const ConstBufferPtr& value);
 
+  /** @brief Get Signature
+   */
   const Signature&
-  getSignature() const;
+  getSignature() const
+  {
+    return m_signature;
+  }
 
-  /**
-   * @brief Set the signature to a copy of the given signature.
-   * @param signature The signature object which is cloned.
+  /** @brief Set Signature
+   *  @return a reference to this Data, to allow chaining
    */
   Data&
   setSignature(const Signature& signature);
 
+  /** @brief Set SignatureValue
+   *  @return a reference to this Data, to allow chaining
+   */
   Data&
   setSignatureValue(const Block& value);
 
-public: // EqualityComparable concept
-  bool
-  operator==(const Data& other) const;
+public: // MetaInfo fields
+  uint32_t
+  getContentType() const
+  {
+    return m_metaInfo.getType();
+  }
 
-  bool
-  operator!=(const Data& other) const;
+  Data&
+  setContentType(uint32_t type);
+
+  const time::milliseconds&
+  getFreshnessPeriod() const
+  {
+    return m_metaInfo.getFreshnessPeriod();
+  }
+
+  Data&
+  setFreshnessPeriod(const time::milliseconds& freshnessPeriod);
+
+  const name::Component&
+  getFinalBlockId() const
+  {
+    return m_metaInfo.getFinalBlockId();
+  }
+
+  Data&
+  setFinalBlockId(const name::Component& finalBlockId);
 
 protected:
-  /**
-   * @brief Clear the wire encoding.
+  /** @brief Clear wire encoding and cached FullName
+   *  @note This does not clear the SignatureValue.
    */
   void
-  onChanged();
+  resetWire();
 
 private:
   Name m_name;
   MetaInfo m_metaInfo;
-  mutable Block m_content;
+  Block m_content;
   Signature m_signature;
 
   mutable Block m_wire;
-  mutable Name m_fullName;
+  mutable Name m_fullName; ///< cached FullName computed from m_wire
 };
 
 std::ostream&
 operator<<(std::ostream& os, const Data& data);
 
+bool
+operator==(const Data& lhs, const Data& rhs);
+
 inline bool
-Data::hasWire() const
+operator!=(const Data& lhs, const Data& rhs)
 {
-  return m_wire.hasWire();
-}
-
-inline const Name&
-Data::getName() const
-{
-  return m_name;
-}
-
-inline const MetaInfo&
-Data::getMetaInfo() const
-{
-  return m_metaInfo;
-}
-
-inline uint32_t
-Data::getContentType() const
-{
-  return m_metaInfo.getType();
-}
-
-inline const time::milliseconds&
-Data::getFreshnessPeriod() const
-{
-  return m_metaInfo.getFreshnessPeriod();
-}
-
-inline const name::Component&
-Data::getFinalBlockId() const
-{
-  return m_metaInfo.getFinalBlockId();
-}
-
-inline const Signature&
-Data::getSignature() const
-{
-  return m_signature;
+  return !(lhs == rhs);
 }
 
 } // namespace ndn
 
-#endif
+#endif // NDN_DATA_HPP
diff --git a/tests/unit-tests/data.t.cpp b/tests/unit-tests/data.t.cpp
index 51c075e..e38cd98 100644
--- a/tests/unit-tests/data.t.cpp
+++ b/tests/unit-tests/data.t.cpp
@@ -27,19 +27,21 @@
 #include "security/transform/step-source.hpp"
 #include "security/transform/stream-sink.hpp"
 #include "security/verification-helpers.hpp"
+#include "util/digest.hpp"
 
 #include "boost-test.hpp"
 #include "identity-management-fixture.hpp"
+#include <boost/lexical_cast.hpp>
 
 namespace ndn {
 namespace tests {
 
 BOOST_AUTO_TEST_SUITE(TestData)
 
-const uint8_t Content1[] = {0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x21};
+const uint8_t CONTENT1[] = {0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x21};
 
-const uint8_t Data1[] = {
-0x06, 0xc5, // NDN Data
+const uint8_t DATA1[] = {
+0x06, 0xc5, // Data
     0x07, 0x14, // Name
         0x08, 0x05,
             0x6c, 0x6f, 0x63, 0x61, 0x6c,
@@ -76,56 +78,184 @@
         0xfc, 0x90, 0x7a, 0xb8, 0x66, 0x9c, 0x0e, 0xf6, 0xb7, 0x64, 0xd1
 };
 
-const unsigned char DEFAULT_PRIVATE_KEY_DER[] = {
-  0x30, 0x82, 0x02, 0x74, 0x02, 0x01, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48,
-  0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82, 0x02, 0x5e, 0x30, 0x82,
-  0x02, 0x5a, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0x9e, 0x06, 0x3e, 0x47, 0x85,
-  0xb2, 0x34, 0x37, 0xaa, 0x85, 0x47, 0xac, 0x03, 0x24, 0x83, 0xb5, 0x9c, 0xa8, 0x05,
-  0x3a, 0x24, 0x1e, 0xeb, 0x89, 0x01, 0xbb, 0xe9, 0x9b, 0xb2, 0xc3, 0x22, 0xac, 0x68,
-  0xe3, 0xf0, 0x6c, 0x02, 0xce, 0x68, 0xa6, 0xc4, 0xd0, 0xa7, 0x06, 0x90, 0x9c, 0xaa,
-  0x1b, 0x08, 0x1d, 0x8b, 0x43, 0x9a, 0x33, 0x67, 0x44, 0x6d, 0x21, 0xa3, 0x1b, 0x88,
-  0x9a, 0x97, 0x5e, 0x59, 0xc4, 0x15, 0x0b, 0xd9, 0x2c, 0xbd, 0x51, 0x07, 0x61, 0x82,
-  0xad, 0xc1, 0xb8, 0xd7, 0xbf, 0x9b, 0xcf, 0x7d, 0x24, 0xc2, 0x63, 0xf3, 0x97, 0x17,
-  0xeb, 0xfe, 0x62, 0x25, 0xba, 0x5b, 0x4d, 0x8a, 0xc2, 0x7a, 0xbd, 0x43, 0x8a, 0x8f,
-  0xb8, 0xf2, 0xf1, 0xc5, 0x6a, 0x30, 0xd3, 0x50, 0x8c, 0xc8, 0x9a, 0xdf, 0xef, 0xed,
-  0x35, 0xe7, 0x7a, 0x62, 0xea, 0x76, 0x7c, 0xbb, 0x08, 0x26, 0xc7, 0x02, 0x01, 0x11,
-  0x02, 0x81, 0x80, 0x04, 0xa5, 0xd4, 0xa7, 0xc0, 0x2a, 0xe3, 0x6b, 0x0c, 0x8b, 0x73,
-  0x0c, 0x96, 0xae, 0x40, 0x1b, 0xee, 0x04, 0xf1, 0x18, 0x4c, 0x5b, 0x43, 0x29, 0xad,
-  0x3a, 0x3b, 0x93, 0xa3, 0x60, 0x17, 0x9b, 0xa8, 0xbb, 0x68, 0xf4, 0x1e, 0x33, 0x3f,
-  0x50, 0x32, 0xf7, 0x13, 0xf8, 0xa9, 0xe6, 0x7d, 0x79, 0x44, 0x00, 0xde, 0x72, 0xed,
-  0xf2, 0x73, 0xfa, 0x7b, 0xae, 0x2a, 0x71, 0xc0, 0x40, 0xc8, 0x37, 0x6f, 0x38, 0xb2,
-  0x69, 0x1f, 0xa8, 0x83, 0x7b, 0x42, 0x00, 0x73, 0x46, 0xe6, 0x4c, 0x91, 0x7f, 0x13,
-  0x06, 0x69, 0x06, 0xd8, 0x3f, 0x22, 0x15, 0x75, 0xf6, 0xde, 0xcd, 0xb0, 0xbc, 0x66,
-  0x61, 0x91, 0x08, 0x9b, 0x2b, 0xb2, 0x00, 0xa9, 0x67, 0x05, 0x39, 0x40, 0xb9, 0x37,
-  0x85, 0x88, 0x4f, 0x76, 0x79, 0x63, 0xc0, 0x88, 0x3c, 0x86, 0xa8, 0x12, 0x94, 0x5f,
-  0xe4, 0x36, 0x3d, 0xea, 0xb9, 0x02, 0x41, 0x00, 0xb6, 0x2e, 0xbb, 0xcd, 0x2f, 0x3a,
-  0x99, 0xe0, 0xa1, 0xa5, 0x44, 0x77, 0xea, 0x0b, 0xbe, 0x16, 0x95, 0x0e, 0x64, 0xa7,
-  0x68, 0xd7, 0x4b, 0x15, 0x15, 0x23, 0xe2, 0x1e, 0x4e, 0x00, 0x2c, 0x22, 0x97, 0xae,
-  0xb0, 0x74, 0xa6, 0x99, 0xd0, 0x5d, 0xb7, 0x1b, 0x10, 0x34, 0x13, 0xd2, 0x5f, 0x6e,
-  0x56, 0xad, 0x85, 0x4a, 0xdb, 0xf0, 0x78, 0xbd, 0xf4, 0x8c, 0xb7, 0x9a, 0x3e, 0x99,
-  0xef, 0xb9, 0x02, 0x41, 0x00, 0xde, 0x0d, 0xa7, 0x48, 0x75, 0x90, 0xad, 0x11, 0xa1,
-  0xac, 0xee, 0xcb, 0x41, 0x81, 0xc6, 0xc8, 0x7f, 0xe7, 0x25, 0x94, 0xa1, 0x2a, 0x21,
-  0xa8, 0x57, 0xfe, 0x84, 0xf2, 0x5e, 0xb4, 0x96, 0x35, 0xaf, 0xef, 0x2e, 0x7a, 0xf8,
-  0xda, 0x3f, 0xac, 0x8a, 0x3c, 0x1c, 0x9c, 0xbd, 0x44, 0xd6, 0x90, 0xb5, 0xce, 0x1b,
-  0x12, 0xf9, 0x3b, 0x8c, 0x69, 0xf6, 0xa9, 0x02, 0x93, 0x48, 0x35, 0x0a, 0x7f, 0x02,
-  0x40, 0x6b, 0x2a, 0x8c, 0x96, 0xd0, 0x7c, 0xd2, 0xfc, 0x9b, 0x52, 0x28, 0x46, 0x89,
-  0xac, 0x8d, 0xef, 0x2a, 0x80, 0xef, 0xea, 0x01, 0x6f, 0x95, 0x93, 0xee, 0x51, 0x57,
-  0xd5, 0x97, 0x4b, 0x65, 0x41, 0x86, 0x66, 0xc2, 0x26, 0x80, 0x1e, 0x3e, 0x55, 0x3e,
-  0x88, 0x63, 0xe2, 0x66, 0x03, 0x47, 0x31, 0xd8, 0xa2, 0x4e, 0x68, 0x45, 0x24, 0x0a,
-  0xca, 0x17, 0x61, 0xd5, 0x69, 0xca, 0x78, 0xab, 0x21, 0x02, 0x41, 0x00, 0x8f, 0xae,
-  0x7b, 0x4d, 0x00, 0xc7, 0x06, 0x92, 0xf0, 0x24, 0x9a, 0x83, 0x84, 0xbd, 0x62, 0x81,
-  0xbc, 0x2c, 0x27, 0x60, 0x2c, 0x0c, 0x33, 0xe5, 0x66, 0x1d, 0x28, 0xd9, 0x10, 0x1a,
-  0x7f, 0x4f, 0xea, 0x4f, 0x78, 0x6d, 0xb0, 0x14, 0xbf, 0xc9, 0xff, 0x17, 0xd6, 0x47,
-  0x4d, 0x4a, 0xa8, 0xf4, 0x39, 0x67, 0x3e, 0xb1, 0xec, 0x8f, 0xf1, 0x71, 0xbd, 0xb8,
-  0xa7, 0x50, 0x3d, 0xc7, 0xf7, 0xbb, 0x02, 0x40, 0x0d, 0x85, 0x32, 0x73, 0x9f, 0x0a,
-  0x33, 0x2f, 0x4b, 0xa2, 0xbd, 0xd1, 0xb1, 0x42, 0xf0, 0x72, 0xa8, 0x7a, 0xc8, 0x15,
-  0x37, 0x1b, 0xde, 0x76, 0x70, 0xce, 0xfd, 0x69, 0x20, 0x00, 0x4d, 0xc9, 0x4f, 0x35,
-  0x6f, 0xd1, 0x35, 0xa1, 0x04, 0x95, 0x30, 0xe8, 0x3b, 0xd5, 0x03, 0x5a, 0x50, 0x21,
-  0x6d, 0xa0, 0x84, 0x39, 0xe9, 0x2e, 0x1e, 0xfc, 0xe4, 0x82, 0x43, 0x20, 0x46, 0x7d,
-  0x0a, 0xb6
+// ---- constructor, encode, decode ----
+
+BOOST_AUTO_TEST_CASE(DefaultConstructor)
+{
+  Data d;
+  BOOST_CHECK_EQUAL(d.hasWire(), false);
+  BOOST_CHECK_EQUAL(d.getName(), "/");
+  BOOST_CHECK_EQUAL(d.getContentType(), tlv::ContentType_Blob);
+  BOOST_CHECK_EQUAL(d.getFreshnessPeriod(), DEFAULT_FRESHNESS_PERIOD);
+  BOOST_CHECK_EQUAL(d.getFinalBlockId(), name::Component());
+  BOOST_CHECK_EQUAL(d.getContent().type(), tlv::Content);
+  BOOST_CHECK_EQUAL(d.getContent().value_size(), 0);
+  BOOST_CHECK(!d.getSignature());
+}
+
+class DataSigningKeyFixture
+{
+protected:
+  DataSigningKeyFixture()
+  {
+    m_privKey.loadPkcs1(PRIVATE_KEY_DER, sizeof(PRIVATE_KEY_DER));
+    auto buf = m_privKey.derivePublicKey();
+    m_pubKey.loadPkcs8(buf->data(), buf->size());
+  }
+
+protected:
+  security::transform::PrivateKey m_privKey;
+  security::transform::PublicKey m_pubKey;
+
+private:
+  static const uint8_t PRIVATE_KEY_DER[632];
 };
 
-BOOST_AUTO_TEST_CASE(DataEqualityChecks)
+const uint8_t DataSigningKeyFixture::PRIVATE_KEY_DER[] = {
+  0x30, 0x82, 0x02, 0x74, 0x02, 0x01, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
+  0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82, 0x02, 0x5e, 0x30, 0x82, 0x02, 0x5a, 0x02, 0x01,
+  0x00, 0x02, 0x81, 0x81, 0x00, 0x9e, 0x06, 0x3e, 0x47, 0x85, 0xb2, 0x34, 0x37, 0xaa, 0x85, 0x47,
+  0xac, 0x03, 0x24, 0x83, 0xb5, 0x9c, 0xa8, 0x05, 0x3a, 0x24, 0x1e, 0xeb, 0x89, 0x01, 0xbb, 0xe9,
+  0x9b, 0xb2, 0xc3, 0x22, 0xac, 0x68, 0xe3, 0xf0, 0x6c, 0x02, 0xce, 0x68, 0xa6, 0xc4, 0xd0, 0xa7,
+  0x06, 0x90, 0x9c, 0xaa, 0x1b, 0x08, 0x1d, 0x8b, 0x43, 0x9a, 0x33, 0x67, 0x44, 0x6d, 0x21, 0xa3,
+  0x1b, 0x88, 0x9a, 0x97, 0x5e, 0x59, 0xc4, 0x15, 0x0b, 0xd9, 0x2c, 0xbd, 0x51, 0x07, 0x61, 0x82,
+  0xad, 0xc1, 0xb8, 0xd7, 0xbf, 0x9b, 0xcf, 0x7d, 0x24, 0xc2, 0x63, 0xf3, 0x97, 0x17, 0xeb, 0xfe,
+  0x62, 0x25, 0xba, 0x5b, 0x4d, 0x8a, 0xc2, 0x7a, 0xbd, 0x43, 0x8a, 0x8f, 0xb8, 0xf2, 0xf1, 0xc5,
+  0x6a, 0x30, 0xd3, 0x50, 0x8c, 0xc8, 0x9a, 0xdf, 0xef, 0xed, 0x35, 0xe7, 0x7a, 0x62, 0xea, 0x76,
+  0x7c, 0xbb, 0x08, 0x26, 0xc7, 0x02, 0x01, 0x11, 0x02, 0x81, 0x80, 0x04, 0xa5, 0xd4, 0xa7, 0xc0,
+  0x2a, 0xe3, 0x6b, 0x0c, 0x8b, 0x73, 0x0c, 0x96, 0xae, 0x40, 0x1b, 0xee, 0x04, 0xf1, 0x18, 0x4c,
+  0x5b, 0x43, 0x29, 0xad, 0x3a, 0x3b, 0x93, 0xa3, 0x60, 0x17, 0x9b, 0xa8, 0xbb, 0x68, 0xf4, 0x1e,
+  0x33, 0x3f, 0x50, 0x32, 0xf7, 0x13, 0xf8, 0xa9, 0xe6, 0x7d, 0x79, 0x44, 0x00, 0xde, 0x72, 0xed,
+  0xf2, 0x73, 0xfa, 0x7b, 0xae, 0x2a, 0x71, 0xc0, 0x40, 0xc8, 0x37, 0x6f, 0x38, 0xb2, 0x69, 0x1f,
+  0xa8, 0x83, 0x7b, 0x42, 0x00, 0x73, 0x46, 0xe6, 0x4c, 0x91, 0x7f, 0x13, 0x06, 0x69, 0x06, 0xd8,
+  0x3f, 0x22, 0x15, 0x75, 0xf6, 0xde, 0xcd, 0xb0, 0xbc, 0x66, 0x61, 0x91, 0x08, 0x9b, 0x2b, 0xb2,
+  0x00, 0xa9, 0x67, 0x05, 0x39, 0x40, 0xb9, 0x37, 0x85, 0x88, 0x4f, 0x76, 0x79, 0x63, 0xc0, 0x88,
+  0x3c, 0x86, 0xa8, 0x12, 0x94, 0x5f, 0xe4, 0x36, 0x3d, 0xea, 0xb9, 0x02, 0x41, 0x00, 0xb6, 0x2e,
+  0xbb, 0xcd, 0x2f, 0x3a, 0x99, 0xe0, 0xa1, 0xa5, 0x44, 0x77, 0xea, 0x0b, 0xbe, 0x16, 0x95, 0x0e,
+  0x64, 0xa7, 0x68, 0xd7, 0x4b, 0x15, 0x15, 0x23, 0xe2, 0x1e, 0x4e, 0x00, 0x2c, 0x22, 0x97, 0xae,
+  0xb0, 0x74, 0xa6, 0x99, 0xd0, 0x5d, 0xb7, 0x1b, 0x10, 0x34, 0x13, 0xd2, 0x5f, 0x6e, 0x56, 0xad,
+  0x85, 0x4a, 0xdb, 0xf0, 0x78, 0xbd, 0xf4, 0x8c, 0xb7, 0x9a, 0x3e, 0x99, 0xef, 0xb9, 0x02, 0x41,
+  0x00, 0xde, 0x0d, 0xa7, 0x48, 0x75, 0x90, 0xad, 0x11, 0xa1, 0xac, 0xee, 0xcb, 0x41, 0x81, 0xc6,
+  0xc8, 0x7f, 0xe7, 0x25, 0x94, 0xa1, 0x2a, 0x21, 0xa8, 0x57, 0xfe, 0x84, 0xf2, 0x5e, 0xb4, 0x96,
+  0x35, 0xaf, 0xef, 0x2e, 0x7a, 0xf8, 0xda, 0x3f, 0xac, 0x8a, 0x3c, 0x1c, 0x9c, 0xbd, 0x44, 0xd6,
+  0x90, 0xb5, 0xce, 0x1b, 0x12, 0xf9, 0x3b, 0x8c, 0x69, 0xf6, 0xa9, 0x02, 0x93, 0x48, 0x35, 0x0a,
+  0x7f, 0x02, 0x40, 0x6b, 0x2a, 0x8c, 0x96, 0xd0, 0x7c, 0xd2, 0xfc, 0x9b, 0x52, 0x28, 0x46, 0x89,
+  0xac, 0x8d, 0xef, 0x2a, 0x80, 0xef, 0xea, 0x01, 0x6f, 0x95, 0x93, 0xee, 0x51, 0x57, 0xd5, 0x97,
+  0x4b, 0x65, 0x41, 0x86, 0x66, 0xc2, 0x26, 0x80, 0x1e, 0x3e, 0x55, 0x3e, 0x88, 0x63, 0xe2, 0x66,
+  0x03, 0x47, 0x31, 0xd8, 0xa2, 0x4e, 0x68, 0x45, 0x24, 0x0a, 0xca, 0x17, 0x61, 0xd5, 0x69, 0xca,
+  0x78, 0xab, 0x21, 0x02, 0x41, 0x00, 0x8f, 0xae, 0x7b, 0x4d, 0x00, 0xc7, 0x06, 0x92, 0xf0, 0x24,
+  0x9a, 0x83, 0x84, 0xbd, 0x62, 0x81, 0xbc, 0x2c, 0x27, 0x60, 0x2c, 0x0c, 0x33, 0xe5, 0x66, 0x1d,
+  0x28, 0xd9, 0x10, 0x1a, 0x7f, 0x4f, 0xea, 0x4f, 0x78, 0x6d, 0xb0, 0x14, 0xbf, 0xc9, 0xff, 0x17,
+  0xd6, 0x47, 0x4d, 0x4a, 0xa8, 0xf4, 0x39, 0x67, 0x3e, 0xb1, 0xec, 0x8f, 0xf1, 0x71, 0xbd, 0xb8,
+  0xa7, 0x50, 0x3d, 0xc7, 0xf7, 0xbb, 0x02, 0x40, 0x0d, 0x85, 0x32, 0x73, 0x9f, 0x0a, 0x33, 0x2f,
+  0x4b, 0xa2, 0xbd, 0xd1, 0xb1, 0x42, 0xf0, 0x72, 0xa8, 0x7a, 0xc8, 0x15, 0x37, 0x1b, 0xde, 0x76,
+  0x70, 0xce, 0xfd, 0x69, 0x20, 0x00, 0x4d, 0xc9, 0x4f, 0x35, 0x6f, 0xd1, 0x35, 0xa1, 0x04, 0x95,
+  0x30, 0xe8, 0x3b, 0xd5, 0x03, 0x5a, 0x50, 0x21, 0x6d, 0xa0, 0x84, 0x39, 0xe9, 0x2e, 0x1e, 0xfc,
+  0xe4, 0x82, 0x43, 0x20, 0x46, 0x7d, 0x0a, 0xb6
+};
+
+BOOST_FIXTURE_TEST_CASE(Encode, DataSigningKeyFixture)
+{
+  // manual data packet creation for now
+
+  Data d(Name("/local/ndn/prefix"));
+  d.setContentType(tlv::ContentType_Blob);
+  d.setFreshnessPeriod(time::seconds(10));
+  d.setContent(CONTENT1, sizeof(CONTENT1));
+
+  Block signatureInfo(tlv::SignatureInfo);
+  // SignatureType
+  signatureInfo.push_back(makeNonNegativeIntegerBlock(tlv::SignatureType, tlv::SignatureSha256WithRsa));
+  // KeyLocator
+  {
+    KeyLocator keyLocator;
+    keyLocator.setName("/test/key/locator");
+    signatureInfo.push_back(keyLocator.wireEncode());
+  }
+  signatureInfo.encode();
+
+  // SignatureValue
+  OBufferStream os;
+  tlv::writeVarNumber(os, tlv::SignatureValue);
+
+  OBufferStream sig;
+  {
+    namespace tr = security::transform;
+
+    tr::StepSource input;
+    input >> tr::signerFilter(DigestAlgorithm::SHA256, m_privKey) >> tr::streamSink(sig);
+
+    input.write(d.getName().    wireEncode().wire(), d.getName().    wireEncode().size());
+    input.write(d.getMetaInfo().wireEncode().wire(), d.getMetaInfo().wireEncode().size());
+    input.write(d.getContent().              wire(), d.getContent().              size());
+    input.write(signatureInfo.               wire(), signatureInfo.               size());
+    input.end();
+  }
+  auto buf = sig.buf();
+  tlv::writeVarNumber(os, buf->size());
+  os.write(reinterpret_cast<const char*>(buf->data()), buf->size());
+
+  Block signatureValue(os.buf());
+  Signature signature(signatureInfo, signatureValue);
+  d.setSignature(signature);
+
+  Block dataBlock(d.wireEncode());
+  BOOST_CHECK_EQUAL_COLLECTIONS(DATA1, DATA1 + sizeof(DATA1),
+                                dataBlock.begin(), dataBlock.end());
+}
+
+BOOST_FIXTURE_TEST_CASE(Decode, DataSigningKeyFixture)
+{
+  Block dataBlock(DATA1, sizeof(DATA1));
+  Data d(dataBlock);
+
+  BOOST_CHECK_EQUAL(d.getName().toUri(), "/local/ndn/prefix");
+  BOOST_CHECK_EQUAL(d.getContentType(), static_cast<uint32_t>(tlv::ContentType_Blob));
+  BOOST_CHECK_EQUAL(d.getFreshnessPeriod(), time::seconds(10));
+  BOOST_CHECK_EQUAL(std::string(reinterpret_cast<const char*>(d.getContent().value()),
+                                d.getContent().value_size()), "SUCCESS!");
+  BOOST_CHECK_EQUAL(d.getSignature().getType(), tlv::SignatureSha256WithRsa);
+
+  Block block = d.getSignature().getInfo();
+  block.parse();
+  KeyLocator keyLocator(block.get(tlv::KeyLocator));
+  BOOST_CHECK_EQUAL(keyLocator.getName().toUri(), "/test/key/locator");
+
+  BOOST_CHECK(security::verifySignature(d, m_pubKey));
+}
+
+BOOST_FIXTURE_TEST_CASE(FullName, IdentityManagementFixture)
+{
+  Data d(Name("/local/ndn/prefix"));
+  d.setContentType(tlv::ContentType_Blob);
+  d.setFreshnessPeriod(time::seconds(10));
+  d.setContent(CONTENT1, sizeof(CONTENT1));
+  BOOST_CHECK_THROW(d.getFullName(), Data::Error); // FullName is unavailable without signing
+
+  m_keyChain.sign(d);
+  BOOST_CHECK_EQUAL(d.hasWire(), true);
+  Name fullName = d.getFullName(); // FullName is available after signing
+
+  BOOST_CHECK_EQUAL(d.getName().size() + 1, fullName.size());
+  BOOST_CHECK_EQUAL_COLLECTIONS(d.getName().begin(), d.getName().end(),
+                                fullName.begin(), fullName.end() - 1);
+  BOOST_CHECK_EQUAL(fullName.get(-1).value_size(), util::Sha256::DIGEST_SIZE);
+
+  // FullName should be cached, so value() pointer points to same memory location
+  BOOST_CHECK_EQUAL(fullName.get(-1).value(), d.getFullName().get(-1).value());
+
+  d.setFreshnessPeriod(time::seconds(100)); // invalidates FullName
+  BOOST_CHECK_THROW(d.getFullName(), Data::Error);
+
+  Data d1(Block(DATA1, sizeof(DATA1)));
+  BOOST_CHECK_EQUAL(d1.getFullName(),
+    "/local/ndn/prefix/"
+    "sha256digest=28bad4b5275bd392dbb670c75cf0b66f13f7942b21e80f55c0e86b374753a548");
+}
+
+// ---- operators ----
+
+BOOST_AUTO_TEST_CASE(Equality)
 {
   using namespace time;
 
@@ -172,174 +302,16 @@
   BOOST_CHECK_EQUAL(a != b, false);
 }
 
-BOOST_AUTO_TEST_CASE(SignatureEqualityChecks)
+BOOST_AUTO_TEST_CASE(Print)
 {
-  Signature a;
-  Signature b;
-
-  BOOST_CHECK_EQUAL(a == b, true);
-  BOOST_CHECK_EQUAL(a != b, false);
-
-  a = SignatureSha256WithRsa();
-  BOOST_CHECK_EQUAL(a == b, false);
-  BOOST_CHECK_EQUAL(a != b, true);
-
-  b = SignatureSha256WithRsa();
-  static const uint8_t someData[256] = {};
-  Block signatureValue = makeBinaryBlock(tlv::SignatureValue, someData, sizeof(someData));
-  b.setValue(signatureValue);
-  BOOST_CHECK_EQUAL(a == b, false);
-  BOOST_CHECK_EQUAL(a != b, true);
-
-  a.setValue(signatureValue);
-  BOOST_CHECK_EQUAL(a == b, true);
-  BOOST_CHECK_EQUAL(a != b, false);
-
-  a = DigestSha256();
-  b = SignatureSha256WithRsa();
-  BOOST_CHECK_EQUAL(a == b, false);
-  BOOST_CHECK_EQUAL(a != b, true);
-
-  b = DigestSha256();
-  BOOST_CHECK_EQUAL(a == b, true);
-  BOOST_CHECK_EQUAL(a != b, false);
-}
-
-class TestDataFixture
-{
-protected:
-  TestDataFixture()
-  {
-    m_privKey.loadPkcs1(DEFAULT_PRIVATE_KEY_DER, sizeof(DEFAULT_PRIVATE_KEY_DER));
-    auto buf = m_privKey.derivePublicKey();
-    m_pubKey.loadPkcs8(buf->data(), buf->size());
-  }
-
-protected:
-  security::transform::PrivateKey m_privKey;
-  security::transform::PublicKey m_pubKey;
-};
-
-BOOST_FIXTURE_TEST_CASE(Decode, TestDataFixture)
-{
-  Block dataBlock(Data1, sizeof(Data1));
-  Data d(dataBlock);
-
-  BOOST_CHECK_EQUAL(d.getName().toUri(), "/local/ndn/prefix");
-  BOOST_CHECK_EQUAL(d.getContentType(), static_cast<uint32_t>(tlv::ContentType_Blob));
-  BOOST_CHECK_EQUAL(d.getFreshnessPeriod(), time::seconds(10));
-  BOOST_CHECK_EQUAL(std::string(reinterpret_cast<const char*>(d.getContent().value()),
-                                d.getContent().value_size()), "SUCCESS!");
-  BOOST_CHECK_EQUAL(d.getSignature().getType(), tlv::SignatureSha256WithRsa);
-
-  Block block = d.getSignature().getInfo();
-  block.parse();
-  KeyLocator keyLocator(block.get(tlv::KeyLocator));
-  BOOST_CHECK_EQUAL(keyLocator.getName().toUri(), "/test/key/locator");
-
-  BOOST_CHECK(security::verifySignature(d, m_pubKey));
-}
-
-BOOST_FIXTURE_TEST_CASE(Encode, TestDataFixture)
-{
-  // manual data packet creation for now
-
-  Data d(Name("/local/ndn/prefix"));
-  d.setContentType(tlv::ContentType_Blob);
-  d.setFreshnessPeriod(time::seconds(10));
-  d.setContent(Content1, sizeof(Content1));
-
-  Block signatureInfo(tlv::SignatureInfo);
-  // SignatureType
-  signatureInfo.push_back(makeNonNegativeIntegerBlock(tlv::SignatureType, tlv::SignatureSha256WithRsa));
-  // KeyLocator
-  {
-    KeyLocator keyLocator;
-    keyLocator.setName("/test/key/locator");
-    signatureInfo.push_back(keyLocator.wireEncode());
-  }
-  signatureInfo.encode();
-
-  // SignatureValue
-  OBufferStream os;
-  tlv::writeVarNumber(os, tlv::SignatureValue);
-
-  OBufferStream sig;
-  {
-    namespace tr = security::transform;
-
-    tr::StepSource input;
-    input >> tr::signerFilter(DigestAlgorithm::SHA256, m_privKey) >> tr::streamSink(sig);
-
-    input.write(d.getName().    wireEncode().wire(), d.getName().    wireEncode().size());
-    input.write(d.getMetaInfo().wireEncode().wire(), d.getMetaInfo().wireEncode().size());
-    input.write(d.getContent().              wire(), d.getContent().              size());
-    input.write(signatureInfo.               wire(), signatureInfo.               size());
-    input.end();
-  }
-  auto buf = sig.buf();
-  tlv::writeVarNumber(os, buf->size());
-  os.write(reinterpret_cast<const char*>(buf->data()), buf->size());
-
-  Block signatureValue(os.buf());
-  Signature signature(signatureInfo, signatureValue);
-  d.setSignature(signature);
-
-  Block dataBlock(d.wireEncode());
-  BOOST_CHECK_EQUAL_COLLECTIONS(Data1, Data1 + sizeof(Data1),
-                                dataBlock.begin(), dataBlock.end());
-
-  std::ostringstream ss;
-  ss << d;
-  BOOST_CHECK_EQUAL(ss.str(),
+  Data d(Block(DATA1, sizeof(DATA1)));
+  BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(d),
                     "Name: /local/ndn/prefix\n"
                     "MetaInfo: ContentType: 0, FreshnessPeriod: 10000 milliseconds\n"
                     "Content: (size: 8)\n"
                     "Signature: (type: 1, value_length: 128)\n");
 }
 
-BOOST_FIXTURE_TEST_CASE(FullName, IdentityManagementFixture)
-{
-  // Encoding pipeline
-
-  Data d(Name("/local/ndn/prefix"));
-  d.setContentType(tlv::ContentType_Blob);
-  d.setFreshnessPeriod(time::seconds(10));
-
-  d.setContent(Content1, sizeof(Content1));
-
-  BOOST_CHECK_THROW(d.getFullName(), Data::Error);
-
-  m_keyChain.sign(d);
-
-  Name fullName;
-  BOOST_REQUIRE_NO_THROW(fullName = d.getFullName());
-
-  BOOST_CHECK_EQUAL(d.getName().hasWire(), true);
-  BOOST_CHECK_EQUAL(fullName.hasWire(), false);
-
-  // check if name was properly cached
-  BOOST_CHECK_EQUAL(fullName.get(-1).value(), d.getFullName().get(-1).value());
-
-  // check FullName content
-  BOOST_REQUIRE_EQUAL(d.getName().size() + 1, fullName.size());
-  BOOST_CHECK_EQUAL_COLLECTIONS(d.getName().begin(), d.getName().end(),
-                                fullName.begin(), fullName.end() - 1);
-  BOOST_CHECK_EQUAL(fullName.get(-1).value_size(), 32);
-
-  // FullName should be reset after the next line
-  d.setFreshnessPeriod(time::seconds(100));
-  BOOST_CHECK_THROW(d.getFullName(), Data::Error);
-
-  // Decoding pipeline
-  d.wireDecode(Block(Data1, sizeof(Data1)));
-  BOOST_REQUIRE_NO_THROW(fullName = d.getFullName());
-
-  BOOST_CHECK_EQUAL(fullName.toUri(),
-    "/local/ndn/prefix/"
-    "sha256digest=28bad4b5275bd392dbb670c75cf0b66f13f7942b21e80f55c0e86b374753a548");
-}
-
 BOOST_AUTO_TEST_SUITE_END() // TestData
 
 } // namespace tests
diff --git a/tests/unit-tests/signature.t.cpp b/tests/unit-tests/signature.t.cpp
new file mode 100644
index 0000000..ecd2569
--- /dev/null
+++ b/tests/unit-tests/signature.t.cpp
@@ -0,0 +1,69 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2013-2017 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.
+ */
+
+#include "signature.hpp"
+#include "security/digest-sha256.hpp"
+#include "security/signature-sha256-with-rsa.hpp"
+
+#include "boost-test.hpp"
+
+namespace ndn {
+namespace tests {
+
+BOOST_AUTO_TEST_SUITE(TestSignature)
+
+BOOST_AUTO_TEST_CASE(Equality)
+{
+  Signature a;
+  Signature b;
+
+  BOOST_CHECK_EQUAL(a == b, true);
+  BOOST_CHECK_EQUAL(a != b, false);
+
+  a = SignatureSha256WithRsa();
+  BOOST_CHECK_EQUAL(a == b, false);
+  BOOST_CHECK_EQUAL(a != b, true);
+
+  b = SignatureSha256WithRsa();
+  static const uint8_t someData[256] = {};
+  Block signatureValue = makeBinaryBlock(tlv::SignatureValue, someData, sizeof(someData));
+  b.setValue(signatureValue);
+  BOOST_CHECK_EQUAL(a == b, false);
+  BOOST_CHECK_EQUAL(a != b, true);
+
+  a.setValue(signatureValue);
+  BOOST_CHECK_EQUAL(a == b, true);
+  BOOST_CHECK_EQUAL(a != b, false);
+
+  a = DigestSha256();
+  b = SignatureSha256WithRsa();
+  BOOST_CHECK_EQUAL(a == b, false);
+  BOOST_CHECK_EQUAL(a != b, true);
+
+  b = DigestSha256();
+  BOOST_CHECK_EQUAL(a == b, true);
+  BOOST_CHECK_EQUAL(a != b, false);
+}
+
+BOOST_AUTO_TEST_SUITE_END() // TestSignature
+
+} // namespace tests
+} // namespace ndn
