security: Rename KeyChain::signInTpm to KeyChain::signDataInTpm, and make it priviate.
This method is only used internally by KeyChain, and its name conflicts with a virtual method of Tpm.
Change-Id: I9f2f75d8451f93ba5264f6108a708a01a4d354eb
diff --git a/include/ndn-cpp-dev/security/key-chain.hpp b/include/ndn-cpp-dev/security/key-chain.hpp
index 629d244..21898e6 100644
--- a/include/ndn-cpp-dev/security/key-chain.hpp
+++ b/include/ndn-cpp-dev/security/key-chain.hpp
@@ -159,22 +159,6 @@
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)
{
@@ -206,7 +190,7 @@
data.setSignature(signature);
// For temporary usage, we support RSA + SHA256 only, but will support more.
- signInTpm(data, cert->getPublicKeyName(), DIGEST_ALGORITHM_SHA256);
+ signDataInTpm(data, cert->getPublicKeyName(), DIGEST_ALGORITHM_SHA256);
}
void
@@ -217,7 +201,7 @@
data.setSignature(signature);
// For temporary usage, we support RSA + SHA256 only, but will support more.
- signInTpm(data, certificate.getPublicKeyName(), DIGEST_ALGORITHM_SHA256);
+ signDataInTpm(data, certificate.getPublicKeyName(), DIGEST_ALGORITHM_SHA256);
}
/**
@@ -318,7 +302,7 @@
cert.setSignature(signature);
// For temporary usage, we support RSA + SHA256 only, but will support more.
- signInTpm(cert, cert.getPublicKeyName(), DIGEST_ALGORITHM_SHA256);
+ signDataInTpm(cert, cert.getPublicKeyName(), DIGEST_ALGORITHM_SHA256);
}
@@ -365,6 +349,22 @@
return result;
}
+ /**
+ * Fetch the private key for keyName and sign the data, and set the signature block of the data packet.
+ * @param data Reference to the input data packet.
+ * @param keyName The name of the signing key.
+ * @param digestAlgorithm the digest algorithm.
+ * @throws Tpm::Error
+ */
+ void
+ signDataInTpm(Data &data, const Name& keyName, DigestAlgorithm digestAlgorithm)
+ {
+ data.setSignatureValue
+ (Tpm::signInTpm(data.wireEncode().value(),
+ data.wireEncode().value_size() - data.getSignature().getValue().size(),
+ keyName, digestAlgorithm));
+ }
+
};
}