diff --git a/ndn-cpp/c/data.h b/ndn-cpp/c/data.h
index e8b2bf1..0226919 100644
--- a/ndn-cpp/c/data.h
+++ b/ndn-cpp/c/data.h
@@ -42,7 +42,7 @@
   ndn_ContentType_NACK = 5
 } ndn_ContentType;
 
-struct ndn_SignedInfo {
+struct ndn_MetaInfo {
   struct ndn_PublisherPublicKeyDigest publisherPublicKeyDigest;
   double timestampMilliseconds;    /**< milliseconds since 1/1/1970. -1 for none */
   ndn_ContentType type;            /**< default is ndn_ContentType_DATA. -1 for none */
@@ -53,13 +53,13 @@
 };
 
 /**
- * Initialize the ndn_SignedInfo struct with values for none and the type to the default ndn_ContentType_DATA.
- * @param self A pointer to the ndn_SignedInfo struct.
+ * Initialize the ndn_MetaInfo struct with values for none and the type to the default ndn_ContentType_DATA.
+ * @param self A pointer to the ndn_MetaInfo struct.
  * @param keyNameComponents The pre-allocated array of ndn_NameComponent for the keyLocator.
  * @param maxKeyNameComponents The number of elements in the allocated keyNameComponents array.
  */
-static inline void ndn_SignedInfo_initialize
-  (struct ndn_SignedInfo *self, struct ndn_NameComponent *keyNameComponents, unsigned int maxKeyNameComponents) {
+static inline void ndn_MetaInfo_initialize
+  (struct ndn_MetaInfo *self, struct ndn_NameComponent *keyNameComponents, unsigned int maxKeyNameComponents) {
   ndn_PublisherPublicKeyDigest_initialize(&self->publisherPublicKeyDigest);
   self->type = ndn_ContentType_DATA;
   self->freshnessSeconds = -1;
@@ -71,7 +71,7 @@
 struct ndn_Data {
   struct ndn_Signature signature;
   struct ndn_Name name;
-  struct ndn_SignedInfo signedInfo;
+  struct ndn_MetaInfo metaInfo;
   unsigned char *content;     /**< pointer to the content */
   unsigned int contentLength; /**< length of content */
 };
@@ -82,7 +82,7 @@
  * @param self A pointer to the ndn_Data struct.
  * @param nameComponents The pre-allocated array of ndn_NameComponent.
  * @param maxNameComponents The number of elements in the allocated nameComponents array.
- * @param keyNameComponents The pre-allocated array of ndn_NameComponent for the signedInfo.keyLocator.
+ * @param keyNameComponents The pre-allocated array of ndn_NameComponent for the metaInfo.keyLocator.
  * @param maxKeyNameComponents The number of elements in the allocated keyNameComponents array.
  */
 static inline void ndn_Data_initialize
@@ -91,7 +91,7 @@
 {
   ndn_Signature_initialize(&self->signature);
   ndn_Name_initialize(&self->name, nameComponents, maxNameComponents);
-  ndn_SignedInfo_initialize(&self->signedInfo, keyNameComponents, maxKeyNameComponents);
+  ndn_MetaInfo_initialize(&self->metaInfo, keyNameComponents, maxKeyNameComponents);
   self->content = 0;
   self->contentLength = 0;
 }
diff --git a/ndn-cpp/c/encoding/binary-xml-data.c b/ndn-cpp/c/encoding/binary-xml-data.c
index 31354d4..ebc9987 100644
--- a/ndn-cpp/c/encoding/binary-xml-data.c
+++ b/ndn-cpp/c/encoding/binary-xml-data.c
@@ -56,9 +56,9 @@
   return NDN_ERROR_success;
 }
 
-static ndn_Error encodeSignedInfo(struct ndn_SignedInfo *signedInfo, struct ndn_BinaryXmlEncoder *encoder)
+static ndn_Error encodeSignedInfo(struct ndn_MetaInfo *metaInfo, struct ndn_BinaryXmlEncoder *encoder)
 {
-  if (signedInfo->type < 0)
+  if (metaInfo->type < 0)
     return NDN_ERROR_success;
 
   ndn_Error error;
@@ -66,26 +66,26 @@
     return error;
 
   // This will skip encoding if there is no publisherPublicKeyDigest.
-  if ((error = ndn_encodeBinaryXmlPublisherPublicKeyDigest(&signedInfo->publisherPublicKeyDigest, encoder)))
+  if ((error = ndn_encodeBinaryXmlPublisherPublicKeyDigest(&metaInfo->publisherPublicKeyDigest, encoder)))
     return error;
   
   if ((error = ndn_BinaryXmlEncoder_writeOptionalTimeMillisecondsDTagElement
-      (encoder, ndn_BinaryXml_DTag_Timestamp, signedInfo->timestampMilliseconds)))
+      (encoder, ndn_BinaryXml_DTag_Timestamp, metaInfo->timestampMilliseconds)))
     return error;
   
-  if (!(signedInfo->type < 0 || signedInfo->type == ndn_ContentType_DATA)) {
+  if (!(metaInfo->type < 0 || metaInfo->type == ndn_ContentType_DATA)) {
     // Not the default of DATA, so we need to encode the type.
     unsigned char *typeBytes;
     unsigned int typeBytesLength = 3;
-    if (signedInfo->type == ndn_ContentType_ENCR)
+    if (metaInfo->type == ndn_ContentType_ENCR)
       typeBytes = "\x10\xD0\x91";
-    else if (signedInfo->type == ndn_ContentType_GONE)
+    else if (metaInfo->type == ndn_ContentType_GONE)
       typeBytes = "\x18\xE3\x44";
-    else if (signedInfo->type == ndn_ContentType_KEY)
+    else if (metaInfo->type == ndn_ContentType_KEY)
       typeBytes = "\x28\x46\x3F";
-    else if (signedInfo->type == ndn_ContentType_LINK)
+    else if (metaInfo->type == ndn_ContentType_LINK)
       typeBytes = "\x2C\x83\x4A";
-    else if (signedInfo->type == ndn_ContentType_NACK)
+    else if (metaInfo->type == ndn_ContentType_NACK)
       typeBytes = "\x34\x00\x8A";
     else
       return NDN_ERROR_unrecognized_ndn_ContentType;
@@ -96,15 +96,15 @@
   }
   
   if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
-      (encoder, ndn_BinaryXml_DTag_FreshnessSeconds, signedInfo->freshnessSeconds)))
+      (encoder, ndn_BinaryXml_DTag_FreshnessSeconds, metaInfo->freshnessSeconds)))
     return error;
   
   if ((error = ndn_BinaryXmlEncoder_writeOptionalBlobDTagElement
-      (encoder, ndn_BinaryXml_DTag_FinalBlockID, signedInfo->finalBlockID, signedInfo->finalBlockIDLength)))
+      (encoder, ndn_BinaryXml_DTag_FinalBlockID, metaInfo->finalBlockID, metaInfo->finalBlockIDLength)))
     return error;
  
   // This will skip encoding if there is no key locator.
-  if ((error = ndn_encodeBinaryXmlKeyLocator(&signedInfo->keyLocator, encoder)))
+  if ((error = ndn_encodeBinaryXmlKeyLocator(&metaInfo->keyLocator, encoder)))
     return error;
   
   if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
@@ -113,17 +113,17 @@
   return NDN_ERROR_success;  
 }
 
-static ndn_Error decodeSignedInfo(struct ndn_SignedInfo *signedInfo, struct ndn_BinaryXmlDecoder *decoder)
+static ndn_Error decodeSignedInfo(struct ndn_MetaInfo *metaInfo, struct ndn_BinaryXmlDecoder *decoder)
 {
   ndn_Error error;
   if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_SignedInfo)))
     return error;
   
-  if ((error = ndn_decodeOptionalBinaryXmlPublisherPublicKeyDigest(&signedInfo->publisherPublicKeyDigest, decoder)))
+  if ((error = ndn_decodeOptionalBinaryXmlPublisherPublicKeyDigest(&metaInfo->publisherPublicKeyDigest, decoder)))
     return error;
   
   if (error= ndn_BinaryXmlDecoder_readOptionalTimeMillisecondsDTagElement
-      (decoder, ndn_BinaryXml_DTag_Timestamp, &signedInfo->timestampMilliseconds))
+      (decoder, ndn_BinaryXml_DTag_Timestamp, &metaInfo->timestampMilliseconds))
     return error;
   
   unsigned char *typeBytes;
@@ -133,21 +133,21 @@
     return error;
   if (typeBytesLength == 0)
     // The default Type is DATA.
-    signedInfo->type = ndn_ContentType_DATA;
+    metaInfo->type = ndn_ContentType_DATA;
   else if (typeBytesLength == 3) {
     // All the recognized content types are 3 bytes.
     if (ndn_memcmp(typeBytes, "\x0C\x04\xC0", typeBytesLength) == 0)
-      signedInfo->type = ndn_ContentType_DATA;
+      metaInfo->type = ndn_ContentType_DATA;
     else if (ndn_memcmp(typeBytes, "\x10\xD0\x91", typeBytesLength) == 0)
-      signedInfo->type = ndn_ContentType_ENCR;
+      metaInfo->type = ndn_ContentType_ENCR;
     else if (ndn_memcmp(typeBytes, "\x18\xE3\x44", typeBytesLength) == 0)
-      signedInfo->type = ndn_ContentType_GONE;
+      metaInfo->type = ndn_ContentType_GONE;
     else if (ndn_memcmp(typeBytes, "\x28\x46\x3F", typeBytesLength) == 0)
-      signedInfo->type = ndn_ContentType_KEY;
+      metaInfo->type = ndn_ContentType_KEY;
     else if (ndn_memcmp(typeBytes, "\x2C\x83\x4A", typeBytesLength) == 0)
-      signedInfo->type = ndn_ContentType_LINK;
+      metaInfo->type = ndn_ContentType_LINK;
     else if (ndn_memcmp(typeBytes, "\x34\x00\x8A", typeBytesLength) == 0)
-      signedInfo->type = ndn_ContentType_NACK;
+      metaInfo->type = ndn_ContentType_NACK;
     else
       return NDN_ERROR_unrecognized_ndn_ContentType;
   }
@@ -155,14 +155,14 @@
     return NDN_ERROR_unrecognized_ndn_ContentType;
  
   if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
-      (decoder, ndn_BinaryXml_DTag_FreshnessSeconds, &signedInfo->freshnessSeconds)))
+      (decoder, ndn_BinaryXml_DTag_FreshnessSeconds, &metaInfo->freshnessSeconds)))
     return error;
 
   if ((error = ndn_BinaryXmlDecoder_readOptionalBinaryDTagElement
-      (decoder, ndn_BinaryXml_DTag_FinalBlockID, 0, &signedInfo->finalBlockID, &signedInfo->finalBlockIDLength)))
+      (decoder, ndn_BinaryXml_DTag_FinalBlockID, 0, &metaInfo->finalBlockID, &metaInfo->finalBlockIDLength)))
     return error;
 
-  if ((error = ndn_decodeOptionalBinaryXmlKeyLocator(&signedInfo->keyLocator, decoder)))
+  if ((error = ndn_decodeOptionalBinaryXmlKeyLocator(&metaInfo->keyLocator, decoder)))
     return error;
   
   if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder)))
@@ -186,7 +186,7 @@
   if ((error = ndn_encodeBinaryXmlName(&data->name, encoder)))
     return error;
   
-  if ((error = encodeSignedInfo(&data->signedInfo, encoder)))
+  if ((error = encodeSignedInfo(&data->metaInfo, encoder)))
     return error;
 
   if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement
@@ -226,11 +226,11 @@
   if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_SignedInfo, &gotExpectedTag)))
     return error;
   if (gotExpectedTag) {
-    if ((error = decodeSignedInfo(&data->signedInfo, decoder)))
+    if ((error = decodeSignedInfo(&data->metaInfo, decoder)))
       return error;
   }
   else
-    ndn_SignedInfo_initialize(&data->signedInfo, data->signedInfo.keyLocator.keyName.components, data->signedInfo.keyLocator.keyName.maxComponents);
+    ndn_MetaInfo_initialize(&data->metaInfo, data->metaInfo.keyLocator.keyName.components, data->metaInfo.keyLocator.keyName.maxComponents);
 
   // Require a Content element, but set allowNull to allow a missing BLOB.
   if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement
diff --git a/ndn-cpp/data.cpp b/ndn-cpp/data.cpp
index 1028795..fd41020 100644
--- a/ndn-cpp/data.cpp
+++ b/ndn-cpp/data.cpp
@@ -38,37 +38,37 @@
   setVector(signature_, signatureStruct.signature, signatureStruct.signatureLength);
 }
 
-void SignedInfo::get(struct ndn_SignedInfo& signedInfoStruct) const 
+void MetaInfo::get(struct ndn_MetaInfo& metaInfoStruct) const 
 {
-  publisherPublicKeyDigest_.get(signedInfoStruct.publisherPublicKeyDigest);
-  signedInfoStruct.timestampMilliseconds = timestampMilliseconds_;
-  signedInfoStruct.type = type_;
-  signedInfoStruct.freshnessSeconds = freshnessSeconds_;
+  publisherPublicKeyDigest_.get(metaInfoStruct.publisherPublicKeyDigest);
+  metaInfoStruct.timestampMilliseconds = timestampMilliseconds_;
+  metaInfoStruct.type = type_;
+  metaInfoStruct.freshnessSeconds = freshnessSeconds_;
   
-  signedInfoStruct.finalBlockIDLength = finalBlockID_.size();
+  metaInfoStruct.finalBlockIDLength = finalBlockID_.size();
   if (finalBlockID_.size() > 0)
-    signedInfoStruct.finalBlockID = (unsigned char *)&finalBlockID_[0];
+    metaInfoStruct.finalBlockID = (unsigned char *)&finalBlockID_[0];
   else
-    signedInfoStruct.finalBlockID = 0;
+    metaInfoStruct.finalBlockID = 0;
 
-  keyLocator_.get(signedInfoStruct.keyLocator);
+  keyLocator_.get(metaInfoStruct.keyLocator);
 }
 
-void SignedInfo::set(const struct ndn_SignedInfo& signedInfoStruct)
+void MetaInfo::set(const struct ndn_MetaInfo& metaInfoStruct)
 {
-  publisherPublicKeyDigest_.set(signedInfoStruct.publisherPublicKeyDigest);
-  timestampMilliseconds_ = signedInfoStruct.timestampMilliseconds;
-  type_ = signedInfoStruct.type;
-  freshnessSeconds_ = signedInfoStruct.freshnessSeconds;
-  setVector(finalBlockID_, signedInfoStruct.finalBlockID, signedInfoStruct.finalBlockIDLength);
-  keyLocator_.set(signedInfoStruct.keyLocator);
+  publisherPublicKeyDigest_.set(metaInfoStruct.publisherPublicKeyDigest);
+  timestampMilliseconds_ = metaInfoStruct.timestampMilliseconds;
+  type_ = metaInfoStruct.type;
+  freshnessSeconds_ = metaInfoStruct.freshnessSeconds;
+  setVector(finalBlockID_, metaInfoStruct.finalBlockID, metaInfoStruct.finalBlockIDLength);
+  keyLocator_.set(metaInfoStruct.keyLocator);
 }
 
 void Data::get(struct ndn_Data& dataStruct) const 
 {
   signature_.get(dataStruct.signature);
   name_.get(dataStruct.name);
-  signedInfo_.get(dataStruct.signedInfo);
+  metaInfo_.get(dataStruct.metaInfo);
   
   dataStruct.contentLength = content_.size();
   if (content_.size() > 0)
@@ -81,7 +81,7 @@
 {
   signature_.set(dataStruct.signature);
   name_.set(dataStruct.name);
-  signedInfo_.set(dataStruct.signedInfo);
+  metaInfo_.set(dataStruct.metaInfo);
   setVector(content_, dataStruct.content, dataStruct.contentLength);
 }
 
diff --git a/ndn-cpp/data.hpp b/ndn-cpp/data.hpp
index 620da8c..2bcc6aa 100644
--- a/ndn-cpp/data.hpp
+++ b/ndn-cpp/data.hpp
@@ -72,26 +72,26 @@
   std::vector<unsigned char> signature_;
 };
 
-class SignedInfo {
+class MetaInfo {
 public:
-  SignedInfo() 
+  MetaInfo() 
   {   
     type_ = ndn_ContentType_DATA;
     freshnessSeconds_ = -1;
   }
 
   /**
-   * Set the signedInfoStruct to point to the values in this signed info object, without copying any memory.
-   * WARNING: The resulting pointers in signedInfoStruct are invalid after a further use of this object which could reallocate memory.
-   * @param signedInfoStruct a C ndn_SignedInfo struct where the name components array is already allocated.
+   * Set the metaInfoStruct to point to the values in this meta info object, without copying any memory.
+   * WARNING: The resulting pointers in metaInfoStruct are invalid after a further use of this object which could reallocate memory.
+   * @param metaInfoStruct a C ndn_MetaInfo struct where the name components array is already allocated.
    */
-  void get(struct ndn_SignedInfo& signedInfoStruct) const;
+  void get(struct ndn_MetaInfo& metaInfoStruct) const;
 
   /**
-   * Clear this signed info, and set the values by copying from the ndn_SignedInfo struct.
-   * @param signedInfoStruct a C ndn_SignedInfo struct
+   * Clear this meta info, and set the values by copying from the ndn_MetaInfo struct.
+   * @param metaInfoStruct a C ndn_MetaInfo struct
    */
-  void set(const struct ndn_SignedInfo& signedInfoStruct);
+  void set(const struct ndn_MetaInfo& metaInfoStruct);
 
   const PublisherPublicKeyDigest& getPublisherPublicKeyDigest() const { return publisherPublicKeyDigest_; }
   PublisherPublicKeyDigest& getPublisherPublicKeyDigest() { return publisherPublicKeyDigest_; }
@@ -188,8 +188,8 @@
   const Name& getName() const { return name_; }
   Name& getName() { return name_; }
   
-  const SignedInfo& getSignedInfo() const { return signedInfo_; }
-  SignedInfo& getSignedInfo() { return signedInfo_; }
+  const MetaInfo& getMetaInfo() const { return metaInfo_; }
+  MetaInfo& getMetaInfo() { return metaInfo_; }
   
   const std::vector<unsigned char>& getContent() const { return content_; }
   std::vector<unsigned char>& getContent() { return content_; }
@@ -198,7 +198,7 @@
   
   void setName(const Name& name) { name_ = name; }
   
-  void setSignedInfo(const SignedInfo& signedInfo) { signedInfo_ = signedInfo; }
+  void setMetainfo(const MetaInfo& metaInfo) { metaInfo_ = metaInfo; }
 
   void setContent(const std::vector<unsigned char>& content) { content_ = content; }
   void setContent(const unsigned char *content, unsigned int contentLength) 
@@ -209,7 +209,7 @@
 private:
   Signature signature_;
   Name name_;
-  SignedInfo signedInfo_;
+  MetaInfo metaInfo_;
   std::vector<unsigned char> content_;
 };
   
diff --git a/ndn-cpp/node.cpp b/ndn-cpp/node.cpp
index 1107a11..1015bc3 100644
--- a/ndn-cpp/node.cpp
+++ b/ndn-cpp/node.cpp
@@ -55,10 +55,10 @@
 
 void Node::NdndIdFetcher::operator()(const ptr_lib::shared_ptr<const Interest>& interest, const ptr_lib::shared_ptr<Data>& ndndIdData)
 {
-  if (ndndIdData->getSignedInfo().getPublisherPublicKeyDigest().getPublisherPublicKeyDigest().size() > 0) {
+  if (ndndIdData->getMetaInfo().getPublisherPublicKeyDigest().getPublisherPublicKeyDigest().size() > 0) {
     // Set the ndndId_ and continue.
     // TODO: If there are multiple connected hubs, the NDN ID is really stored per connected hub.
-    info_->node_.ndndId_ = ndndIdData->getSignedInfo().getPublisherPublicKeyDigest().getPublisherPublicKeyDigest();
+    info_->node_.ndndId_ = ndndIdData->getMetaInfo().getPublisherPublicKeyDigest().getPublisherPublicKeyDigest();
     info_->node_.registerPrefixHelper(info_->prefix_, info_->onInterest_, info_->flags_);
   }
   // TODO: else need to log not getting the ndndId.
@@ -78,7 +78,7 @@
   // Set the ForwardingEntry as the content of a Data packet and sign.
   Data data;
   data.setContent(*content);
-  data.getSignedInfo().setTimestampMilliseconds(time(NULL) * 1000.0);
+  data.getMetaInfo().setTimestampMilliseconds(time(NULL) * 1000.0);
   // TODO: Should we sign with a different key?
   KeyChain::defaultSign(data);
   ptr_lib::shared_ptr<vector<unsigned char> > encodedData = data.wireEncode();
diff --git a/ndn-cpp/security/key-chain.cpp b/ndn-cpp/security/key-chain.cpp
index 9ba15f0..6a44aa1 100644
--- a/ndn-cpp/security/key-chain.cpp
+++ b/ndn-cpp/security/key-chain.cpp
@@ -90,9 +90,9 @@
    const unsigned char *privateKeyDer, unsigned int privateKeyDerLength, WireFormat& wireFormat)
 {
   // Set the public key.
-  setSha256(publicKeyDer, publicKeyDerLength, data.getSignedInfo().getPublisherPublicKeyDigest().getPublisherPublicKeyDigest());
-  data.getSignedInfo().getKeyLocator().setType(ndn_KeyLocatorType_KEY);
-  data.getSignedInfo().getKeyLocator().setKeyData(publicKeyDer, publicKeyDerLength);
+  setSha256(publicKeyDer, publicKeyDerLength, data.getMetaInfo().getPublisherPublicKeyDigest().getPublisherPublicKeyDigest());
+  data.getMetaInfo().getKeyLocator().setType(ndn_KeyLocatorType_KEY);
+  data.getMetaInfo().getKeyLocator().setKeyData(publicKeyDer, publicKeyDerLength);
   // Clear the signature so we don't encode it below.
   data.getSignature().clear();
 
@@ -142,9 +142,9 @@
   // Find the public key.
   const unsigned char *publicKeyDer;
   unsigned int publicKeyDerLength;
-  if (data.getSignedInfo().getKeyLocator().getType() == ndn_KeyLocatorType_KEY) {
-    publicKeyDer = &data.getSignedInfo().getKeyLocator().getKeyData().front();
-    publicKeyDerLength = data.getSignedInfo().getKeyLocator().getKeyData().size();
+  if (data.getMetaInfo().getKeyLocator().getType() == ndn_KeyLocatorType_KEY) {
+    publicKeyDer = &data.getMetaInfo().getKeyLocator().getKeyData().front();
+    publicKeyDerLength = data.getMetaInfo().getKeyLocator().getKeyData().size();
   }
   else
     // Can't find a public key.
diff --git a/ndn-cpp/security/key-chain.hpp b/ndn-cpp/security/key-chain.hpp
index 0d3873e..584ddc4 100644
--- a/ndn-cpp/security/key-chain.hpp
+++ b/ndn-cpp/security/key-chain.hpp
@@ -13,10 +13,10 @@
 class KeyChain {
 public:
   /**
-   * In data, set the signed info publisher public key digest and key locator key to the public key and set the 
+   * In data, set the meta info publisher public key digest and key locator key to the public key and set the 
    * signature using the private key.
    * Note: the caller must make sure the timestamp is correct, for example with 
-   * data.getSignedInfo().setTimestampMilliseconds(time(NULL) * 1000.0).
+   * data.getMetaInfo().setTimestampMilliseconds(time(NULL) * 1000.0).
    * @param data The Data object to sign and set the key and signature.
    * @param publicKeyDer A pointer to a buffer with the DER-encoded public key.
    * @param publicKeyDerLength The number of bytes in publicKeyDer.
diff --git a/tests/test-encode-decode-data.cpp b/tests/test-encode-decode-data.cpp
index d550a16..cf9a352 100644
--- a/tests/test-encode-decode-data.cpp
+++ b/tests/test-encode-decode-data.cpp
@@ -71,6 +71,72 @@
   }
   else
     cout << "content: <empty>" << endl;
+  
+  cout << "metaInfo.publisherPublicKeyDigest: "
+       << (data.getMetaInfo().getPublisherPublicKeyDigest().getPublisherPublicKeyDigest().size() > 0 ? 
+           toHex(data.getMetaInfo().getPublisherPublicKeyDigest().getPublisherPublicKeyDigest()).c_str() : "<none>") << endl;
+  cout << "metaInfo.timestamp: ";
+  if (data.getMetaInfo().getTimestampMilliseconds() >= 0) {
+    time_t seconds = data.getMetaInfo().getTimestampMilliseconds() / 1000.0;
+    cout << data.getMetaInfo().getTimestampMilliseconds() << " milliseconds, UTC time: " << asctime(gmtime(&seconds));
+  }
+  else
+    cout << "<none>" << endl;
+  if (!(data.getMetaInfo().getType() < 0 || data.getMetaInfo().getType() == ndn_ContentType_DATA)) {
+    cout << "metaInfo.type: ";
+    if (data.getMetaInfo().getType() == ndn_ContentType_ENCR)
+      cout << "ENCR" << endl;
+    else if (data.getMetaInfo().getType() == ndn_ContentType_GONE)
+      cout << "GONE" << endl;
+    else if (data.getMetaInfo().getType() == ndn_ContentType_KEY)
+      cout << "KEY" << endl;
+    else if (data.getMetaInfo().getType() == ndn_ContentType_LINK)
+      cout << "LINK" << endl;
+    else if (data.getMetaInfo().getType() == ndn_ContentType_NACK)
+      cout << "NACK" << endl;
+  }
+  cout << "metaInfo.freshnessSeconds: ";
+  if (data.getMetaInfo().getFreshnessSeconds() >= 0)
+    cout << data.getMetaInfo().getFreshnessSeconds() << endl;
+  else
+    cout << "<none>" << endl;
+  cout << "metaInfo.finalBlockID: "
+       << (data.getMetaInfo().getFinalBlockID().size() > 0 ? 
+           toHex(data.getMetaInfo().getFinalBlockID()).c_str() : "<none>") << endl;
+  cout << "metaInfo.keyLocator: ";
+  if ((int)data.getMetaInfo().getKeyLocator().getType() >= 0) {
+    if (data.getMetaInfo().getKeyLocator().getType() == ndn_KeyLocatorType_KEY)
+      cout << "Key: " << toHex(data.getMetaInfo().getKeyLocator().getKeyData()) << endl;
+    else if (data.getMetaInfo().getKeyLocator().getType() == ndn_KeyLocatorType_CERTIFICATE)
+      cout << "Certificate: " << toHex(data.getMetaInfo().getKeyLocator().getKeyData()) << endl;
+    else if (data.getMetaInfo().getKeyLocator().getType() == ndn_KeyLocatorType_KEYNAME) {
+      cout << "KeyName: " << data.getMetaInfo().getKeyLocator().getKeyName().to_uri() << endl;
+      cout << "metaInfo.keyLocator: ";
+      if ((int)data.getMetaInfo().getKeyLocator().getKeyNameType() >= 0) {
+        bool showKeyNameData = true;
+        if (data.getMetaInfo().getKeyLocator().getKeyNameType() == ndn_KeyNameType_PUBLISHER_PUBLIC_KEY_DIGEST)
+          cout << "PublisherPublicKeyDigest: ";
+        else if (data.getMetaInfo().getKeyLocator().getKeyNameType() == ndn_KeyNameType_PUBLISHER_CERTIFICATE_DIGEST)
+          cout << "PublisherCertificateDigest: ";
+        else if (data.getMetaInfo().getKeyLocator().getKeyNameType() == ndn_KeyNameType_PUBLISHER_ISSUER_KEY_DIGEST)
+          cout << "PublisherIssuerKeyDigest: ";
+        else if (data.getMetaInfo().getKeyLocator().getKeyNameType() == ndn_KeyNameType_PUBLISHER_ISSUER_CERTIFICATE_DIGEST)
+          cout << "PublisherIssuerCertificateDigest: ";
+        else {
+          cout << "<unrecognized ndn_KeyNameType " << data.getMetaInfo().getKeyLocator().getKeyNameType() << ">" << endl;
+          showKeyNameData = false;
+        }
+        if (showKeyNameData)
+          cout << toHex(data.getMetaInfo().getKeyLocator().getKeyData()) << endl;
+      }
+      else
+        cout << "<no key digest>" << endl;
+    }
+    else
+      cout << "<unrecognized ndn_KeyLocatorType " << data.getMetaInfo().getKeyLocator().getType() << ">" << endl;
+  }
+  else
+    cout << "<none>" << endl;
     
   cout << "signature.digestAlgorithm: "
        << (data.getSignature().getDigestAlgorithm().size() > 0 ? toHex(data.getSignature().getDigestAlgorithm()).c_str() : "default (sha-256)") << endl;
@@ -78,72 +144,6 @@
        << (data.getSignature().getWitness().size() > 0 ? toHex(data.getSignature().getWitness()).c_str() : "<none>") << endl;
   cout << "signature.signature: "
        << (data.getSignature().getSignature().size() > 0 ? toHex(data.getSignature().getSignature()).c_str() : "<none>") << endl;
-  
-  cout << "signedInfo.publisherPublicKeyDigest: "
-       << (data.getSignedInfo().getPublisherPublicKeyDigest().getPublisherPublicKeyDigest().size() > 0 ? 
-           toHex(data.getSignedInfo().getPublisherPublicKeyDigest().getPublisherPublicKeyDigest()).c_str() : "<none>") << endl;
-  cout << "signedInfo.timestamp: ";
-  if (data.getSignedInfo().getTimestampMilliseconds() >= 0) {
-    time_t seconds = data.getSignedInfo().getTimestampMilliseconds() / 1000.0;
-    cout << data.getSignedInfo().getTimestampMilliseconds() << " milliseconds, UTC time: " << asctime(gmtime(&seconds));
-  }
-  else
-    cout << "<none>" << endl;
-  if (!(data.getSignedInfo().getType() < 0 || data.getSignedInfo().getType() == ndn_ContentType_DATA)) {
-    cout << "signedInfo.type: ";
-    if (data.getSignedInfo().getType() == ndn_ContentType_ENCR)
-      cout << "ENCR" << endl;
-    else if (data.getSignedInfo().getType() == ndn_ContentType_GONE)
-      cout << "GONE" << endl;
-    else if (data.getSignedInfo().getType() == ndn_ContentType_KEY)
-      cout << "KEY" << endl;
-    else if (data.getSignedInfo().getType() == ndn_ContentType_LINK)
-      cout << "LINK" << endl;
-    else if (data.getSignedInfo().getType() == ndn_ContentType_NACK)
-      cout << "NACK" << endl;
-  }
-  cout << "signedInfo.freshnessSeconds: ";
-  if (data.getSignedInfo().getFreshnessSeconds() >= 0)
-    cout << data.getSignedInfo().getFreshnessSeconds() << endl;
-  else
-    cout << "<none>" << endl;
-  cout << "signedInfo.finalBlockID: "
-       << (data.getSignedInfo().getFinalBlockID().size() > 0 ? 
-           toHex(data.getSignedInfo().getFinalBlockID()).c_str() : "<none>") << endl;
-  cout << "signedInfo.keyLocator: ";
-  if ((int)data.getSignedInfo().getKeyLocator().getType() >= 0) {
-    if (data.getSignedInfo().getKeyLocator().getType() == ndn_KeyLocatorType_KEY)
-      cout << "Key: " << toHex(data.getSignedInfo().getKeyLocator().getKeyData()) << endl;
-    else if (data.getSignedInfo().getKeyLocator().getType() == ndn_KeyLocatorType_CERTIFICATE)
-      cout << "Certificate: " << toHex(data.getSignedInfo().getKeyLocator().getKeyData()) << endl;
-    else if (data.getSignedInfo().getKeyLocator().getType() == ndn_KeyLocatorType_KEYNAME) {
-      cout << "KeyName: " << data.getSignedInfo().getKeyLocator().getKeyName().to_uri() << endl;
-      cout << "signedInfo.keyLocator: ";
-      if ((int)data.getSignedInfo().getKeyLocator().getKeyNameType() >= 0) {
-        bool showKeyNameData = true;
-        if (data.getSignedInfo().getKeyLocator().getKeyNameType() == ndn_KeyNameType_PUBLISHER_PUBLIC_KEY_DIGEST)
-          cout << "PublisherPublicKeyDigest: ";
-        else if (data.getSignedInfo().getKeyLocator().getKeyNameType() == ndn_KeyNameType_PUBLISHER_CERTIFICATE_DIGEST)
-          cout << "PublisherCertificateDigest: ";
-        else if (data.getSignedInfo().getKeyLocator().getKeyNameType() == ndn_KeyNameType_PUBLISHER_ISSUER_KEY_DIGEST)
-          cout << "PublisherIssuerKeyDigest: ";
-        else if (data.getSignedInfo().getKeyLocator().getKeyNameType() == ndn_KeyNameType_PUBLISHER_ISSUER_CERTIFICATE_DIGEST)
-          cout << "PublisherIssuerCertificateDigest: ";
-        else {
-          cout << "<unrecognized ndn_KeyNameType " << data.getSignedInfo().getKeyLocator().getKeyNameType() << ">" << endl;
-          showKeyNameData = false;
-        }
-        if (showKeyNameData)
-          cout << toHex(data.getSignedInfo().getKeyLocator().getKeyData()) << endl;
-      }
-      else
-        cout << "<no key digest>" << endl;
-    }
-    else
-      cout << "<unrecognized ndn_KeyLocatorType " << data.getSignedInfo().getKeyLocator().getType() << ">" << endl;
-  }
-  else
-    cout << "<none>" << endl;
 }
 
 int main(int argc, char** argv)
@@ -166,7 +166,7 @@
     Data freshData(Name("/ndn/abc"));
     const unsigned char freshContent[] = "SUCCESS!";
     freshData.setContent(freshContent, sizeof(freshContent) - 1);
-    freshData.getSignedInfo().setTimestampMilliseconds(time(NULL) * 1000.0);
+    freshData.getMetaInfo().setTimestampMilliseconds(time(NULL) * 1000.0);
     
     KeyChain::defaultSign(freshData);
     cout << endl << "Freshly-signed Data:" << endl;
