security: KeyChain: implement sign for buffers.
diff --git a/include/ndn-cpp/security/identity/identity-manager.hpp b/include/ndn-cpp/security/identity/identity-manager.hpp
index 1d6df04..5b07fa0 100644
--- a/include/ndn-cpp/security/identity/identity-manager.hpp
+++ b/include/ndn-cpp/security/identity/identity-manager.hpp
@@ -198,14 +198,26 @@
         
   /**
    * Sign the byte array data based on the certificate name.
-   * @param data The data to be signed.
-   * @param dataLength the length of data.
+   * @param buffer The byte array to be signed.
+   * @param bufferLength the length of buffer.
    * @param certificateName The signing certificate name.
    * @return The generated signature.
    */
   ptr_lib::shared_ptr<Signature>
-  signByCertificate(const uint8_t* data, size_t dataLength, const Name& certificateName);
-    
+  signByCertificate(const uint8_t* buffer, size_t bufferLength, const Name& certificateName);
+
+  /**
+   * Sign the byte array data based on the certificate name.
+   * @param buffer The byte array to be signed.
+   * @param certificateName The signing certificate name.
+   * @return The generated signature.
+   */
+  ptr_lib::shared_ptr<Signature>
+  signByCertificate(const std::vector<uint8_t>& buffer, const Name& certificateName) 
+  {
+    return signByCertificate(&buffer[0], buffer.size(), certificateName);
+  }
+
   /**
    * Sign data packet based on the certificate name.
    * Note: the caller must make sure the timestamp in data is correct, for example with 
diff --git a/include/ndn-cpp/security/key-chain.hpp b/include/ndn-cpp/security/key-chain.hpp
index 40e24fd..758c0fa 100644
--- a/include/ndn-cpp/security/key-chain.hpp
+++ b/include/ndn-cpp/security/key-chain.hpp
@@ -218,6 +218,28 @@
   sign(Data& data, const Name& certificateName, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat());
   
   /**
+   * Sign the byte array using a certificate name and return a Signature object.
+   * @param buffer The byte array to be signed.
+   * @param bufferLength the length of buffer.
+   * @param certificateName The certificate name used to get the signing key and which will be put into KeyLocator.
+   * @return The Signature.
+   */
+  ptr_lib::shared_ptr<Signature> 
+  sign(const uint8_t* buffer, size_t bufferLength, const Name& certificateName);
+
+  /**
+   * Sign the byte array using a certificate name and return a Signature object.
+   * @param buffer The byte array to be signed.
+   * @param certificateName The certificate name used to get the signing key and which will be put into KeyLocator.
+   * @return The Signature.
+   */
+  ptr_lib::shared_ptr<Signature> 
+  sign(const std::vector<uint8_t>& buffer, const Name& certificateName)
+  {
+    return sign(&buffer[0], buffer.size(), certificateName);
+  }
+
+  /**
    * Wire encode the Data object, sign it and set its signature.
    * Note: the caller must make sure the timestamp is correct, for example with 
    * data.getMetaInfo().setTimestampMilliseconds(time(NULL) * 1000.0).
@@ -229,6 +251,28 @@
   signByIdentity(Data& data, const Name& identityName = Name(), WireFormat& wireFormat = *WireFormat::getDefaultWireFormat());
 
   /**
+   * Sign the byte array using an identity name and return a Signature object.
+   * @param buffer The byte array to be signed.
+   * @param bufferLength the length of buffer.
+   * @param identityName The identity name.
+   * @return The Signature.
+   */
+  ptr_lib::shared_ptr<Signature> 
+  signByIdentity(const uint8_t* buffer, size_t bufferLength, const Name& identityName);
+
+  /**
+   * Sign the byte array using an identity name and return a Signature object.
+   * @param buffer The byte array to be signed.
+   * @param identityName The identity name.
+   * @return The Signature.
+   */
+  ptr_lib::shared_ptr<Signature> 
+  signByIdentity(const std::vector<uint8_t>& buffer, const Name& identityName)
+  {
+    return signByIdentity(&buffer[0], buffer.size(), identityName);
+  }
+
+  /**
    * Check the signature on the Data object and call either onVerify or onVerifyFailed. 
    * We use callback functions because verify may fetch information to check the signature.
    * @param data The Data object with the signature to check. It is an error if data does not have a wireEncoding.