diff --git a/ndn-cpp/c/data.h b/ndn-cpp/c/data.h
index 0226919..0990d86 100644
--- a/ndn-cpp/c/data.h
+++ b/ndn-cpp/c/data.h
@@ -14,6 +14,9 @@
 extern "C" {
 #endif
 
+/**
+ * An ndn_Signature struct holds the signature bits and other info representing the signature in a data packet.
+ */
 struct ndn_Signature {
   unsigned char *digestAlgorithm;      /**< pointer to pre-allocated buffer.  0 for none.
                                         *   If none, default is 2.16.840.1.101.3.4.2.1 (sha-256). */
@@ -22,15 +25,25 @@
   unsigned int witnessLength;          /**< length of witness.  0 for none */
   unsigned char *signature;
   unsigned int signatureLength;
+  struct ndn_PublisherPublicKeyDigest publisherPublicKeyDigest;
+  struct ndn_KeyLocator keyLocator;
 };
 
-static inline void ndn_Signature_initialize(struct ndn_Signature *self) {
+/**
+ * Initialize the ndn_Signature struct with values for none and the default digestAlgorithm.
+ * @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_Signature_initialize(struct ndn_Signature *self, struct ndn_NameComponent *keyNameComponents, unsigned int maxKeyNameComponents) {
   self->digestAlgorithm = 0;
   self->digestAlgorithmLength = 0;
   self->witness = 0;
   self->witnessLength = 0;
   self->signature = 0;
   self->signatureLength = 0;
+  ndn_PublisherPublicKeyDigest_initialize(&self->publisherPublicKeyDigest);
+  ndn_KeyLocator_initialize(&self->keyLocator, keyNameComponents, maxKeyNameComponents);
 }
 
 typedef enum {
@@ -42,30 +55,27 @@
   ndn_ContentType_NACK = 5
 } ndn_ContentType;
 
+/**
+ * An ndn_MetaInfo struct holds the meta info which is signed inside the data packet.
+ */
 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 */
   int freshnessSeconds;            /**< -1 for none */
   unsigned char *finalBlockID;     /**< pointer to pre-allocated buffer.  0 for none */
   unsigned int finalBlockIDLength; /**< length of finalBlockID.  0 for none */
-  struct ndn_KeyLocator keyLocator;
 };
 
 /**
  * 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_MetaInfo_initialize
-  (struct ndn_MetaInfo *self, struct ndn_NameComponent *keyNameComponents, unsigned int maxKeyNameComponents) {
-  ndn_PublisherPublicKeyDigest_initialize(&self->publisherPublicKeyDigest);
+  (struct ndn_MetaInfo *self) {
   self->type = ndn_ContentType_DATA;
   self->freshnessSeconds = -1;
   self->finalBlockID = 0;
   self->finalBlockIDLength = 0;
-  ndn_KeyLocator_initialize(&self->keyLocator, keyNameComponents, maxKeyNameComponents);
 }
 
 struct ndn_Data {
@@ -82,16 +92,16 @@
  * @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 metaInfo.keyLocator.
+ * @param keyNameComponents The pre-allocated array of ndn_NameComponent for the signature.keyLocator.
  * @param maxKeyNameComponents The number of elements in the allocated keyNameComponents array.
  */
 static inline void ndn_Data_initialize
   (struct ndn_Data *self, struct ndn_NameComponent *nameComponents, unsigned int maxNameComponents, 
    struct ndn_NameComponent *keyNameComponents, unsigned int maxKeyNameComponents) 
 {
-  ndn_Signature_initialize(&self->signature);
+  ndn_Signature_initialize(&self->signature, keyNameComponents, maxKeyNameComponents);
   ndn_Name_initialize(&self->name, nameComponents, maxNameComponents);
-  ndn_MetaInfo_initialize(&self->metaInfo, keyNameComponents, maxKeyNameComponents);
+  ndn_MetaInfo_initialize(&self->metaInfo);
   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 ebc9987..b07b7a4 100644
--- a/ndn-cpp/c/encoding/binary-xml-data.c
+++ b/ndn-cpp/c/encoding/binary-xml-data.c
@@ -56,7 +56,7 @@
   return NDN_ERROR_success;
 }
 
-static ndn_Error encodeSignedInfo(struct ndn_MetaInfo *metaInfo, struct ndn_BinaryXmlEncoder *encoder)
+static ndn_Error encodeSignedInfo(struct ndn_Signature *signature, struct ndn_MetaInfo *metaInfo, struct ndn_BinaryXmlEncoder *encoder)
 {
   if (metaInfo->type < 0)
     return NDN_ERROR_success;
@@ -66,7 +66,7 @@
     return error;
 
   // This will skip encoding if there is no publisherPublicKeyDigest.
-  if ((error = ndn_encodeBinaryXmlPublisherPublicKeyDigest(&metaInfo->publisherPublicKeyDigest, encoder)))
+  if ((error = ndn_encodeBinaryXmlPublisherPublicKeyDigest(&signature->publisherPublicKeyDigest, encoder)))
     return error;
   
   if ((error = ndn_BinaryXmlEncoder_writeOptionalTimeMillisecondsDTagElement
@@ -104,7 +104,7 @@
     return error;
  
   // This will skip encoding if there is no key locator.
-  if ((error = ndn_encodeBinaryXmlKeyLocator(&metaInfo->keyLocator, encoder)))
+  if ((error = ndn_encodeBinaryXmlKeyLocator(&signature->keyLocator, encoder)))
     return error;
   
   if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
@@ -113,13 +113,13 @@
   return NDN_ERROR_success;  
 }
 
-static ndn_Error decodeSignedInfo(struct ndn_MetaInfo *metaInfo, struct ndn_BinaryXmlDecoder *decoder)
+static ndn_Error decodeSignedInfo(struct ndn_Signature *signature, 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(&metaInfo->publisherPublicKeyDigest, decoder)))
+  if ((error = ndn_decodeOptionalBinaryXmlPublisherPublicKeyDigest(&signature->publisherPublicKeyDigest, decoder)))
     return error;
   
   if (error= ndn_BinaryXmlDecoder_readOptionalTimeMillisecondsDTagElement
@@ -162,7 +162,7 @@
       (decoder, ndn_BinaryXml_DTag_FinalBlockID, 0, &metaInfo->finalBlockID, &metaInfo->finalBlockIDLength)))
     return error;
 
-  if ((error = ndn_decodeOptionalBinaryXmlKeyLocator(&metaInfo->keyLocator, decoder)))
+  if ((error = ndn_decodeOptionalBinaryXmlKeyLocator(&signature->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->metaInfo, encoder)))
+  if ((error = encodeSignedInfo(&data->signature, &data->metaInfo, encoder)))
     return error;
 
   if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement
@@ -216,7 +216,7 @@
       return error;
   }
   else
-    ndn_Signature_initialize(&data->signature);
+    ndn_Signature_initialize(&data->signature, data->signature.keyLocator.keyName.components, data->signature.keyLocator.keyName.maxComponents);
   
   *signedFieldsBeginOffset = decoder->offset;
   
@@ -226,11 +226,11 @@
   if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_SignedInfo, &gotExpectedTag)))
     return error;
   if (gotExpectedTag) {
-    if ((error = decodeSignedInfo(&data->metaInfo, decoder)))
+    if ((error = decodeSignedInfo(&data->signature, &data->metaInfo, decoder)))
       return error;
   }
   else
-    ndn_MetaInfo_initialize(&data->metaInfo, data->metaInfo.keyLocator.keyName.components, data->metaInfo.keyLocator.keyName.maxComponents);
+    ndn_MetaInfo_initialize(&data->metaInfo);
 
   // 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 fd41020..68b4779 100644
--- a/ndn-cpp/data.cpp
+++ b/ndn-cpp/data.cpp
@@ -29,6 +29,9 @@
     signatureStruct.signature = (unsigned char *)&signature_[0];
   else
     signatureStruct.signature = 0;
+  
+  publisherPublicKeyDigest_.get(signatureStruct.publisherPublicKeyDigest);
+  keyLocator_.get(signatureStruct.keyLocator);
 }
 
 void Signature::set(const struct ndn_Signature& signatureStruct)
@@ -36,11 +39,12 @@
   setVector(digestAlgorithm_, signatureStruct.digestAlgorithm, signatureStruct.digestAlgorithmLength);
   setVector(witness_, signatureStruct.witness, signatureStruct.witnessLength);
   setVector(signature_, signatureStruct.signature, signatureStruct.signatureLength);
+  publisherPublicKeyDigest_.set(signatureStruct.publisherPublicKeyDigest);
+  keyLocator_.set(signatureStruct.keyLocator);
 }
 
 void MetaInfo::get(struct ndn_MetaInfo& metaInfoStruct) const 
 {
-  publisherPublicKeyDigest_.get(metaInfoStruct.publisherPublicKeyDigest);
   metaInfoStruct.timestampMilliseconds = timestampMilliseconds_;
   metaInfoStruct.type = type_;
   metaInfoStruct.freshnessSeconds = freshnessSeconds_;
@@ -50,18 +54,14 @@
     metaInfoStruct.finalBlockID = (unsigned char *)&finalBlockID_[0];
   else
     metaInfoStruct.finalBlockID = 0;
-
-  keyLocator_.get(metaInfoStruct.keyLocator);
 }
 
 void MetaInfo::set(const struct ndn_MetaInfo& metaInfoStruct)
 {
-  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 
diff --git a/ndn-cpp/data.hpp b/ndn-cpp/data.hpp
index 2bcc6aa..5d67f0f 100644
--- a/ndn-cpp/data.hpp
+++ b/ndn-cpp/data.hpp
@@ -14,6 +14,9 @@
 
 namespace ndn {
 
+/**
+ * A Signature holds the signature bits and other info representing the signature in a data packet.
+ */
 class Signature {
 public:
   /**
@@ -37,6 +40,12 @@
 
   const std::vector<unsigned char>& getSignature() const { return signature_; }
   std::vector<unsigned char>& getSignature() { return signature_; }
+  
+  const PublisherPublicKeyDigest& getPublisherPublicKeyDigest() const { return publisherPublicKeyDigest_; }
+  PublisherPublicKeyDigest& getPublisherPublicKeyDigest() { return publisherPublicKeyDigest_; }
+  
+  const KeyLocator& getKeyLocator() const { return keyLocator_; }
+  KeyLocator& getKeyLocator() { return keyLocator_; }
 
   void setDigestAlgorithm(const std::vector<unsigned char>& digestAlgorithm) { digestAlgorithm_ = digestAlgorithm; }
   void setDigestAlgorithm(const unsigned char *digestAlgorithm, unsigned int digestAlgorithmLength) 
@@ -55,23 +64,34 @@
   { 
     setVector(signature_, signature, signatureLength); 
   }
+
+  void setPublisherPublicKeyDigest(const PublisherPublicKeyDigest& publisherPublicKeyDigest) { publisherPublicKeyDigest_ = publisherPublicKeyDigest; }
+  
+  void setKeyLocator(const KeyLocator& keyLocator) { keyLocator_ = keyLocator; }
   
   /**
-   * Clear the digest algorithm, witness and signature fields.
+   * Clear all the fields.
    */
   void clear()
   {
     digestAlgorithm_.clear();
     witness_.clear();
     signature_.clear();
+    publisherPublicKeyDigest_.clear();
+    keyLocator_.clear();
   }
 
 private:
   std::vector<unsigned char> digestAlgorithm_; /**< if empty, the default is 2.16.840.1.101.3.4.2.1 (sha-256) */
   std::vector<unsigned char> witness_;
   std::vector<unsigned char> signature_;
+  PublisherPublicKeyDigest publisherPublicKeyDigest_;
+  KeyLocator keyLocator_;
 };
 
+/**
+ * An MetaInfo holds the meta info which is signed inside the data packet.
+ */
 class MetaInfo {
 public:
   MetaInfo() 
@@ -93,9 +113,6 @@
    */
   void set(const struct ndn_MetaInfo& metaInfoStruct);
 
-  const PublisherPublicKeyDigest& getPublisherPublicKeyDigest() const { return publisherPublicKeyDigest_; }
-  PublisherPublicKeyDigest& getPublisherPublicKeyDigest() { return publisherPublicKeyDigest_; }
-  
   double getTimestampMilliseconds() const { return timestampMilliseconds_; }
   
   ndn_ContentType getType() const { return type_; }
@@ -105,11 +122,6 @@
   const std::vector<unsigned char>& getFinalBlockID() const { return finalBlockID_; }
   std::vector<unsigned char>& getFinalBlockID() { return finalBlockID_; }
   
-  const KeyLocator& getKeyLocator() const { return keyLocator_; }
-  KeyLocator& getKeyLocator() { return keyLocator_; }
-
-  void setPublisherPublicKeyDigest(const PublisherPublicKeyDigest& publisherPublicKeyDigest) { publisherPublicKeyDigest_ = publisherPublicKeyDigest; }
-  
   void setTimestampMilliseconds(double timestampMilliseconds) { timestampMilliseconds_ = timestampMilliseconds; }
   
   void setType(ndn_ContentType type) { type_ = type; }
@@ -122,15 +134,11 @@
     setVector(finalBlockID_, finalBlockID, finalBlockIdLength); 
   }
   
-  void setKeyLocator(const KeyLocator& keyLocator) { keyLocator_ = keyLocator; }
-  
 private:
-  PublisherPublicKeyDigest publisherPublicKeyDigest_;
   double timestampMilliseconds_; /**< milliseconds since 1/1/1970. -1 for none */
   ndn_ContentType type_;         /**< default is ndn_ContentType_DATA. -1 for none */
   int freshnessSeconds_;         /**< -1 for none */
   std::vector<unsigned char> finalBlockID_; /** size 0 for none */
-  KeyLocator keyLocator_;
 };
   
 class Data {
diff --git a/ndn-cpp/key.hpp b/ndn-cpp/key.hpp
index a3784f6..6cf449e 100644
--- a/ndn-cpp/key.hpp
+++ b/ndn-cpp/key.hpp
@@ -20,6 +20,16 @@
   }
   
   /**
+   * Clear the keyData and set the type to none.
+   */
+  void clear()
+  {
+    type_ = (ndn_KeyLocatorType)-1;
+    keyNameType_ = (ndn_KeyNameType)-1;
+    keyData_.clear();
+  }
+  
+  /**
    * Set the keyLocatorStruct to point to the values in this key locator, without copying any memory.
    * WARNING: The resulting pointers in keyLocatorStruct are invalid after a further use of this object which could reallocate memory.
    * @param keyLocatorStruct a C ndn_KeyLocator struct where the name components array is already allocated.
diff --git a/ndn-cpp/node.cpp b/ndn-cpp/node.cpp
index 1015bc3..7fb34fd 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->getMetaInfo().getPublisherPublicKeyDigest().getPublisherPublicKeyDigest().size() > 0) {
+  if (ndndIdData->getSignature().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->getMetaInfo().getPublisherPublicKeyDigest().getPublisherPublicKeyDigest();
+    info_->node_.ndndId_ = ndndIdData->getSignature().getPublisherPublicKeyDigest().getPublisherPublicKeyDigest();
     info_->node_.registerPrefixHelper(info_->prefix_, info_->onInterest_, info_->flags_);
   }
   // TODO: else need to log not getting the ndndId.
diff --git a/ndn-cpp/publisher-public-key-digest.hpp b/ndn-cpp/publisher-public-key-digest.hpp
index 3b8dd56..0a5a2c5 100644
--- a/ndn-cpp/publisher-public-key-digest.hpp
+++ b/ndn-cpp/publisher-public-key-digest.hpp
@@ -53,6 +53,14 @@
   { 
     setVector(publisherPublicKeyDigest_, publisherPublicKeyDigest, publisherPublicKeyDigestLength); 
   }
+  
+  /**
+   * Clear the publisherPublicKeyDigest.
+   */
+  void clear()
+  {
+    publisherPublicKeyDigest_.clear();
+  }
 
 private:
   std::vector<unsigned char> publisherPublicKeyDigest_;
diff --git a/ndn-cpp/security/key-chain.cpp b/ndn-cpp/security/key-chain.cpp
index 6a44aa1..a9248df 100644
--- a/ndn-cpp/security/key-chain.cpp
+++ b/ndn-cpp/security/key-chain.cpp
@@ -89,12 +89,12 @@
   (Data& data, const unsigned char *publicKeyDer, unsigned int publicKeyDerLength, 
    const unsigned char *privateKeyDer, unsigned int privateKeyDerLength, WireFormat& wireFormat)
 {
-  // Set the public key.
-  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();
+  // Set the public key.
+  setSha256(publicKeyDer, publicKeyDerLength, data.getSignature().getPublisherPublicKeyDigest().getPublisherPublicKeyDigest());
+  data.getSignature().getKeyLocator().setType(ndn_KeyLocatorType_KEY);
+  data.getSignature().getKeyLocator().setKeyData(publicKeyDer, publicKeyDerLength);
 
   // Sign the fields.
   unsigned char dataFieldsDigest[SHA256_DIGEST_LENGTH];
@@ -142,9 +142,9 @@
   // Find the public key.
   const unsigned char *publicKeyDer;
   unsigned int publicKeyDerLength;
-  if (data.getMetaInfo().getKeyLocator().getType() == ndn_KeyLocatorType_KEY) {
-    publicKeyDer = &data.getMetaInfo().getKeyLocator().getKeyData().front();
-    publicKeyDerLength = data.getMetaInfo().getKeyLocator().getKeyData().size();
+  if (data.getSignature().getKeyLocator().getType() == ndn_KeyLocatorType_KEY) {
+    publicKeyDer = &data.getSignature().getKeyLocator().getKeyData().front();
+    publicKeyDerLength = data.getSignature().getKeyLocator().getKeyData().size();
   }
   else
     // Can't find a public key.
