Added separate PublishPublicKeyDigest and use in Interest.
diff --git a/ndn-cpp/c/Interest.h b/ndn-cpp/c/Interest.h
index 81d9bce..76af56d 100644
--- a/ndn-cpp/c/Interest.h
+++ b/ndn-cpp/c/Interest.h
@@ -7,6 +7,7 @@
 #define	NDN_INTEREST_H
 
 #include "Name.h"
+#include "PublisherPublicKeyDigest.h"
 
 #ifdef	__cplusplus
 extern "C" {
@@ -72,12 +73,14 @@
   ndn_Interest_DEFAULT_ANSWER_ORIGIN_KIND = ndn_Interest_ANSWER_CONTENT_STORE | ndn_Interest_ANSWER_GENERATED
 };
 
+/**
+ * An ndn_Interest holds an ndn_Name and other fields for an interest.
+ */
 struct ndn_Interest {
   struct ndn_Name name;
 	int minSuffixComponents;  /**< -1 for none */
 	int maxSuffixComponents;  /**< -1 for none */
-	unsigned char *publisherPublicKeyDigest;      /**< pointer to pre-allocated buffer.  0 for none */
-  unsigned int publisherPublicKeyDigestLength; /**< length of publisherPublicKeyDigest.  0 for none */
+  struct ndn_PublisherPublicKeyDigest publisherPublicKeyDigest;
 	struct ndn_Exclude exclude;
 	int childSelector;        /**< -1 for none */
 	int answerOriginKind;     /**< -1 for none */
@@ -103,8 +106,7 @@
   ndn_Name_init(&self->name, nameComponents, maxNameComponents);
 	self->minSuffixComponents = -1;
   self->maxSuffixComponents = -1;
-	self->publisherPublicKeyDigest = 0;
-	self->publisherPublicKeyDigestLength = 0;
+  ndn_PublisherPublicKeyDigest_init(&self->publisherPublicKeyDigest);
   ndn_Exclude_init(&self->exclude, excludeEntries, maxExcludeEntries);
 	self->childSelector = -1;
 	self->answerOriginKind = -1;
diff --git a/ndn-cpp/c/PublisherPublicKeyDigest.h b/ndn-cpp/c/PublisherPublicKeyDigest.h
new file mode 100644
index 0000000..57b85f2
--- /dev/null
+++ b/ndn-cpp/c/PublisherPublicKeyDigest.h
@@ -0,0 +1,35 @@
+/**
+ * @author: Jeff Thompson
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NDN_PUBLISHERPUBLICKEYDIGEST_H
+#define	NDN_PUBLISHERPUBLICKEYDIGEST_H
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+/**
+ * A PublisherPublicKeyDigest holds a pointer to the publisher public key digest value, if any.
+ * We make a separate struct since this is used by multiple other structs.
+ */
+struct ndn_PublisherPublicKeyDigest {
+	unsigned char *publisherPublicKeyDigest;      /**< pointer to pre-allocated buffer.  0 for none */
+  unsigned int publisherPublicKeyDigestLength;  /**< length of publisherPublicKeyDigest.  0 for none */  
+};
+
+/**
+ * Initialize an ndn_PublisherPublicKeyDigest struct with 0 for none.
+ */
+static inline void ndn_PublisherPublicKeyDigest_init(struct ndn_PublisherPublicKeyDigest *self)
+{
+  self->publisherPublicKeyDigest = 0;
+  self->publisherPublicKeyDigestLength = 0;
+}
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif
diff --git a/ndn-cpp/c/encoding/BinaryXMLInterest.c b/ndn-cpp/c/encoding/BinaryXMLInterest.c
index 270e13b..c7e4177 100644
--- a/ndn-cpp/c/encoding/BinaryXMLInterest.c
+++ b/ndn-cpp/c/encoding/BinaryXMLInterest.c
@@ -7,6 +7,7 @@
 #include "BinaryXMLEncoder.h"
 #include "BinaryXMLDecoder.h"
 #include "BinaryXMLName.h"
+#include "BinaryXMLPublisherPublicKeyDigest.h"
 #include "BinaryXMLInterest.h"
 
 static ndn_Error encodeExclude(struct ndn_Exclude *exclude, struct ndn_BinaryXMLEncoder *encoder)
@@ -138,13 +139,11 @@
       return error;
   }
     
-  if (interest->publisherPublicKeyDigest && interest->publisherPublicKeyDigestLength > 0) {
-    if (error = ndn_BinaryXMLEncoder_writeBlobDTagElement
-        (encoder, ndn_BinaryXML_DTag_PublisherPublicKeyDigest, interest->publisherPublicKeyDigest, interest->publisherPublicKeyDigestLength))
-      return error;
-  }
+  // This will skip encoding if there is no publisherPublicKeyDigest.
+  if (error = ndn_encodeBinaryXMLPublisherPublicKeyDigest(&interest->publisherPublicKeyDigest, encoder))
+    return error;
   
-  // This will check for no exclude.
+  // This will skip encoding if there is no exclude.
   if (error = encodeExclude(&interest->exclude, encoder))
     return error;
 
@@ -208,14 +207,12 @@
   if (error = ndn_BinaryXMLDecoder_peekDTag(decoder, ndn_BinaryXML_DTag_PublisherPublicKeyDigest, &gotExpectedTag))
     return error;
   if (gotExpectedTag) {
-    if (error = ndn_BinaryXMLDecoder_readBinaryDTagElement
-        (decoder, ndn_BinaryXML_DTag_PublisherPublicKeyDigest, 0, &interest->publisherPublicKeyDigest,
-         &interest->publisherPublicKeyDigestLength))
+    if (error = ndn_decodeBinaryXMLPublisherPublicKeyDigest(&interest->publisherPublicKeyDigest, decoder))
       return error;
   }
   else {
-    interest->publisherPublicKeyDigest = 0;
-    interest->publisherPublicKeyDigestLength = 0;
+    interest->publisherPublicKeyDigest.publisherPublicKeyDigest = 0;
+    interest->publisherPublicKeyDigest.publisherPublicKeyDigestLength = 0;
   }
   
   if (error = ndn_BinaryXMLDecoder_peekDTag(decoder, ndn_BinaryXML_DTag_Exclude, &gotExpectedTag))
diff --git a/ndn-cpp/c/encoding/BinaryXMLInterest.h b/ndn-cpp/c/encoding/BinaryXMLInterest.h
index 38917aa..9a58b78 100644
--- a/ndn-cpp/c/encoding/BinaryXMLInterest.h
+++ b/ndn-cpp/c/encoding/BinaryXMLInterest.h
@@ -8,6 +8,8 @@
 
 #include "../errors.h"
 #include "../Interest.h"
+#include "BinaryXMLEncoder.h"
+#include "BinaryXMLDecoder.h"
 
 #ifdef	__cplusplus
 extern "C" {
diff --git a/ndn-cpp/c/encoding/BinaryXMLPublisherPublicKeyDigest.c b/ndn-cpp/c/encoding/BinaryXMLPublisherPublicKeyDigest.c
new file mode 100644
index 0000000..b1ee3f8
--- /dev/null
+++ b/ndn-cpp/c/encoding/BinaryXMLPublisherPublicKeyDigest.c
@@ -0,0 +1,35 @@
+/**
+ * @author: Jeff Thompson
+ * Derived from PublisherPublicKeyDigest.js by Meki Cheraoui.
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "BinaryXML.h"
+#include "BinaryXMLPublisherPublicKeyDigest.h"
+
+ndn_Error ndn_encodeBinaryXMLPublisherPublicKeyDigest
+  (struct ndn_PublisherPublicKeyDigest *publisherPublicKeyDigest, struct ndn_BinaryXMLEncoder *encoder)
+{  
+  if (!publisherPublicKeyDigest->publisherPublicKeyDigest || publisherPublicKeyDigest->publisherPublicKeyDigestLength == 0)
+    return;
+  
+  ndn_Error error;
+  if (error = ndn_BinaryXMLEncoder_writeBlobDTagElement
+      (encoder, ndn_BinaryXML_DTag_PublisherPublicKeyDigest, publisherPublicKeyDigest->publisherPublicKeyDigest, 
+       publisherPublicKeyDigest->publisherPublicKeyDigestLength))
+    return error;
+  
+  return 0;
+}
+
+ndn_Error ndn_decodeBinaryXMLPublisherPublicKeyDigest
+  (struct ndn_PublisherPublicKeyDigest *publisherPublicKeyDigest, struct ndn_BinaryXMLDecoder *decoder)
+{
+  ndn_Error error; 
+  if (error = ndn_BinaryXMLDecoder_readBinaryDTagElement
+      (decoder, ndn_BinaryXML_DTag_PublisherPublicKeyDigest, 0, &publisherPublicKeyDigest->publisherPublicKeyDigest,
+       &publisherPublicKeyDigest->publisherPublicKeyDigestLength))
+    return error;
+  
+  return 0;
+}
diff --git a/ndn-cpp/c/encoding/BinaryXMLPublisherPublicKeyDigest.h b/ndn-cpp/c/encoding/BinaryXMLPublisherPublicKeyDigest.h
new file mode 100644
index 0000000..430395c
--- /dev/null
+++ b/ndn-cpp/c/encoding/BinaryXMLPublisherPublicKeyDigest.h
@@ -0,0 +1,41 @@
+/**
+ * @author: Jeff Thompson
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NDN_BINARYXMLPUBLISHERPUBLICKEYDIGEST_H
+#define	NDN_BINARYXMLPUBLISHERPUBLICKEYDIGEST_H
+
+#include "../errors.h"
+#include "../PublisherPublicKeyDigest.h"
+#include "BinaryXMLEncoder.h"
+#include "BinaryXMLDecoder.h"
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+/**
+ * Encode the ndn_PublisherPublicKeyDigest struct using Binary XML.  If publisherPublicKeyDigest->publisherPublicKeyDigest or
+ * publisherPublicKeyDigestLength is 0, then do nothing. 
+ * @param publisherPublicKeyDigest pointer to the ndn_PublisherPublicKeyDigest struct
+ * @param encoder pointer to the ndn_BinaryXMLEncoder struct
+ * @return 0 for success, else an error code
+ */
+ndn_Error ndn_encodeBinaryXMLPublisherPublicKeyDigest
+  (struct ndn_PublisherPublicKeyDigest *publisherPublicKeyDigest, struct ndn_BinaryXMLEncoder *encoder);
+
+/**
+ * Expect the next element to be a Binary XML PublisherPublicKeyDigest and decode into the ndn_PublisherPublicKeyDigest struct.
+ * @param publisherPublicKeyDigest pointer to the ndn_PublisherPublicKeyDigest struct
+ * @param decoder pointer to the ndn_BinaryXMLDecoder struct
+ * @return 0 for success, else an error code, including if the next element is not PublisherPublicKeyDigest.
+ */
+ndn_Error ndn_decodeBinaryXMLPublisherPublicKeyDigest
+  (struct ndn_PublisherPublicKeyDigest *publisherPublicKeyDigest, struct ndn_BinaryXMLDecoder *decoder);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif