security: Add digest calculation support in transformation

Change-Id: I8326c19aff580289b5301687351d81fd74af8a83
Refs: #3009
diff --git a/src/security/detail/openssl-helper.cpp b/src/security/detail/openssl-helper.cpp
new file mode 100644
index 0000000..25fddc7
--- /dev/null
+++ b/src/security/detail/openssl-helper.cpp
@@ -0,0 +1,41 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 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.
+ */
+
+#include "openssl-helper.hpp"
+
+namespace ndn {
+namespace security {
+namespace detail {
+
+const EVP_MD*
+toDigestEvpMd(DigestAlgorithm algo)
+{
+  switch (algo) {
+  case DIGEST_ALGORITHM_SHA256:
+    return EVP_sha256();
+  default:
+    return nullptr;
+  }
+}
+
+} // namespace detail
+} // namespace security
+} // namespace ndn
diff --git a/src/security/detail/openssl-helper.hpp b/src/security/detail/openssl-helper.hpp
new file mode 100644
index 0000000..e9e5900
--- /dev/null
+++ b/src/security/detail/openssl-helper.hpp
@@ -0,0 +1,39 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 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_CXX_SECURITY_DETAIL_OPENSSL_HELPER_HPP
+#define NDN_CXX_SECURITY_DETAIL_OPENSSL_HELPER_HPP
+
+#include "../security-common.hpp"
+#include "openssl.hpp"
+
+namespace ndn {
+namespace security {
+namespace detail {
+
+const EVP_MD*
+toDigestEvpMd(DigestAlgorithm algo);
+
+} // namespace detail
+} // namespace security
+} // namespace ndn
+
+#endif // NDN_CXX_SECURITY_DETAIL_OPENSSL_HELPER_HPP
diff --git a/src/security/security-common.hpp b/src/security/security-common.hpp
index ad3f671..8edb22c 100644
--- a/src/security/security-common.hpp
+++ b/src/security/security-common.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2014 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -22,40 +22,41 @@
 #ifndef NDN_SECURITY_COMMON_HPP
 #define NDN_SECURITY_COMMON_HPP
 
+#include "../common.hpp"
+
 namespace ndn {
 
-namespace signed_interest{
+namespace signed_interest {
 
-enum {
-  POS_SIG_VALUE = -1,
-  POS_SIG_INFO = -2,
-  POS_RANDOM_VAL = -3,
-  POS_TIMESTAMP = -4,
+const ssize_t POS_SIG_VALUE = -1;
+const ssize_t POS_SIG_INFO = -2;
+const ssize_t POS_RANDOM_VAL = -3;
+const ssize_t POS_TIMESTAMP = -4;
 
-  MIN_LENGTH = 4
-};
+const size_t MIN_LENGTH = 4;
 
 } // namespace signed_interest
 
 enum KeyType {
-  KEY_TYPE_RSA   = 0,
-  KEY_TYPE_ECDSA = 1,
-  // KEY_TYPE_DSA,
-  KEY_TYPE_AES   = 128,
-  // KEY_TYPE_DES,
-  // KEY_TYPE_RC4,
-  // KEY_TYPE_RC2
-  KEY_TYPE_NULL  = 255
+  KEY_TYPE_NONE  = 0,
+  /// @deprecated use KEY_TYPE_NONE
+  KEY_TYPE_NULL = KEY_TYPE_NONE,
+
+  KEY_TYPE_RSA   = 1,
+  KEY_TYPE_ECDSA = 2,
+  KEY_TYPE_AES   = 128
 };
 
 enum KeyClass {
+  KEY_CLASS_NONE,
   KEY_CLASS_PUBLIC,
   KEY_CLASS_PRIVATE,
   KEY_CLASS_SYMMETRIC
 };
 
 enum DigestAlgorithm {
-  DIGEST_ALGORITHM_SHA256
+  DIGEST_ALGORITHM_NONE = 0,
+  DIGEST_ALGORITHM_SHA256 = 1
 };
 
 enum EncryptMode {
@@ -65,10 +66,11 @@
 };
 
 enum AclType {
+  ACL_TYPE_NONE,
   ACL_TYPE_PUBLIC,
   ACL_TYPE_PRIVATE
 };
 
 } // namespace ndn
 
-#endif
+#endif // NDN_SECURITY_COMMON_HPP
diff --git a/src/security/transform.hpp b/src/security/transform.hpp
index b9a960c..879902e 100644
--- a/src/security/transform.hpp
+++ b/src/security/transform.hpp
@@ -33,5 +33,6 @@
 #include "transform/hex-decode.hpp"
 #include "transform/base64-encode.hpp"
 #include "transform/base64-decode.hpp"
+#include "transform/digest-filter.hpp"
 
 #endif // NDN_CXX_SECURITY_TRANSFORM_HPP
diff --git a/src/security/transform/digest-filter.cpp b/src/security/transform/digest-filter.cpp
new file mode 100644
index 0000000..9fed4d2
--- /dev/null
+++ b/src/security/transform/digest-filter.cpp
@@ -0,0 +1,109 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 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.
+ */
+
+#include "digest-filter.hpp"
+#include "../../encoding/buffer.hpp"
+#include "../detail/openssl-helper.hpp"
+
+namespace ndn {
+namespace security {
+namespace transform {
+
+/**
+ * @brief The implementation class which contains the internal state of
+ *        the digest calculator which includes openssl specific structures.
+ */
+class DigestFilter::Impl
+{
+public:
+  Impl()
+    : m_md(BIO_new(BIO_f_md()))
+    , m_sink(BIO_new(BIO_s_null()))
+  {
+    BIO_push(m_md, m_sink);
+  }
+
+  ~Impl()
+  {
+    BIO_free_all(m_md);
+  }
+
+public:
+  BIO* m_md;
+  BIO* m_sink;
+};
+
+DigestFilter::DigestFilter(DigestAlgorithm algo)
+  : m_impl(new Impl)
+{
+  const EVP_MD* md = detail::toDigestEvpMd(algo);
+  if (md == nullptr) {
+    // @todo Add digest algorithm to the error message
+    BOOST_THROW_EXCEPTION(Error(getIndex(), "Unsupported digest algorithm"));
+  }
+
+  if (!BIO_set_md(m_impl->m_md, md)) {
+    // @todo Add digest algorithm to the error message
+    BOOST_THROW_EXCEPTION(Error(getIndex(), "Cannot set digest"));
+  }
+}
+
+size_t
+DigestFilter::convert(const uint8_t* buf, size_t size)
+{
+  int wLen = BIO_write(m_impl->m_md, buf, size);
+
+  if (wLen <= 0) { // fail to write data
+    if (!BIO_should_retry(m_impl->m_md)) {
+      // we haven't written everything but some error happens, and we cannot retry
+      BOOST_THROW_EXCEPTION(Error(getIndex(), "Failed to accept more input"));
+    }
+    return 0;
+  }
+  else { // update number of bytes written
+    return wLen;
+  }
+}
+
+void
+DigestFilter::finalize()
+{
+  auto buffer = make_unique<OBuffer>(EVP_MAX_MD_SIZE);
+
+  int mdLen = BIO_gets(m_impl->m_md, reinterpret_cast<char*>(&(*buffer)[0]), EVP_MAX_MD_SIZE);
+  if (mdLen <= 0)
+    BOOST_THROW_EXCEPTION(Error(getIndex(), "Failed to compute digest"));
+
+  buffer->erase(buffer->begin() + mdLen, buffer->end());
+  setOutputBuffer(std::move(buffer));
+
+  flushAllOutput();
+}
+
+unique_ptr<Transform>
+digestFilter(DigestAlgorithm algo)
+{
+  return make_unique<DigestFilter>(algo);
+}
+
+} // namespace transform
+} // namespace security
+} // namespace ndn
diff --git a/src/security/transform/digest-filter.hpp b/src/security/transform/digest-filter.hpp
new file mode 100644
index 0000000..fdd9c5b
--- /dev/null
+++ b/src/security/transform/digest-filter.hpp
@@ -0,0 +1,71 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 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_CXX_SECURITY_TRANSFORM_DIGEST_FILTER_HPP
+#define NDN_CXX_SECURITY_TRANSFORM_DIGEST_FILTER_HPP
+
+#include "transform-base.hpp"
+#include "../security-common.hpp"
+
+namespace ndn {
+namespace security {
+namespace transform {
+
+/**
+ * @brief The module to calculate digest.
+ */
+class DigestFilter : public Transform
+{
+public:
+  /**
+   * @brief Create a digest module with algorithm @p algo
+   */
+  explicit
+  DigestFilter(DigestAlgorithm algo);
+
+private:
+  /**
+   * @brief Append data @p buf into digest calculation
+   *
+   * @return The number of bytes that have been accepted
+   */
+  virtual size_t
+  convert(const uint8_t* buf, size_t size) final;
+
+  /**
+   * @brief Finalize digest calculation and write the digest into next module.
+   */
+  virtual void
+  finalize() final;
+
+private:
+  class Impl;
+  unique_ptr<Impl> m_impl;
+};
+
+unique_ptr<Transform>
+digestFilter(DigestAlgorithm algo = DIGEST_ALGORITHM_SHA256);
+
+} // namespace transform
+} // namespace security
+} // namespace ndn
+
+#endif // NDN_CXX_SECURITY_TRANSFORM_DIGEST_FILTER_HPP
diff --git a/src/security/transform/transform-base.cpp b/src/security/transform/transform-base.cpp
index 936e0ae..60e967b 100644
--- a/src/security/transform/transform-base.cpp
+++ b/src/security/transform/transform-base.cpp
@@ -92,6 +92,14 @@
 }
 
 void
+Transform::flushAllOutput()
+{
+  while (!isOutputBufferEmpty()) {
+    flushOutputBuffer();
+  }
+}
+
+void
 Transform::setOutputBuffer(unique_ptr<OBuffer> buffer)
 {
   BOOST_ASSERT(isOutputBufferEmpty());
@@ -139,9 +147,7 @@
 void
 Transform::finalize()
 {
-  while (!isOutputBufferEmpty()) {
-    flushOutputBuffer();
-  }
+  flushAllOutput();
 }
 
 Source::Source()
diff --git a/src/security/transform/transform-base.hpp b/src/security/transform/transform-base.hpp
index 5e3a72b..98faf6d 100644
--- a/src/security/transform/transform-base.hpp
+++ b/src/security/transform/transform-base.hpp
@@ -186,11 +186,20 @@
 
   /**
    * @brief Read the content from output buffer and write it into next module.
+   *
+   * It is not guaranteed that all the content in output buffer will be flushed to next module.
    */
   void
   flushOutputBuffer();
 
   /**
+   * @brief Read the all the content from output buffer and write it into next module.
+   * @post isOutputBufferEmpty() returns true.
+   */
+  void
+  flushAllOutput();
+
+  /**
    * @brief Set output buffer to @p buffer
    */
   void
diff --git a/tests/unit-tests/security/transform.t.cpp b/tests/unit-tests/security/transform.t.cpp
index ea2fa0f..f0a6b27 100644
--- a/tests/unit-tests/security/transform.t.cpp
+++ b/tests/unit-tests/security/transform.t.cpp
@@ -58,6 +58,9 @@
 
   transform::Base64Decode* base64Decode = nullptr;
   BOOST_CHECK(base64Decode == nullptr);
+
+  transform::DigestFilter* digestFilter = nullptr;
+  BOOST_CHECK(digestFilter == nullptr);
 }
 
 BOOST_AUTO_TEST_SUITE_END() // TestTransform
diff --git a/tests/unit-tests/security/transform/digest-filter.t.cpp b/tests/unit-tests/security/transform/digest-filter.t.cpp
new file mode 100644
index 0000000..f00599c
--- /dev/null
+++ b/tests/unit-tests/security/transform/digest-filter.t.cpp
@@ -0,0 +1,149 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 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.
+ */
+
+#include "security/transform/buffer-source.hpp"
+#include "security/transform/step-source.hpp"
+#include "security/transform/digest-filter.hpp"
+#include "security/transform/stream-sink.hpp"
+#include "encoding/buffer-stream.hpp"
+
+#include "boost-test.hpp"
+
+namespace ndn {
+namespace security {
+namespace transform {
+namespace tests {
+
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_AUTO_TEST_SUITE(Transform)
+BOOST_AUTO_TEST_SUITE(TestDigestFilter)
+
+BOOST_AUTO_TEST_CASE(Basic)
+{
+  uint8_t in[128] = {
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+    0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+    0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+    0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+    0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+    0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+    0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+    0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+    0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
+  };
+
+  uint8_t out[] = {
+    0x3e, 0x14, 0xfd, 0x66, 0x9a, 0x79, 0x80, 0x65,
+    0xc4, 0x0d, 0x61, 0xf8, 0x6a, 0xc7, 0x98, 0x29,
+    0xc0, 0x6b, 0x90, 0x8f, 0xbb, 0x19, 0xa0, 0x85,
+    0xf7, 0xfa, 0x7b, 0x2d, 0xd6, 0x8c, 0xd5, 0xa3
+  };
+
+  OBufferStream os;
+  bufferSource(in, sizeof(in)) >> digestFilter(DIGEST_ALGORITHM_SHA256) >> streamSink(os);
+
+  ConstBufferPtr buf = os.buf();
+  BOOST_CHECK_EQUAL_COLLECTIONS(out, out + sizeof(out), buf->begin(), buf->end());
+}
+
+BOOST_AUTO_TEST_CASE(StepByStep)
+{
+  uint8_t in[128] = {
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+    0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+    0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+    0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+    0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+    0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+    0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+    0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+    0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
+  };
+
+  uint8_t out[] = {
+    0x3e, 0x14, 0xfd, 0x66, 0x9a, 0x79, 0x80, 0x65,
+    0xc4, 0x0d, 0x61, 0xf8, 0x6a, 0xc7, 0x98, 0x29,
+    0xc0, 0x6b, 0x90, 0x8f, 0xbb, 0x19, 0xa0, 0x85,
+    0xf7, 0xfa, 0x7b, 0x2d, 0xd6, 0x8c, 0xd5, 0xa3
+  };
+
+  StepSource source;
+  OBufferStream os;
+  source >> digestFilter(DIGEST_ALGORITHM_SHA256) >> streamSink(os);
+  source.write(in, 32);
+  source.write(in + 32, 1);
+  source.write(in + 33, 2);
+  source.write(in + 35, 3);
+  source.write(in + 38, 26);
+  source.write(in + 64, 64);
+  source.end();
+
+  ConstBufferPtr buf = os.buf();
+  BOOST_CHECK_EQUAL_COLLECTIONS(out, out + sizeof(out), buf->begin(), buf->end());
+}
+
+BOOST_AUTO_TEST_CASE(EmptyInput)
+{
+  uint8_t out[] = {
+    0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14,
+    0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24,
+    0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c,
+    0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55
+  };
+
+  OBufferStream os;
+  StepSource source;
+  source >> digestFilter(DIGEST_ALGORITHM_SHA256) >> streamSink(os);
+  source.end();
+
+  ConstBufferPtr buf = os.buf();
+  BOOST_CHECK_EQUAL_COLLECTIONS(out, out + sizeof(out), buf->begin(), buf->end());
+}
+
+BOOST_AUTO_TEST_CASE(Error)
+{
+  OBufferStream os;
+  BOOST_REQUIRE_THROW(stepSource() >> digestFilter(DIGEST_ALGORITHM_NONE) >> streamSink(os),
+                      transform::Error);
+}
+
+BOOST_AUTO_TEST_SUITE_END() // TestDigestFilter
+BOOST_AUTO_TEST_SUITE_END() // Transform
+BOOST_AUTO_TEST_SUITE_END() // Security
+
+} // namespace tests
+} // namespace transform
+} // namespace security
+} // namespace ndn