diff --git a/ndn-cpp/c/encoding/binary-xml-key.c b/ndn-cpp/c/encoding/binary-xml-key.c
index 5b6de79..c1df758 100644
--- a/ndn-cpp/c/encoding/binary-xml-key.c
+++ b/ndn-cpp/c/encoding/binary-xml-key.c
@@ -19,12 +19,12 @@
 
   if (keyLocator->type == ndn_KeyLocatorType_KEY) {
     if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement
-        (encoder, ndn_BinaryXml_DTag_Key, keyLocator->keyOrCertificate, keyLocator->keyOrCertificateLength)))
+        (encoder, ndn_BinaryXml_DTag_Key, keyLocator->keyData, keyLocator->keyDataLength)))
       return error;    
   }
   else if (keyLocator->type == ndn_KeyLocatorType_CERTIFICATE) {
     if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement
-        (encoder, ndn_BinaryXml_DTag_Certificate, keyLocator->keyOrCertificate, keyLocator->keyOrCertificateLength)))
+        (encoder, ndn_BinaryXml_DTag_Certificate, keyLocator->keyData, keyLocator->keyDataLength)))
       return error;    
   }
   else if (keyLocator->type == ndn_KeyLocatorType_KEYNAME) {
@@ -52,7 +52,7 @@
     keyLocator->type = ndn_KeyLocatorType_KEY;
     
     if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement
-        (decoder, ndn_BinaryXml_DTag_Key, 0, &keyLocator->keyOrCertificate, &keyLocator->keyOrCertificateLength)))
+        (decoder, ndn_BinaryXml_DTag_Key, 0, &keyLocator->keyData, &keyLocator->keyDataLength)))
       return error;
   }
   else {
@@ -62,7 +62,7 @@
       keyLocator->type = ndn_KeyLocatorType_CERTIFICATE;
     
       if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement
-          (decoder, ndn_BinaryXml_DTag_Certificate, 0, &keyLocator->keyOrCertificate, &keyLocator->keyOrCertificateLength)))
+          (decoder, ndn_BinaryXml_DTag_Certificate, 0, &keyLocator->keyData, &keyLocator->keyDataLength)))
         return error;
     }
     else {
diff --git a/ndn-cpp/c/key.h b/ndn-cpp/c/key.h
index 0f599d5..bb0aee6 100644
--- a/ndn-cpp/c/key.h
+++ b/ndn-cpp/c/key.h
@@ -18,16 +18,16 @@
   
 struct ndn_KeyLocator {
   ndn_KeyLocatorType type;         /**< -1 for none */
-  unsigned char *keyOrCertificate; /**< 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 keyOrCertificateLength;
+  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.
 };
 
 static inline void ndn_KeyLocator_init(struct ndn_KeyLocator *self) {
   self->type = (ndn_KeyLocatorType)-1;
-  self->keyOrCertificate = 0;
-  self->keyOrCertificateLength = 0;
+  self->keyData = 0;
+  self->keyDataLength = 0;
   // TODO: Implement keyName.
 }
 
diff --git a/ndn-cpp/key-chain.cpp b/ndn-cpp/key-chain.cpp
index ef31c4c..9ab58fc 100644
--- a/ndn-cpp/key-chain.cpp
+++ b/ndn-cpp/key-chain.cpp
@@ -116,7 +116,7 @@
   // Set the public key.
   setSha256(publicKeyDer, publicKeyDerLength, data.getSignedInfo().getPublisherPublicKeyDigest().getPublisherPublicKeyDigest());
   data.getSignedInfo().getKeyLocator().setType(ndn_KeyLocatorType_KEY);
-  data.getSignedInfo().getKeyLocator().setKeyOrCertificate(publicKeyDer, publicKeyDerLength);
+  data.getSignedInfo().getKeyLocator().setKeyData(publicKeyDer, publicKeyDerLength);
   // Clear the signature so we don't encode it below.
   data.getSignature().clear();
 
@@ -161,8 +161,8 @@
   const unsigned char *publicKeyDer;
   unsigned int publicKeyDerLength;
   if (data.getSignedInfo().getKeyLocator().getType() == ndn_KeyLocatorType_KEY) {
-    publicKeyDer = &data.getSignedInfo().getKeyLocator().getKeyOrCertificate().front();
-    publicKeyDerLength = data.getSignedInfo().getKeyLocator().getKeyOrCertificate().size();
+    publicKeyDer = &data.getSignedInfo().getKeyLocator().getKeyData().front();
+    publicKeyDerLength = data.getSignedInfo().getKeyLocator().getKeyData().size();
   }
   else
     // Can't find a public key.
diff --git a/ndn-cpp/key.cpp b/ndn-cpp/key.cpp
index 41fe8b9..e927a8e 100644
--- a/ndn-cpp/key.cpp
+++ b/ndn-cpp/key.cpp
@@ -14,11 +14,11 @@
 {
   keyLocatorStruct.type = type_;
   
-  keyLocatorStruct.keyOrCertificateLength = keyOrCertificate_.size();
-  if (keyOrCertificate_.size() > 0)
-    keyLocatorStruct.keyOrCertificate = (unsigned char *)&keyOrCertificate_[0];
+  keyLocatorStruct.keyDataLength = keyData_.size();
+  if (keyData_.size() > 0)
+    keyLocatorStruct.keyData = (unsigned char *)&keyData_[0];
   else
-    keyLocatorStruct.keyOrCertificate = 0;
+    keyLocatorStruct.keyData = 0;
 
   // TODO: Implement keyName.
 }
@@ -26,7 +26,7 @@
 void KeyLocator::set(const struct ndn_KeyLocator &keyLocatorStruct)
 {
   type_ = keyLocatorStruct.type;
-  setVector(keyOrCertificate_, keyLocatorStruct.keyOrCertificate, keyLocatorStruct.keyOrCertificateLength);
+  setVector(keyData_, keyLocatorStruct.keyData, keyLocatorStruct.keyDataLength);
   // TODO: Implement keyName.
 }
 
diff --git a/ndn-cpp/key.hpp b/ndn-cpp/key.hpp
index f221505..c9037b1 100644
--- a/ndn-cpp/key.hpp
+++ b/ndn-cpp/key.hpp
@@ -33,23 +33,38 @@
 
   ndn_KeyLocatorType getType() const { return type_; }
   
-  const std::vector<unsigned char> &getKeyOrCertificate() const { return keyOrCertificate_; }
+  const std::vector<unsigned char> &getKeyData() const { return keyData_; }
 
   // TODO: Implement getKeyName.
 
   void setType(ndn_KeyLocatorType type) { type_ = type; }
   
-  void setKeyOrCertificate(const std::vector<unsigned char> &keyOrCertificate) { keyOrCertificate_ = keyOrCertificate; }
-  void setKeyOrCertificate(const unsigned char *keyOrCertificate, unsigned int keyOrCertificateLength) 
+  void setKeyData(const std::vector<unsigned char> &keyData) { keyData_ = keyData; }
+  void setKeyData(const unsigned char *keyData, unsigned int keyDataLength) 
   { 
-    setVector(keyOrCertificate_, keyOrCertificate, keyOrCertificateLength); 
+    setVector(keyData_, keyData, keyDataLength); 
   }
 
+  /**
+   * @deprecated Use getKeyData().
+   */
+  const std::vector<unsigned char> &getKeyOrCertificate() const { return getKeyData(); }
+
+  /**
+   * @deprecated Use setKeyData.
+   */
+  void setKeyOrCertificate(const std::vector<unsigned char> &keyData) { setKeyData(keyData); }
+  
+  /**
+   * @deprecated Use setKeyData.
+   */
+  void setKeyOrCertificate(const unsigned char *keyData, unsigned int keyDataLength) { setKeyData(keyData, keyDataLength); }
+
   // TODO: Implement setKeyName.
 
 private:
   ndn_KeyLocatorType type_;
-  std::vector<unsigned char> keyOrCertificate_; /**< used if type_ is ndn_KeyLocatorType_KEY or ndn_KeyLocatorType_CERTIFICATE */
+  std::vector<unsigned char> keyData_; /**< used if type_ is ndn_KeyLocatorType_KEY or ndn_KeyLocatorType_CERTIFICATE */
   // TODO: Implement keyName.
 };
   
diff --git a/tests/test-encode-decode-data.cpp b/tests/test-encode-decode-data.cpp
index 176353c..61a1202 100644
--- a/tests/test-encode-decode-data.cpp
+++ b/tests/test-encode-decode-data.cpp
@@ -118,9 +118,9 @@
   cout << "signedInfo.keyLocator: ";
   if (data.getSignedInfo().getKeyLocator().getType() >= 0) {
     if (data.getSignedInfo().getKeyLocator().getType() == ndn_KeyLocatorType_KEY)
-      cout << "Key: " << toHex(data.getSignedInfo().getKeyLocator().getKeyOrCertificate()) << endl;
+      cout << "Key: " << toHex(data.getSignedInfo().getKeyLocator().getKeyData()) << endl;
     else if (data.getSignedInfo().getKeyLocator().getType() == ndn_KeyLocatorType_CERTIFICATE)
-      cout << "Certificate: " << toHex(data.getSignedInfo().getKeyLocator().getKeyOrCertificate()) << endl;
+      cout << "Certificate: " << toHex(data.getSignedInfo().getKeyLocator().getKeyData()) << endl;
     else if (data.getSignedInfo().getKeyLocator().getType() == ndn_KeyLocatorType_KEYNAME)
       // TODO: Implement keyName.
       cout << "keyName" << endl;
