Change sign to take a pointer to a byte array instead of a Blob, to avoid copying buffers.
diff --git a/ndn-cpp/security/identity/private-key-storage.cpp b/ndn-cpp/security/identity/private-key-storage.cpp
index 8ed3cb3..0844195 100644
--- a/ndn-cpp/security/identity/private-key-storage.cpp
+++ b/ndn-cpp/security/identity/private-key-storage.cpp
@@ -56,14 +56,14 @@
// TODO: Move to subclass.
Blob
-PrivateKeyStorage::sign(const Blob& blob, const string& keyName, DigestAlgorithm digestAlgorithm)
+PrivateKeyStorage::sign(const unsigned char *data, unsigned int dataLength, const string& keyName, DigestAlgorithm digestAlgorithm)
{
#if 1
if (digestAlgorithm != DIGEST_ALGORITHM_SHA256)
return Blob();
unsigned char digest[SHA256_DIGEST_LENGTH];
- ndn_digestSha256(blob.buf(), blob.size(), digest);
+ ndn_digestSha256(data, dataLength, digest);
// TODO: use RSA_size to get the proper size of the signature buffer.
unsigned char signatureBits[1000];
unsigned int signatureBitsLength;
diff --git a/ndn-cpp/security/identity/private-key-storage.hpp b/ndn-cpp/security/identity/private-key-storage.hpp
index bb79753..9dd32a9 100644
--- a/ndn-cpp/security/identity/private-key-storage.hpp
+++ b/ndn-cpp/security/identity/private-key-storage.hpp
@@ -40,14 +40,15 @@
#endif
/**
- * Sign data blob.
- * @param blob The blob to be signed.
+ * Fetch the private key for keyName and sign the data, returning a signature Blob.
+ * @param data Pointer to the input byte array.
+ * @param dataLength The length of data.
* @param keyName The name of the signing key.
* @param digestAlgorithm the digest algorithm.
* @return The signature, or 0 if signing fails.
*/
virtual Blob
- sign(const Blob& blob, const std::string& keyName, DigestAlgorithm digestAlgorithm = DIGEST_ALGORITHM_SHA256);
+ sign(const unsigned char *data, unsigned int dataLength, const std::string& keyName, DigestAlgorithm digestAlgorithm = DIGEST_ALGORITHM_SHA256);
#if 0
/**