security: KeyChain: implement sign for buffers.
diff --git a/ndn-cpp/security/identity/identity-manager.cpp b/ndn-cpp/security/identity/identity-manager.cpp
index c925f8f..eb9966e 100644
--- a/ndn-cpp/security/identity/identity-manager.cpp
+++ b/ndn-cpp/security/identity/identity-manager.cpp
@@ -166,13 +166,13 @@
 }
   
 ptr_lib::shared_ptr<Signature>
-IdentityManager::signByCertificate(const uint8_t* data, size_t dataLength, const Name& certificateName)
+IdentityManager::signByCertificate(const uint8_t* buffer, size_t bufferLength, const Name& certificateName)
 {    
   Name keyName = identityStorage_->getKeyNameForCertificate(certificateName);
   
   shared_ptr<PublicKey> publicKey = privateKeyStorage_->getPublicKey(keyName.toUri());
 
-  Blob sigBits = privateKeyStorage_->sign(data, dataLength, keyName.toUri());
+  Blob sigBits = privateKeyStorage_->sign(buffer, bufferLength, keyName.toUri());
 
   //For temporary usage, we support RSA + SHA256 only, but will support more.
   shared_ptr<Sha256WithRsaSignature> sha256Sig(new Sha256WithRsaSignature());
diff --git a/ndn-cpp/security/key-chain.cpp b/ndn-cpp/security/key-chain.cpp
index 3fc3f77..c17960d 100644
--- a/ndn-cpp/security/key-chain.cpp
+++ b/ndn-cpp/security/key-chain.cpp
@@ -104,6 +104,12 @@
   identityManager_->signByCertificate(data, certificateName, wireFormat);
 }
 
+shared_ptr<Signature> 
+KeyChain::sign(const uint8_t* buffer, size_t bufferLength, const Name& certificateName)
+{
+  return identityManager_->signByCertificate(buffer, bufferLength, certificateName);
+}
+
 void 
 KeyChain::signByIdentity(Data& data, const Name& identityName, WireFormat& wireFormat)
 {
@@ -128,6 +134,17 @@
   identityManager_->signByCertificate(data, signingCertificateName);  
 }
 
+  shared_ptr<Signature> 
+  KeyChain::signByIdentity(const uint8_t* buffer, size_t bufferLength, const Name& identityName)
+  {
+    Name signingCertificateName = identityManager_->getDefaultCertificateNameForIdentity(identityName);
+    
+    if (signingCertificateName.size() == 0)
+      throw SecurityException("No qualified certificate name found!");
+
+    return identityManager_->signByCertificate(buffer, bufferLength, signingCertificateName);
+  }
+
 void
 KeyChain::verifyData
   (const shared_ptr<Data>& data, const OnVerified& onVerified, const OnVerifyFailed& onVerifyFailed, int stepCount)