security: rename SignatureSha256 to DigestSha256
Change-Id: Idabb95222d86e2541372593698ed9754156a5df2
diff --git a/src/security/digest-sha256.hpp b/src/security/digest-sha256.hpp
new file mode 100644
index 0000000..19833e1
--- /dev/null
+++ b/src/security/digest-sha256.hpp
@@ -0,0 +1,65 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2014 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#ifndef NDN_SECURITY_DIGEST_SHA256_HPP
+#define NDN_SECURITY_DIGEST_SHA256_HPP
+
+#include "../data.hpp"
+#include "../encoding/tlv.hpp"
+
+namespace ndn {
+
+/**
+ * Represent a SHA256 digest.
+ */
+class DigestSha256 : public Signature
+{
+public:
+ class Error : public Signature::Error
+ {
+ public:
+ explicit
+ Error(const std::string& what)
+ : Signature::Error(what)
+ {
+ }
+ };
+
+ DigestSha256()
+ {
+ m_info = Block(Tlv::SignatureInfo);
+
+ m_type = Signature::Sha256;
+ m_info.push_back(nonNegativeIntegerBlock(Tlv::SignatureType, Tlv::DigestSha256));
+ }
+
+ explicit
+ DigestSha256(const Signature& signature)
+ : Signature(signature)
+ {
+ if (getType() != Signature::Sha256)
+ throw Error("Incorrect signature type");
+ }
+};
+
+} // namespace ndn
+
+#endif //NDN_SECURITY_DIGEST_SHA256_HPP
diff --git a/src/security/key-chain.hpp b/src/security/key-chain.hpp
index 00a2e6b..191eeda 100644
--- a/src/security/key-chain.hpp
+++ b/src/security/key-chain.hpp
@@ -28,7 +28,7 @@
#include "sec-tpm.hpp"
#include "secured-bag.hpp"
#include "signature-sha256-with-rsa.hpp"
-#include "signature-sha256.hpp"
+#include "digest-sha256.hpp"
#include "../interest.hpp"
#include "../util/crypto.hpp"
@@ -808,7 +808,7 @@
inline void
KeyChain::signWithSha256(Data& data)
{
- SignatureSha256 sig;
+ DigestSha256 sig;
data.setSignature(sig);
Block sigValue(Tlv::SignatureValue,
diff --git a/src/security/signature-sha256.hpp b/src/security/signature-sha256.hpp
index 28fbc04..e04ba0f 100644
--- a/src/security/signature-sha256.hpp
+++ b/src/security/signature-sha256.hpp
@@ -22,43 +22,9 @@
#ifndef NDN_SECURITY_SIGNATURE_SHA256_HPP
#define NDN_SECURITY_SIGNATURE_SHA256_HPP
-#include "../data.hpp"
-#include "../encoding/tlv.hpp"
+#include "digest-sha256.hpp"
-namespace ndn {
-
-/**
- * Representing of SHA256 signature in a data packet.
- */
-class SignatureSha256 : public Signature
-{
-public:
- class Error : public Signature::Error
- {
- public:
- explicit
- Error(const std::string& what)
- : Signature::Error(what)
- {
- }
- };
-
- SignatureSha256()
- {
- m_info = Block(Tlv::SignatureInfo);
-
- m_type = Signature::Sha256;
- m_info.push_back(nonNegativeIntegerBlock(Tlv::SignatureType, Tlv::DigestSha256));
- }
-
- SignatureSha256(const Signature& signature)
- : Signature(signature)
- {
- if (getType() != Signature::Sha256)
- throw Error("Incorrect signature type");
- }
-};
-
-} // namespace ndn
+///@deprecated
+typedef DigestSha256 SignatureSha256;
#endif //NDN_SECURITY_SIGNATURE_SHA256_HPP
diff --git a/src/security/validator-config.hpp b/src/security/validator-config.hpp
index a55797a..f768efc 100644
--- a/src/security/validator-config.hpp
+++ b/src/security/validator-config.hpp
@@ -268,7 +268,7 @@
{
if (signature.getType() == Signature::Sha256)
{
- SignatureSha256 sigSha256(signature);
+ DigestSha256 sigSha256(signature);
if (verifySignature(packet, sigSha256))
return onValidated(packet.shared_from_this());
diff --git a/src/security/validator.cpp b/src/security/validator.cpp
index 4962779..29a4801 100644
--- a/src/security/validator.cpp
+++ b/src/security/validator.cpp
@@ -260,7 +260,7 @@
}
bool
-Validator::verifySignature(const uint8_t* buf, const size_t size, const SignatureSha256& sig)
+Validator::verifySignature(const uint8_t* buf, const size_t size, const DigestSha256& sig)
{
try
{
diff --git a/src/security/validator.hpp b/src/security/validator.hpp
index 0017102..5d66367 100644
--- a/src/security/validator.hpp
+++ b/src/security/validator.hpp
@@ -31,7 +31,7 @@
#include "../face.hpp"
#include "public-key.hpp"
#include "signature-sha256-with-rsa.hpp"
-#include "signature-sha256.hpp"
+#include "digest-sha256.hpp"
#include "validation-request.hpp"
namespace ndn {
@@ -157,7 +157,7 @@
/// @brief Verify the data against the SHA256 signature.
static bool
- verifySignature(const Data& data, const SignatureSha256& sig)
+ verifySignature(const Data& data, const DigestSha256& sig)
{
return verifySignature(data.wireEncode().value(),
data.wireEncode().value_size() -
@@ -170,7 +170,7 @@
* (Note the signature covers the first n-2 name components).
*/
static bool
- verifySignature(const Interest& interest, const SignatureSha256& sig)
+ verifySignature(const Interest& interest, const DigestSha256& sig)
{
if (interest.getName().size() < 2)
return false;
@@ -184,14 +184,14 @@
/// @brief Verify the blob against the SHA256 signature.
static bool
- verifySignature(const Buffer& blob, const SignatureSha256& sig)
+ verifySignature(const Buffer& blob, const DigestSha256& sig)
{
return verifySignature (blob.buf(), blob.size(), sig);
}
/// @brief Verify the blob against the SHA256 signature.
static bool
- verifySignature(const uint8_t* buf, const size_t size, const SignatureSha256& sig);
+ verifySignature(const uint8_t* buf, const size_t size, const DigestSha256& sig);
protected:
/**