security: Moving signInTpm(Data& data, ...) from SecTpm to KeyChain.

The method is no longer a pure virtual method, and sub-classes of SecTpm do not have to implement this one.
Although the method is now a part of KeyChain, but it is still named as signInTpm to be distinguished from the other sign methods of KeyChain.
signInTpm takes the public key name as argument, well sign methods take certificate name as argument.

Change-Id: I6a1546f760a7446341a152bb2f716032f2b7bb58
diff --git a/include/ndn-cpp-dev/security/key-chain.hpp b/include/ndn-cpp-dev/security/key-chain.hpp
index fffa05d..c5df5db 100644
--- a/include/ndn-cpp-dev/security/key-chain.hpp
+++ b/include/ndn-cpp-dev/security/key-chain.hpp
@@ -153,6 +153,22 @@
     return certificate;
   }
 
+  /**
+   * Fetch the private key for keyName and sign the data, and set the signature block of the data packet.
+   * Throw Error if signing fails.
+   * @param data Reference to the input data packet.
+   * @param keyName The name of the signing key.
+   * @param digestAlgorithm the digest algorithm.
+   */  
+  void
+  signInTpm(Data &data, const Name& keyName, DigestAlgorithm digestAlgorithm)
+  {
+    data.setSignatureValue
+      (Tpm::signInTpm(data.wireEncode().value(),
+                      data.wireEncode().value_size() - data.getSignature().getValue().size(),
+                      keyName, digestAlgorithm));
+  }
+
   void
   sign(Data &data)
   {
@@ -184,7 +200,7 @@
     data.setSignature(signature);
 
     // For temporary usage, we support RSA + SHA256 only, but will support more.
-    Tpm::signInTpm(data, cert->getPublicKeyName(), DIGEST_ALGORITHM_SHA256);
+    signInTpm(data, cert->getPublicKeyName(), DIGEST_ALGORITHM_SHA256);
   }
 
   void
@@ -195,7 +211,7 @@
     data.setSignature(signature);
 
     // For temporary usage, we support RSA + SHA256 only, but will support more.
-    Tpm::signInTpm(data, certificate.getPublicKeyName(), DIGEST_ALGORITHM_SHA256);
+    signInTpm(data, certificate.getPublicKeyName(), DIGEST_ALGORITHM_SHA256);
   }
   
   /**
@@ -296,7 +312,7 @@
     cert.setSignature(signature);
 
     // For temporary usage, we support RSA + SHA256 only, but will support more.
-    Tpm::signInTpm(cert, cert.getPublicKeyName(), DIGEST_ALGORITHM_SHA256);
+    signInTpm(cert, cert.getPublicKeyName(), DIGEST_ALGORITHM_SHA256);
   }