diff --git a/ndn-cpp/key.cpp b/ndn-cpp/key.cpp
index 6cdae60..bbd6877 100644
--- a/ndn-cpp/key.cpp
+++ b/ndn-cpp/key.cpp
@@ -16,7 +16,7 @@
   
   keyLocatorStruct.keyDataLength = keyData_.size();
   if (keyData_.size() > 0)
-    keyLocatorStruct.keyData = (unsigned char *)&keyData_[0];
+    keyLocatorStruct.keyData = (unsigned char *)keyData_.buf();
   else
     keyLocatorStruct.keyData = 0;
 
@@ -27,7 +27,7 @@
 void KeyLocator::set(const struct ndn_KeyLocator& keyLocatorStruct)
 {
   type_ = keyLocatorStruct.type;
-  setVector(keyData_, keyLocatorStruct.keyData, keyLocatorStruct.keyDataLength);
+  keyData_ = Blob(keyLocatorStruct.keyData, keyLocatorStruct.keyDataLength);
   if (keyLocatorStruct.type == ndn_KeyLocatorType_KEYNAME) {
     keyName_.set(keyLocatorStruct.keyName);
     keyNameType_ = keyLocatorStruct.keyNameType;
diff --git a/ndn-cpp/key.hpp b/ndn-cpp/key.hpp
index 6cf449e..0717e1b 100644
--- a/ndn-cpp/key.hpp
+++ b/ndn-cpp/key.hpp
@@ -26,7 +26,7 @@
   {
     type_ = (ndn_KeyLocatorType)-1;
     keyNameType_ = (ndn_KeyNameType)-1;
-    keyData_.clear();
+    keyData_ = Blob(0, 0);
   }
   
   /**
@@ -44,7 +44,7 @@
 
   ndn_KeyLocatorType getType() const { return type_; }
   
-  const std::vector<unsigned char>& getKeyData() const { return keyData_; }
+  const Blob& getKeyData() const { return keyData_; }
 
   const Name& getKeyName() const { return keyName_; }
   Name& getKeyName() { return keyName_; }
@@ -56,29 +56,21 @@
   void setKeyData(const std::vector<unsigned char>& keyData) { keyData_ = keyData; }
   void setKeyData(const unsigned char *keyData, unsigned int keyDataLength) 
   { 
-    setVector(keyData_, keyData, keyDataLength); 
+    keyData_ = Blob(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.
+   * Set keyData to point to an existing byte array.  IMPORTANT: After calling this constructor,
+   * if you keep a pointer to the array then you must treat the array as immutable and promise not to change it.
+   * @param keyData A pointer to a vector with the byte array.  This takes another reference and does not copy the bytes.
    */
-  void setKeyOrCertificate(const unsigned char *keyData, unsigned int keyDataLength) { setKeyData(keyData, keyDataLength); }
+  void setKeyData(const ptr_lib::shared_ptr<std::vector<unsigned char> > &keyData) { keyData_ = keyData; }
 
   void setKeyNameType(ndn_KeyNameType keyNameType) { keyNameType_ = keyNameType; }
 
 private:
   ndn_KeyLocatorType type_; /**< -1 for none */
-  std::vector<unsigned char> keyData_; /**< A pointer to a pre-allocated buffer for the key data as follows:
+  Blob keyData_; /**< An array 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. 
diff --git a/ndn-cpp/security/key-chain.cpp b/ndn-cpp/security/key-chain.cpp
index c456036..4a19869 100644
--- a/ndn-cpp/security/key-chain.cpp
+++ b/ndn-cpp/security/key-chain.cpp
@@ -137,7 +137,7 @@
   const unsigned char *publicKeyDer;
   unsigned int publicKeyDerLength;
   if (data.getSignature().getKeyLocator().getType() == ndn_KeyLocatorType_KEY) {
-    publicKeyDer = &data.getSignature().getKeyLocator().getKeyData().front();
+    publicKeyDer = data.getSignature().getKeyLocator().getKeyData().buf();
     publicKeyDerLength = data.getSignature().getKeyLocator().getKeyData().size();
   }
   else
diff --git a/tests/test-encode-decode-data.cpp b/tests/test-encode-decode-data.cpp
index 705e658..6b10104 100644
--- a/tests/test-encode-decode-data.cpp
+++ b/tests/test-encode-decode-data.cpp
@@ -113,9 +113,9 @@
   cout << "signature.keyLocator: ";
   if ((int)data.getSignature().getKeyLocator().getType() >= 0) {
     if (data.getSignature().getKeyLocator().getType() == ndn_KeyLocatorType_KEY)
-      cout << "Key: " << toHex(data.getSignature().getKeyLocator().getKeyData()) << endl;
+      cout << "Key: " << toHex(*data.getSignature().getKeyLocator().getKeyData()) << endl;
     else if (data.getSignature().getKeyLocator().getType() == ndn_KeyLocatorType_CERTIFICATE)
-      cout << "Certificate: " << toHex(data.getSignature().getKeyLocator().getKeyData()) << endl;
+      cout << "Certificate: " << toHex(*data.getSignature().getKeyLocator().getKeyData()) << endl;
     else if (data.getSignature().getKeyLocator().getType() == ndn_KeyLocatorType_KEYNAME) {
       cout << "KeyName: " << data.getSignature().getKeyLocator().getKeyName().to_uri() << endl;
       cout << "metaInfo.keyLocator: ";
@@ -134,7 +134,7 @@
           showKeyNameData = false;
         }
         if (showKeyNameData)
-          cout << toHex(data.getSignature().getKeyLocator().getKeyData()) << endl;
+          cout << toHex(*data.getSignature().getKeyLocator().getKeyData()) << endl;
       }
       else
         cout << "<no key digest>" << endl;
