In KeyLocator, added support for KeyName.
diff --git a/ndn-cpp/c/data.h b/ndn-cpp/c/data.h
index c8d97fc..98a1d76 100644
--- a/ndn-cpp/c/data.h
+++ b/ndn-cpp/c/data.h
@@ -54,15 +54,18 @@
 
 /**
  * Initialize the ndn_SignedInfo struct with values for none and the type to the default ndn_ContentType_DATA.
- * @param self pointer to the ndn_SignedInfo struct.
+ * @param self A pointer to the ndn_SignedInfo 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_init(struct ndn_SignedInfo *self) {
+static inline void ndn_SignedInfo_init
+  (struct ndn_SignedInfo *self, struct ndn_NameComponent *keyNameComponents, unsigned int maxKeyNameComponents) {
   ndn_PublisherPublicKeyDigest_init(&self->publisherPublicKeyDigest);
   self->type = ndn_ContentType_DATA;
   self->freshnessSeconds = -1;
   self->finalBlockID = 0;
   self->finalBlockIDLength = 0;
-  ndn_KeyLocator_init(&self->keyLocator);
+  ndn_KeyLocator_init(&self->keyLocator, keyNameComponents, maxKeyNameComponents);
 }
 
 struct ndn_Data {
@@ -74,17 +77,21 @@
 };
 
 /**
- * Initialize an ndn_Data struct with the pre-allocated nameComponents,
+ * Initialize an ndn_Data struct with the pre-allocated nameComponents and keyNameComponents,
  * and defaults for all the values.
- * @param self 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 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 maxKeyNameComponents The number of elements in the allocated keyNameComponents array.
  */
-static inline void ndn_Data_init(struct ndn_Data *self, struct ndn_NameComponent *nameComponents, unsigned int maxNameComponents) 
+static inline void ndn_Data_init
+  (struct ndn_Data *self, struct ndn_NameComponent *nameComponents, unsigned int maxNameComponents, 
+   struct ndn_NameComponent *keyNameComponents, unsigned int maxKeyNameComponents) 
 {
   ndn_Signature_init(&self->signature);
   ndn_Name_init(&self->name, nameComponents, maxNameComponents);
-  ndn_SignedInfo_init(&self->signedInfo);
+  ndn_SignedInfo_init(&self->signedInfo, 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 564e6f4..37513f9 100644
--- a/ndn-cpp/c/encoding/binary-xml-data.c
+++ b/ndn-cpp/c/encoding/binary-xml-data.c
@@ -188,7 +188,7 @@
       return error;
   }
   else
-    ndn_SignedInfo_init(&data->signedInfo);
+    ndn_SignedInfo_init(&data->signedInfo, data->signedInfo.keyLocator.keyName.components, data->signedInfo.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/c/encoding/binary-xml-key.c b/ndn-cpp/c/encoding/binary-xml-key.c
index c1df758..42e4463 100644
--- a/ndn-cpp/c/encoding/binary-xml-key.c
+++ b/ndn-cpp/c/encoding/binary-xml-key.c
@@ -8,6 +8,54 @@
 #include "binary-xml-structure-decoder.h"
 #include "binary-xml-key.h"
 
+static ndn_Error decodeKeyNameData(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlDecoder *decoder)
+{
+  int gotExpectedTag;
+  ndn_Error error; 
+  if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_PublisherPublicKeyDigest, &gotExpectedTag)))
+    return error;
+  if (gotExpectedTag) {
+    keyLocator->keyNameType = ndn_KeyNameType_PUBLISHER_PUBLIC_KEY_DIGEST;
+    if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement
+        (decoder, ndn_BinaryXml_DTag_PublisherPublicKeyDigest, 0, &keyLocator->keyData, &keyLocator->keyDataLength)))
+      return error;
+  }
+  else {
+    if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_PublisherCertificateDigest, &gotExpectedTag)))
+      return error;
+    if (gotExpectedTag) {
+      keyLocator->keyNameType = ndn_KeyNameType_PUBLISHER_CERTIFICATE_DIGEST;
+      if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement
+          (decoder, ndn_BinaryXml_DTag_PublisherCertificateDigest, 0, &keyLocator->keyData, &keyLocator->keyDataLength)))
+        return error;
+    }
+    else {
+      if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_PublisherIssuerKeyDigest, &gotExpectedTag)))
+        return error;
+      if (gotExpectedTag) {
+        keyLocator->keyNameType = ndn_KeyNameType_PUBLISHER_ISSUER_KEY_DIGEST;
+        if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement
+            (decoder, ndn_BinaryXml_DTag_PublisherIssuerKeyDigest, 0, &keyLocator->keyData, &keyLocator->keyDataLength)))
+          return error;
+      }
+      else {
+        if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_PublisherIssuerCertificateDigest, &gotExpectedTag)))
+          return error;
+        if (gotExpectedTag) {
+          keyLocator->keyNameType = ndn_KeyNameType_PUBLISHER_ISSUER_CERTIFICATE_DIGEST;
+          if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement
+              (decoder, ndn_BinaryXml_DTag_PublisherIssuerCertificateDigest, 0, &keyLocator->keyData, &keyLocator->keyDataLength)))
+            return error;
+        }
+        else
+          return NDN_ERROR_decodeBinaryXmlKeyLocator_unrecognized_key_name_type;
+      }
+    }
+  }
+  
+  return NDN_ERROR_success;
+}
+
 ndn_Error ndn_encodeBinaryXmlKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlEncoder *encoder)
 {
   if (keyLocator->type < 0)
@@ -28,7 +76,36 @@
       return error;    
   }
   else if (keyLocator->type == ndn_KeyLocatorType_KEYNAME) {
-    // TODO: Implement keyName
+    if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_KeyName)))
+      return error;
+    if ((error = ndn_encodeBinaryXmlName(&keyLocator->keyName, encoder)))
+      return error;
+    
+    if (keyLocator->keyNameType == ndn_KeyNameType_PUBLISHER_PUBLIC_KEY_DIGEST) {
+      if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement
+          (encoder, ndn_BinaryXml_DTag_PublisherPublicKeyDigest, keyLocator->keyData, keyLocator->keyDataLength)))
+        return error;    
+    }
+    else if (keyLocator->keyNameType == ndn_KeyNameType_PUBLISHER_CERTIFICATE_DIGEST) {
+      if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement
+          (encoder, ndn_BinaryXml_DTag_PublisherCertificateDigest, keyLocator->keyData, keyLocator->keyDataLength)))
+        return error;    
+    }
+    else if (keyLocator->keyNameType == ndn_KeyNameType_PUBLISHER_ISSUER_KEY_DIGEST) {
+      if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement
+          (encoder, ndn_BinaryXml_DTag_PublisherIssuerKeyDigest, keyLocator->keyData, keyLocator->keyDataLength)))
+        return error;    
+    }
+    else if (keyLocator->keyNameType == ndn_KeyNameType_PUBLISHER_ISSUER_CERTIFICATE_DIGEST) {
+      if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement
+          (encoder, ndn_BinaryXml_DTag_PublisherIssuerCertificateDigest, keyLocator->keyData, keyLocator->keyDataLength)))
+        return error;    
+    }
+    else
+      return NDN_ERROR_unrecognized_ndn_KeyNameType;
+
+    if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
+      return error;
   }
   else
     return NDN_ERROR_unrecognized_ndn_KeyLocatorType;
@@ -69,16 +146,16 @@
       if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_KeyName, &gotExpectedTag)))
         return error;
       if (gotExpectedTag) {
-        // TODO: Implement keyName. For now, just use a structure decoder to skip it.
-        struct ndn_BinaryXmlStructureDecoder structureDecoder;
-        ndn_BinaryXmlStructureDecoder_init(&structureDecoder);
+        keyLocator->type = ndn_KeyLocatorType_KEYNAME;
         
-        ndn_BinaryXmlStructureDecoder_seek(&structureDecoder, decoder->offset);
-        if ((error = ndn_BinaryXmlStructureDecoder_findElementEnd(&structureDecoder, decoder->input, decoder->inputLength)))
+        if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_KeyName)))
           return error;
-        if (!structureDecoder.gotElementEnd)
-          return NDN_ERROR_read_past_the_end_of_the_input;
-        ndn_BinaryXmlDecoder_seek(decoder, structureDecoder.offset);        
+        if ((error = ndn_decodeBinaryXmlName(&keyLocator->keyName, decoder)))
+          return error;
+        if ((error = decodeKeyNameData(keyLocator, decoder)))
+          return error;        
+        if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder)))
+          return error;
       }
       else
         return NDN_ERROR_decodeBinaryXmlKeyLocator_unrecognized_key_locator_type;
@@ -102,7 +179,7 @@
       return error;
   }
   else
-    ndn_KeyLocator_init(keyLocator);
+    ndn_KeyLocator_init(keyLocator, keyLocator->keyName.components, keyLocator->keyName.maxComponents);
   
   return NDN_ERROR_success;
 }
diff --git a/ndn-cpp/c/errors.c b/ndn-cpp/c/errors.c
index 8c87d77..6811b6a 100644
--- a/ndn-cpp/c/errors.c
+++ b/ndn-cpp/c/errors.c
@@ -50,8 +50,12 @@
     return      "unrecognized ndn_ExcludeType";
   case NDN_ERROR_unrecognized_ndn_KeyLocatorType:
     return      "unrecognized ndn_KeyLocatorType";
+  case NDN_ERROR_unrecognized_ndn_KeyNameType:
+    return      "unrecognized ndn_KeyNameType";
   case NDN_ERROR_decodeBinaryXmlKeyLocator_unrecognized_key_locator_type:
     return      "decodeBinaryXmlKeyLocator unrecognized key locator type";
+  case NDN_ERROR_decodeBinaryXmlKeyLocator_unrecognized_key_name_type:
+    return      "decodeBinaryXmlKeyLocator unrecognized key name type";
   case NDN_ERROR_unrecognized_ndn_SocketTransport:
     return      "unrecognized ndn_SocketTransport";
   case NDN_ERROR_SocketTransport_error_in_getaddrinfo:
diff --git a/ndn-cpp/c/errors.h b/ndn-cpp/c/errors.h
index f6adb08..2e64492 100644
--- a/ndn-cpp/c/errors.h
+++ b/ndn-cpp/c/errors.h
@@ -33,7 +33,9 @@
   NDN_ERROR_DynamicUCharArray_realloc_failed,
   NDN_ERROR_unrecognized_ndn_ExcludeType,
   NDN_ERROR_unrecognized_ndn_KeyLocatorType,
+  NDN_ERROR_unrecognized_ndn_KeyNameType,
   NDN_ERROR_decodeBinaryXmlKeyLocator_unrecognized_key_locator_type,
+  NDN_ERROR_decodeBinaryXmlKeyLocator_unrecognized_key_name_type,
   NDN_ERROR_unrecognized_ndn_SocketTransport,
   NDN_ERROR_SocketTransport_error_in_getaddrinfo,
   NDN_ERROR_SocketTransport_cannot_connect_to_socket,
diff --git a/ndn-cpp/c/key.h b/ndn-cpp/c/key.h
index bb0aee6..5bfe05e 100644
--- a/ndn-cpp/c/key.h
+++ b/ndn-cpp/c/key.h
@@ -6,6 +6,8 @@
 #ifndef NDN_KEY_H
 #define NDN_KEY_H
 
+#include "name.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -15,20 +17,45 @@
   ndn_KeyLocatorType_CERTIFICATE = 2,
   ndn_KeyLocatorType_KEYNAME = 3
 } ndn_KeyLocatorType;
-  
+
+typedef enum {
+  ndn_KeyNameType_PUBLISHER_PUBLIC_KEY_DIGEST = 1,
+  ndn_KeyNameType_PUBLISHER_CERTIFICATE_DIGEST = 2,
+  ndn_KeyNameType_PUBLISHER_ISSUER_KEY_DIGEST = 3,
+  ndn_KeyNameType_PUBLISHER_ISSUER_CERTIFICATE_DIGEST = 4
+} ndn_KeyNameType;
+
+/**
+ * An ndn_KeyLocator holds the type of key locator and related data.
+ */
 struct ndn_KeyLocator {
-  ndn_KeyLocatorType type;         /**< -1 for none */
-  unsigned char *keyData; /**< if type is ndn_KeyLocatorType_KEY, pointer to the pre-allocated buffer for the key value.
-                               if type is ndn_KeyLocatorType_CERTIFICATE, pointer to the pre-allocated buffer for the cetrificate value. */
-  unsigned int keyDataLength;
-  // TODO: Implement keyName.
+  ndn_KeyLocatorType type;     /**< -1 for none */
+  unsigned char *keyData;      /**< A pointer to a pre-allocated buffer for the key data as follows:
+    *   If type is ndn_KeyLocatorType_KEY, the key data.
+    *   If type is ndn_KeyLocatorType_CERTIFICATE, the certificate data. 
+    *   If type is ndn_KeyLocatorType_KEYNAME and keyNameType is ndn_KeyNameType_PUBLISHER_PUBLIC_KEY_DIGEST, the publisher public key digest. 
+    *   If type is ndn_KeyLocatorType_KEYNAME and keyNameType is ndn_KeyNameType_PUBLISHER_CERTIFICATE_DIGEST, the publisher certificate digest. 
+    *   If type is ndn_KeyLocatorType_KEYNAME and keyNameType is ndn_KeyNameType_PUBLISHER_ISSUER_KEY_DIGEST, the publisher issuer key digest. 
+    *   If type is ndn_KeyLocatorType_KEYNAME and keyNameType is ndn_KeyNameType_PUBLISHER_ISSUER_CERTIFICATE_DIGEST, the publisher issuer certificate digest. 
+    */
+  unsigned int keyDataLength;  /**< The length of keyData. */
+  struct ndn_Name keyName;     /**< The key name (only used if type is ndn_KeyLocatorType_KEYNAME.) */
+  ndn_KeyNameType keyNameType; /**< The type of data for keyName (only used if type is ndn_KeyLocatorType_KEYNAME.) */
 };
 
-static inline void ndn_KeyLocator_init(struct ndn_KeyLocator *self) {
+/**
+ * Initialize an ndn_KeyLocator struct with the pre-allocated nameComponents, and defaults for all the values.
+ * @param self A pointer to the ndn_KeyLocator struct.
+ * @param keyNameComponents The pre-allocated array of ndn_NameComponent.
+ * @param maxKeyNameComponents The number of elements in the allocated keyNameComponents array.
+ */
+static inline void ndn_KeyLocator_init
+  (struct ndn_KeyLocator *self, struct ndn_NameComponent *keyNameComponents, unsigned int maxKeyNameComponents) {
   self->type = (ndn_KeyLocatorType)-1;
   self->keyData = 0;
   self->keyDataLength = 0;
-  // TODO: Implement keyName.
+  ndn_Name_init(&self->keyName, keyNameComponents, maxKeyNameComponents);
+  self->keyNameType = (ndn_KeyNameType)-1;
 }
 
 #ifdef __cplusplus
diff --git a/ndn-cpp/encoding/binary-xml-wire-format.cpp b/ndn-cpp/encoding/binary-xml-wire-format.cpp
index 574a374..8cb5643 100644
--- a/ndn-cpp/encoding/binary-xml-wire-format.cpp
+++ b/ndn-cpp/encoding/binary-xml-wire-format.cpp
@@ -61,9 +61,11 @@
   (const Data &data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset) 
 {
   struct ndn_NameComponent nameComponents[100];
+  struct ndn_NameComponent keyNameComponents[100];
   struct ndn_Data dataStruct;
   ndn_Data_init
-    (&dataStruct, nameComponents, sizeof(nameComponents) / sizeof(nameComponents[0]));
+    (&dataStruct, nameComponents, sizeof(nameComponents) / sizeof(nameComponents[0]), 
+     keyNameComponents, sizeof(keyNameComponents) / sizeof(keyNameComponents[0]));
   data.get(dataStruct);
 
   BinaryXmlEncoder encoder;
@@ -78,9 +80,11 @@
   (Data &data, const unsigned char *input, unsigned int inputLength, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset)
 {
   struct ndn_NameComponent nameComponents[100];
+  struct ndn_NameComponent keyNameComponents[100];
   struct ndn_Data dataStruct;
   ndn_Data_init
-    (&dataStruct, nameComponents, sizeof(nameComponents) / sizeof(nameComponents[0]));
+    (&dataStruct, nameComponents, sizeof(nameComponents) / sizeof(nameComponents[0]), 
+     keyNameComponents, sizeof(keyNameComponents) / sizeof(keyNameComponents[0]));
     
   BinaryXmlDecoder decoder(input, inputLength);  
   ndn_Error error;
diff --git a/ndn-cpp/key-chain.cpp b/ndn-cpp/key-chain.cpp
index 9ab58fc..242617d 100644
--- a/ndn-cpp/key-chain.cpp
+++ b/ndn-cpp/key-chain.cpp
@@ -96,8 +96,11 @@
 {
   // Imitate BinaryXmlWireFormat::encodeData.
   struct ndn_NameComponent nameComponents[100];
+  struct ndn_NameComponent keyNameComponents[100];
   struct ndn_Data dataStruct;
-  ndn_Data_init(&dataStruct, nameComponents, sizeof(nameComponents) / sizeof(nameComponents[0]));
+  ndn_Data_init
+    (&dataStruct, nameComponents, sizeof(nameComponents) / sizeof(nameComponents[0]), 
+     keyNameComponents, sizeof(keyNameComponents) / sizeof(keyNameComponents[0]));
   data.get(dataStruct);
 
   BinaryXmlEncoder encoder;
diff --git a/ndn-cpp/key.cpp b/ndn-cpp/key.cpp
index e927a8e..7548968 100644
--- a/ndn-cpp/key.cpp
+++ b/ndn-cpp/key.cpp
@@ -20,14 +20,22 @@
   else
     keyLocatorStruct.keyData = 0;
 
-  // TODO: Implement keyName.
+  keyName_.get(keyLocatorStruct.keyName);
+  keyLocatorStruct.keyNameType = keyNameType_;
 }
 
 void KeyLocator::set(const struct ndn_KeyLocator &keyLocatorStruct)
 {
   type_ = keyLocatorStruct.type;
   setVector(keyData_, keyLocatorStruct.keyData, keyLocatorStruct.keyDataLength);
-  // TODO: Implement keyName.
+  if (keyLocatorStruct.type == ndn_KeyLocatorType_KEYNAME) {
+    keyName_.set(keyLocatorStruct.keyName);
+    keyNameType_ = keyLocatorStruct.keyNameType;
+  }
+  else {
+    keyName_.clear();
+    keyNameType_ = (ndn_KeyNameType)-1;
+  }
 }
 
 }
diff --git a/ndn-cpp/key.hpp b/ndn-cpp/key.hpp
index c9037b1..7980fab 100644
--- a/ndn-cpp/key.hpp
+++ b/ndn-cpp/key.hpp
@@ -8,14 +8,15 @@
 
 #include <vector>
 #include "c/key.h"
+#include "Name.hpp"
 
 namespace ndn {
   
 class KeyLocator {
 public:
   KeyLocator()
+  : type_((ndn_KeyLocatorType)-1), keyNameType_((ndn_KeyNameType)-1)
   {
-    type_ = (ndn_KeyLocatorType)-1;
   }
   
   /**
@@ -35,7 +36,10 @@
   
   const std::vector<unsigned char> &getKeyData() const { return keyData_; }
 
-  // TODO: Implement getKeyName.
+  const Name &getKeyName() const { return keyName_; }
+  Name &getKeyName() { return keyName_; }
+
+  ndn_KeyNameType getKeyNameType() const { return keyNameType_; }
 
   void setType(ndn_KeyLocatorType type) { type_ = type; }
   
@@ -60,12 +64,20 @@
    */
   void setKeyOrCertificate(const unsigned char *keyData, unsigned int keyDataLength) { setKeyData(keyData, keyDataLength); }
 
-  // TODO: Implement setKeyName.
+  void setKeyNameType(ndn_KeyNameType keyNameType) { keyNameType_ = keyNameType; }
 
 private:
-  ndn_KeyLocatorType type_;
-  std::vector<unsigned char> keyData_; /**< used if type_ is ndn_KeyLocatorType_KEY or ndn_KeyLocatorType_CERTIFICATE */
-  // TODO: Implement keyName.
+  ndn_KeyLocatorType type_; /**< -1 for none */
+  std::vector<unsigned char> keyData_; /**< A pointer to a pre-allocated buffer for the key data as follows:
+    *   If type_ is ndn_KeyLocatorType_KEY, the key data.
+    *   If type_ is ndn_KeyLocatorType_CERTIFICATE, the certificate data. 
+    *   If type_ is ndn_KeyLocatorType_KEYNAME and keyNameType_ is ndn_KeyNameType_PUBLISHER_PUBLIC_KEY_DIGEST, the publisher public key digest. 
+    *   If type_ is ndn_KeyLocatorType_KEYNAME and keyNameType_ is ndn_KeyNameType_PUBLISHER_CERTIFICATE_DIGEST, the publisher certificate digest. 
+    *   If type_ is ndn_KeyLocatorType_KEYNAME and keyNameType_ is ndn_KeyNameType_PUBLISHER_ISSUER_KEY_DIGEST, the publisher issuer key digest. 
+    *   If type_ is ndn_KeyLocatorType_KEYNAME and keyNameType_ is ndn_KeyNameType_PUBLISHER_ISSUER_CERTIFICATE_DIGEST, the publisher issuer certificate digest. 
+                                */
+  Name keyName_;                /**< The key name (only used if type_ is ndn_KeyLocatorType_KEYNAME.) */
+  ndn_KeyNameType keyNameType_; /**< The type of data for keyName_ (only used if type_ is ndn_KeyLocatorType_KEYNAME.) */
 };
   
 }
diff --git a/tests/test-encode-decode-data.cpp b/tests/test-encode-decode-data.cpp
index 61a1202..149f10e 100644
--- a/tests/test-encode-decode-data.cpp
+++ b/tests/test-encode-decode-data.cpp
@@ -121,9 +121,25 @@
       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)
-      // TODO: Implement keyName.
-      cout << "keyName" << endl;
+    else if (data.getSignedInfo().getKeyLocator().getType() == ndn_KeyLocatorType_KEYNAME) {
+      cout << "KeyName: " << data.getSignedInfo().getKeyLocator().getKeyName().to_uri() << endl;
+      cout << "signedInfo.keyLocator: ";
+      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 << "<unrecognized ndn_KeyLocatorType " << data.getSignedInfo().getKeyLocator().getType() << ">" << endl;
   }