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
