Rename signed fields to signed portion
diff --git a/ndn-cpp/c/encoding/binary-xml-data.c b/ndn-cpp/c/encoding/binary-xml-data.c
index 16a1497..de34f9d 100644
--- a/ndn-cpp/c/encoding/binary-xml-data.c
+++ b/ndn-cpp/c/encoding/binary-xml-data.c
@@ -173,7 +173,7 @@
 }
 
 ndn_Error ndn_encodeBinaryXmlData
-  (struct ndn_Data *data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset, struct ndn_BinaryXmlEncoder *encoder)
+  (struct ndn_Data *data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset, struct ndn_BinaryXmlEncoder *encoder)
 {
   ndn_Error error;
   if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_ContentObject)))
@@ -182,7 +182,7 @@
   if ((error = encodeSignature(&data->signature, encoder)))
     return error;
   
-  *signedFieldsBeginOffset = encoder->offset;
+  *signedPortionBeginOffset = encoder->offset;
 
   if ((error = ndn_encodeBinaryXmlName(&data->name, encoder)))
     return error;
@@ -194,7 +194,7 @@
       (encoder, ndn_BinaryXml_DTag_Content, data->content, data->contentLength)))
     return error;
 
-  *signedFieldsEndOffset = encoder->offset;
+  *signedPortionEndOffset = encoder->offset;
 
   if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
     return error;
@@ -203,7 +203,7 @@
 }
 
 ndn_Error ndn_decodeBinaryXmlData
-  (struct ndn_Data *data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset, struct ndn_BinaryXmlDecoder *decoder)
+  (struct ndn_Data *data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset, struct ndn_BinaryXmlDecoder *decoder)
 {
   ndn_Error error;
   if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_ContentObject)))
@@ -219,7 +219,7 @@
   else
     ndn_Signature_initialize(&data->signature, data->signature.keyLocator.keyName.components, data->signature.keyLocator.keyName.maxComponents);
   
-  *signedFieldsBeginOffset = decoder->offset;
+  *signedPortionBeginOffset = decoder->offset;
   
   if ((error = ndn_decodeBinaryXmlName(&data->name, decoder)))
     return error;
@@ -238,7 +238,7 @@
       (decoder, ndn_BinaryXml_DTag_Content, 1, &data->content, &data->contentLength)))
     return error; 
   
-  *signedFieldsEndOffset = decoder->offset;
+  *signedPortionEndOffset = decoder->offset;
 
   if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder)))
     return error;
diff --git a/ndn-cpp/c/encoding/binary-xml-data.h b/ndn-cpp/c/encoding/binary-xml-data.h
index 3168cb1..caf9e35 100644
--- a/ndn-cpp/c/encoding/binary-xml-data.h
+++ b/ndn-cpp/c/encoding/binary-xml-data.h
@@ -19,28 +19,28 @@
 /**
  * Encode the data packet as binary XML.
  * @param data Pointer to the data object to encode.
- * @param signedFieldsBeginOffset Return the offset in the encoding of the beginning of the fields which are signed.
+ * @param signedPortionBeginOffset Return the offset in the encoding of the beginning of the signed portion.
  * If you are not encoding in order to sign, you can ignore this returned value.
- * @param signedFieldsEndOffset Return the offset in the encoding of the end of the fields which are signed.
+ * @param signedPortionEndOffset Return the offset in the encoding of the end of the signed portion.
  * If you are not encoding in order to sign, you can ignore this returned value.
  * @param encoder Pointer to the ndn_BinaryXmlEncoder struct which receives the encoding. 
  * @return 0 for success, else an error code.
  */
 ndn_Error ndn_encodeBinaryXmlData
-  (struct ndn_Data *data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset, struct ndn_BinaryXmlEncoder *encoder);
+  (struct ndn_Data *data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset, struct ndn_BinaryXmlEncoder *encoder);
 
 /**
  * Decode the data packet as binary XML and set the fields in the data object.
  * @param data Pointer to the data object whose fields are updated.
- * @param signedFieldsBeginOffset Return the offset in the input buffer of the beginning of the fields which are signed.
+ * @param signedPortionBeginOffset Return the offset in the input buffer of the beginning of the signed portion.
  * If you are not decoding in order to verify, you can ignore this returned value.
- * @param signedFieldsEndOffset Return the offset in the input buffer of the end of the fields which are signed.
+ * @param signedPortionEndOffset Return the offset in the input buffer of the end of the signed portion.
  * If you are not decoding in order to verify, you can ignore this returned value.
  * @param decoder Pointer to the ndn_BinaryXmlDecoder struct which has been initialized with the buffer to decode. 
  * @return 0 for success, else an error code.
  */
 ndn_Error ndn_decodeBinaryXmlData
-  (struct ndn_Data *data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset, struct ndn_BinaryXmlDecoder *decoder);
+  (struct ndn_Data *data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset, struct ndn_BinaryXmlDecoder *decoder);
 
 #ifdef __cplusplus
 }
diff --git a/ndn-cpp/encoding/binary-xml-wire-format.cpp b/ndn-cpp/encoding/binary-xml-wire-format.cpp
index 55a6d77..930f89d 100644
--- a/ndn-cpp/encoding/binary-xml-wire-format.cpp
+++ b/ndn-cpp/encoding/binary-xml-wire-format.cpp
@@ -60,7 +60,7 @@
   interest.set(interestStruct);
 }
 
-Blob BinaryXmlWireFormat::encodeData(const Data& data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset) 
+Blob BinaryXmlWireFormat::encodeData(const Data& data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset) 
 {
   struct ndn_NameComponent nameComponents[100];
   struct ndn_NameComponent keyNameComponents[100];
@@ -72,14 +72,14 @@
 
   BinaryXmlEncoder encoder;
   ndn_Error error;
-  if ((error = ndn_encodeBinaryXmlData(&dataStruct, signedFieldsBeginOffset, signedFieldsEndOffset, &encoder)))
+  if ((error = ndn_encodeBinaryXmlData(&dataStruct, signedPortionBeginOffset, signedPortionEndOffset, &encoder)))
     throw std::runtime_error(ndn_getErrorString(error));
      
   return encoder.getOutput();
 }
 
 void BinaryXmlWireFormat::decodeData
-  (Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset)
+  (Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset)
 {
   struct ndn_NameComponent nameComponents[100];
   struct ndn_NameComponent keyNameComponents[100];
@@ -90,7 +90,7 @@
     
   BinaryXmlDecoder decoder(input, inputLength);  
   ndn_Error error;
-  if ((error = ndn_decodeBinaryXmlData(&dataStruct, signedFieldsBeginOffset, signedFieldsEndOffset, &decoder)))
+  if ((error = ndn_decodeBinaryXmlData(&dataStruct, signedPortionBeginOffset, signedPortionEndOffset, &decoder)))
     throw std::runtime_error(ndn_getErrorString(error));
 
   data.set(dataStruct);
diff --git a/ndn-cpp/encoding/binary-xml-wire-format.hpp b/ndn-cpp/encoding/binary-xml-wire-format.hpp
index 0f11aa4..ebb7412 100644
--- a/ndn-cpp/encoding/binary-xml-wire-format.hpp
+++ b/ndn-cpp/encoding/binary-xml-wire-format.hpp
@@ -35,29 +35,29 @@
   /**
    * Encode data with binary XML and return the encoding.
    * @param data The Data object to encode.
-   * @param signedFieldsBeginOffset Return the offset in the encoding of the beginning of the fields which are signed.
+   * @param signedPortionBeginOffset Return the offset in the encoding of the beginning of the signed portion.
    * If you are not encoding in order to sign, you can call encodeData(const Data& data) to ignore this returned value.
-   * @param signedFieldsEndOffset Return the offset in the encoding of the end of the fields which are signed.
+   * @param signedPortionEndOffset Return the offset in the encoding of the end of the signed portion.
    * If you are not encoding in order to sign, you can call encodeData(const Data& data) to ignore this returned value.
    * @return A Blob containing the encoding.
    */
   virtual Blob encodeData
-    (const Data& data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset);
+    (const Data& data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset);
   
   /**
    * Decode input as a data packet in binary XML and set the fields in the data object.
    * @param data The Data object whose fields are updated.
    * @param input A pointer to the input buffer to decode.
    * @param inputLength The number of bytes in input.
-   * @param signedFieldsBeginOffset Return the offset in the input buffer of the beginning of the fields which are signed.
+   * @param signedPortionBeginOffset Return the offset in the input buffer of the beginning of the signed portion.
    * If you are not decoding in order to verify, you can call 
    * decodeData(Data& data, const unsigned char *input, unsigned int inputLength) to ignore this returned value.
-   * @param signedFieldsEndOffset Return the offset in the input buffer of the end of the fields which are signed.
+   * @param signedPortionEndOffset Return the offset in the input buffer of the end of the signed portion.
    * If you are not decoding in order to verify, you can call 
    * decodeData(Data& data, const unsigned char *input, unsigned int inputLength) to ignore this returned value.
    */  
   virtual void decodeData
-    (Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset);
+    (Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset);
 
   /**
    * Encode forwardingEntry in binary XML and return the encoding. 
diff --git a/ndn-cpp/encoding/wire-format.cpp b/ndn-cpp/encoding/wire-format.cpp
index 450f3e0..fc39a7b 100644
--- a/ndn-cpp/encoding/wire-format.cpp
+++ b/ndn-cpp/encoding/wire-format.cpp
@@ -36,12 +36,12 @@
   throw logic_error("unimplemented");
 }
 
-Blob WireFormat::encodeData(const Data& data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset) 
+Blob WireFormat::encodeData(const Data& data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset) 
 {
   throw logic_error("unimplemented");
 }
 void WireFormat::decodeData
-  (Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset) 
+  (Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset) 
 {
   throw logic_error("unimplemented");
 }
diff --git a/ndn-cpp/encoding/wire-format.hpp b/ndn-cpp/encoding/wire-format.hpp
index e6a19f5..a892659 100644
--- a/ndn-cpp/encoding/wire-format.hpp
+++ b/ndn-cpp/encoding/wire-format.hpp
@@ -38,15 +38,15 @@
   /**
    * Encode data and return the encoding.  Your derived class should override.
    * @param data The Data object to encode.
-   * @param signedFieldsBeginOffset Return the offset in the encoding of the beginning of the fields which are signed.
+   * @param signedPortionBeginOffset Return the offset in the encoding of the beginning of the signed portion.
    * If you are not encoding in order to sign, you can call encodeData(const Data& data) to ignore this returned value.
-   * @param signedFieldsEndOffset Return the offset in the encoding of the end of the fields which are signed.
+   * @param signedPortionEndOffset Return the offset in the encoding of the end of the signed portion.
    * If you are not encoding in order to sign, you can call encodeData(const Data& data) to ignore this returned value.
    * @return A Blob containing the encoding.
    * @throw logic_error for unimplemented if the derived class does not override.
    */
   virtual Blob encodeData
-    (const Data& data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset);
+    (const Data& data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset);
 
   /**
    * Encode data and return the encoding.
@@ -65,16 +65,16 @@
    * @param data The Data object whose fields are updated.
    * @param input A pointer to the input buffer to decode.
    * @param inputLength The number of bytes in input.
-   * @param signedFieldsBeginOffset Return the offset in the input buffer of the beginning of the fields which are signed.
+   * @param signedPortionBeginOffset Return the offset in the input buffer of the beginning of the signed portion.
    * If you are not decoding in order to verify, you can call 
    * decodeData(Data& data, const unsigned char *input, unsigned int inputLength) to ignore this returned value.
-   * @param signedFieldsEndOffset Return the offset in the input buffer of the end of the fields which are signed.
+   * @param signedPortionEndOffset Return the offset in the input buffer of the end of the signed portion.
    * If you are not decoding in order to verify, you can call 
    * decodeData(Data& data, const unsigned char *input, unsigned int inputLength) to ignore this returned value.
    * @throw logic_error for unimplemented if the derived class does not override.
    */  
   virtual void decodeData
-    (Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset);
+    (Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset);
 
   void decodeData(Data& data, const unsigned char *input, unsigned int inputLength)
   {
diff --git a/ndn-cpp/security/key-chain.cpp b/ndn-cpp/security/key-chain.cpp
index 8549f03..1a8d12b 100644
--- a/ndn-cpp/security/key-chain.cpp
+++ b/ndn-cpp/security/key-chain.cpp
@@ -62,16 +62,16 @@
 };
 
 /**
- * Encode the fields of the Data object and set digest to the sha-256 digest.
+ * Encode the fields of the Data object and set digest to the sha-256 digest of the signed portion.
  * @param data The Data object with the fields to digest.
  * @param digest A pointer to a buffer of size SHA256_DIGEST_LENGTH to receive the data.
  */
-static void digestDataFieldsSha256(const Data& data, WireFormat& wireFormat, unsigned char *digest)
+static void dataSignedPortionSha256(const Data& data, WireFormat& wireFormat, unsigned char *digest)
 {
-  unsigned int signedFieldsBeginOffset, signedFieldsEndOffset;
-  Blob encoding = wireFormat.encodeData(data, &signedFieldsBeginOffset, &signedFieldsEndOffset);
+  unsigned int signedPortionBeginOffset, signedPortionEndOffset;
+  Blob encoding = wireFormat.encodeData(data, &signedPortionBeginOffset, &signedPortionEndOffset);
   
-  ndn_digestSha256(encoding.buf() + signedFieldsBeginOffset, signedFieldsEndOffset - signedFieldsBeginOffset, digest);
+  ndn_digestSha256(encoding.buf() + signedPortionBeginOffset, signedPortionEndOffset - signedPortionBeginOffset, digest);
 }
 
 void KeyChain::sign
@@ -89,8 +89,8 @@
   signature->getKeyLocator().setKeyData(publicKeyDer, publicKeyDerLength);
 
   // Sign the fields.
-  unsigned char dataFieldsDigest[SHA256_DIGEST_LENGTH];
-  digestDataFieldsSha256(data, wireFormat, dataFieldsDigest);
+  unsigned char signedPortionDigest[SHA256_DIGEST_LENGTH];
+  dataSignedPortionSha256(data, wireFormat, signedPortionDigest);
   // TODO: use RSA_size to get the proper size of the signature buffer.
   unsigned char signatureBits[1000];
   unsigned int signatureBitsLength;
@@ -99,7 +99,7 @@
   RSA *privateKey = d2i_RSAPrivateKey(NULL, &derPointer, privateKeyDerLength);
   if (!privateKey)
     throw std::runtime_error("Error decoding private key in d2i_RSAPrivateKey");
-  int success = RSA_sign(NID_sha256, dataFieldsDigest, sizeof(dataFieldsDigest), signatureBits, &signatureBitsLength, privateKey);
+  int success = RSA_sign(NID_sha256, signedPortionDigest, sizeof(signedPortionDigest), signatureBits, &signatureBitsLength, privateKey);
   // Free the private key before checking for success.
   RSA_free(privateKey);
   if (!success)
@@ -117,8 +117,8 @@
 {
   // Decode the data packet and digest the data fields.
   Data data;
-  unsigned int signedFieldsBeginOffset, signedFieldsEndOffset;
-  wireFormat.decodeData(data, input, inputLength, &signedFieldsBeginOffset, &signedFieldsEndOffset);
+  unsigned int signedPortionBeginOffset, signedPortionEndOffset;
+  wireFormat.decodeData(data, input, inputLength, &signedPortionBeginOffset, &signedPortionEndOffset);
   Sha256WithRsaSignature *signature = dynamic_cast<Sha256WithRsaSignature*>(data.getSignature());
   if (!signature)
     throw std::runtime_error("signature is not Sha256WithRsaSignature");
@@ -126,8 +126,8 @@
   if (signature->getDigestAlgorithm().size() != 0)
     // TODO: Allow a non-default digest algorithm.
     throw std::runtime_error("Cannot verify a data packet with a non-default digest algorithm");
-  unsigned char dataFieldsDigest[SHA256_DIGEST_LENGTH];
-  ndn_digestSha256(input + signedFieldsBeginOffset, signedFieldsEndOffset - signedFieldsBeginOffset, dataFieldsDigest);
+  unsigned char signedPortionDigest[SHA256_DIGEST_LENGTH];
+  ndn_digestSha256(input + signedPortionBeginOffset, signedPortionEndOffset - signedPortionBeginOffset, signedPortionDigest);
   
   // Find the public key.
   const unsigned char *publicKeyDer;
@@ -140,14 +140,14 @@
     // Can't find a public key.
     return false;
 
-  // Verify the dataFieldsDigest.
+  // Verify the signedPortionDigest.
   // Use a temporary pointer since d2i updates it.
   const unsigned char *derPointer = publicKeyDer;
   RSA *publicKey = d2i_RSA_PUBKEY(NULL, &derPointer, publicKeyDerLength);
   if (!publicKey)
     throw std::runtime_error("Error decoding public key in d2i_RSAPublicKey");
   int success = RSA_verify
-    (NID_sha256, dataFieldsDigest, sizeof(dataFieldsDigest), (unsigned char *)signature->getSignature().buf(), 
+    (NID_sha256, signedPortionDigest, sizeof(signedPortionDigest), (unsigned char *)signature->getSignature().buf(), 
      signature->getSignature().size(), publicKey);
   // Free the public key before checking for success.
   RSA_free(publicKey);