security: New generalized signing API in KeyChain
A new API in KeyChain introduces a general interface to sign interest
and data packets and supply necessary signing information, such as
signing identity name, signing key name, or signing certificate name.
In addition, the supplied signing information can include additional
information that signer wants to include in the SignatureInfo of the
signed packet.
Old sign methods `KeyChain::sign(Packet, Name)`, `KeyChain::sign(uint8_t*, size_t, Name)`,
`KeyChain::signByIdentity(Packet, Name)`, `KeyChain::signByIdentity(uint8_t*, size_t, Name)`,
`KeyChain::signWithSha256(Data)`, and `KeyChain::signWithSha256(Interest)`
are now deprecated and will be removed in the next release.
Change-Id: I086e6c6522f70bcb7799e7dfc4cc4b2f8a3816a0
Refs: #2871, #1705
diff --git a/src/util/command-interest-generator.hpp b/src/util/command-interest-generator.hpp
index 651a19b..fb4ed47 100644
--- a/src/util/command-interest-generator.hpp
+++ b/src/util/command-interest-generator.hpp
@@ -71,13 +71,16 @@
if (certificateName.empty())
m_keyChain.sign(interest);
else
- m_keyChain.sign(interest, certificateName);
+ m_keyChain.sign(interest,
+ security::SigningInfo(security::SigningInfo::SIGNER_TYPE_CERT,
+ certificateName));
}
inline void
CommandInterestGenerator::generateWithIdentity(Interest& interest, const Name& identity)
{
- m_keyChain.signByIdentity(interest, identity);
+ m_keyChain.sign(interest,
+ security::SigningInfo(security::SigningInfo::SIGNER_TYPE_ID, identity));
}
diff --git a/src/util/dummy-client-face.cpp b/src/util/dummy-client-face.cpp
index 24348e9..cfa28a5 100644
--- a/src/util/dummy-client-face.cpp
+++ b/src/util/dummy-client-face.cpp
@@ -158,7 +158,7 @@
data->setContent(resp.wireEncode());
KeyChain keyChain;
- keyChain.signWithSha256(*data);
+ keyChain.sign(*data, security::SigningInfo(security::SigningInfo::SIGNER_TYPE_SHA256));
this->getIoService().post([this, data] { this->receive(*data); });
});
diff --git a/src/util/notification-stream.hpp b/src/util/notification-stream.hpp
index 991a885..3b042a5 100644
--- a/src/util/notification-stream.hpp
+++ b/src/util/notification-stream.hpp
@@ -56,9 +56,6 @@
namespace ndn {
-class Face;
-class KeyChain;
-
namespace util {
/** \brief provides a publisher of Notification Stream