diff --git a/src/security/transform.hpp b/src/security/transform.hpp
index 2d2ef2e..3f83de0 100644
--- a/src/security/transform.hpp
+++ b/src/security/transform.hpp
@@ -36,5 +36,7 @@
 #include "transform/digest-filter.hpp"
 #include "transform/hmac-filter.hpp"
 #include "transform/block-cipher.hpp"
+#include "transform/signer-filter.hpp"
+#include "transform/verifier-filter.hpp"
 
 #endif // NDN_CXX_SECURITY_TRANSFORM_HPP
diff --git a/src/security/transform/signer-filter.cpp b/src/security/transform/signer-filter.cpp
new file mode 100644
index 0000000..16d3146
--- /dev/null
+++ b/src/security/transform/signer-filter.cpp
@@ -0,0 +1,110 @@
+/* -*- 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 "signer-filter.hpp"
+#include "../../encoding/buffer.hpp"
+#include "../detail/openssl.hpp"
+
+namespace ndn {
+namespace security {
+namespace transform {
+
+class SignerFilter::Impl
+{
+public:
+  Impl(const PrivateKey& key)
+    : m_key(key)
+    , 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:
+  const PrivateKey& m_key;
+
+  BIO* m_md;
+  BIO* m_sink;
+};
+
+SignerFilter::SignerFilter(DigestAlgorithm algo, const PrivateKey& key)
+  : m_impl(new Impl(key))
+{
+  switch (algo) {
+    case DigestAlgorithm::SHA256: {
+      if (!BIO_set_md(m_impl->m_md, EVP_sha256()))
+        BOOST_THROW_EXCEPTION(Error(getIndex(), "Cannot set digest"));
+      break;
+    }
+
+    default:
+      BOOST_THROW_EXCEPTION(Error(getIndex(), "Digest algorithm is not supported"));
+  }
+}
+
+size_t
+SignerFilter::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
+SignerFilter::finalize()
+{
+  EVP_PKEY* key = reinterpret_cast<EVP_PKEY*>(m_impl->m_key.getEvpPkey());
+  auto buffer = make_unique<OBuffer>(EVP_PKEY_size(key));
+  unsigned int sigLen = 0;
+
+  EVP_MD_CTX* ctx = nullptr;
+  BIO_get_md_ctx(m_impl->m_md, &ctx);
+  EVP_SignFinal(ctx, &(*buffer)[0], &sigLen, key); // should be ok, enough space is allocated in buffer
+
+  buffer->erase(buffer->begin() + sigLen, buffer->end());
+  setOutputBuffer(std::move(buffer));
+
+  flushAllOutput();
+}
+
+unique_ptr<Transform>
+signerFilter(DigestAlgorithm algo, const PrivateKey& key)
+{
+  return make_unique<SignerFilter>(algo, key);
+}
+
+} // namespace transform
+} // namespace security
+} // namespace ndn
diff --git a/src/security/transform/signer-filter.hpp b/src/security/transform/signer-filter.hpp
new file mode 100644
index 0000000..8db11f3
--- /dev/null
+++ b/src/security/transform/signer-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_SIGNER_FILTER_HPP
+#define NDN_CXX_SECURITY_TRANSFORM_SIGNER_FILTER_HPP
+
+#include "transform-base.hpp"
+#include "private-key.hpp"
+#include "../security-common.hpp"
+
+namespace ndn {
+namespace security {
+namespace transform {
+
+/**
+ * @brief The module to sign data.
+ */
+class SignerFilter : public Transform
+{
+public:
+  /**
+   * @brief Create a signer module to generate signature using algorithm @p algo and @p key
+   */
+  SignerFilter(DigestAlgorithm algo, const PrivateKey& key);
+
+private:
+  /**
+   * @brief Write data @p buf into signer
+   *
+   * @return The number of bytes that are actually accepted
+   */
+  virtual size_t
+  convert(const uint8_t* buf, size_t size) final;
+
+  /**
+   * @brief Finalize signing and write the signature into next module.
+   */
+  virtual void
+  finalize() final;
+
+private:
+  class Impl;
+  unique_ptr<Impl> m_impl;
+};
+
+unique_ptr<Transform>
+signerFilter(DigestAlgorithm algo, const PrivateKey& key);
+
+} // namespace transform
+} // namespace security
+} // namespace ndn
+
+#endif // NDN_CXX_SECURITY_TRANSFORM_SIGNER_FILTER_HPP
diff --git a/src/security/transform/verifier-filter.cpp b/src/security/transform/verifier-filter.cpp
new file mode 100644
index 0000000..263e532
--- /dev/null
+++ b/src/security/transform/verifier-filter.cpp
@@ -0,0 +1,118 @@
+/* -*- 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 "verifier-filter.hpp"
+#include "../detail/openssl.hpp"
+
+namespace ndn {
+namespace security {
+namespace transform {
+
+class VerifierFilter::Impl
+{
+public:
+  Impl(const PublicKey& key, const uint8_t* sig, size_t sigLen)
+    : m_key(key)
+    , m_md(BIO_new(BIO_f_md()))
+    , m_sink(BIO_new(BIO_s_null()))
+    , m_sig(sig)
+    , m_sigLen(sigLen)
+  {
+    BIO_push(m_md, m_sink);
+  }
+
+  ~Impl()
+  {
+    BIO_free_all(m_sink);
+  }
+
+public:
+  const PublicKey& m_key;
+
+  BIO* m_md;
+  BIO* m_sink;
+
+  const uint8_t* m_sig;
+  size_t m_sigLen;
+};
+
+VerifierFilter::VerifierFilter(DigestAlgorithm algo, const PublicKey& key,
+                               const uint8_t* sig, size_t sigLen)
+  : m_impl(new Impl(key, sig, sigLen))
+{
+  switch (algo) {
+    case DigestAlgorithm::SHA256: {
+      if (!BIO_set_md(m_impl->m_md, EVP_sha256()))
+        BOOST_THROW_EXCEPTION(Error(getIndex(), "Cannot set digest"));
+      break;
+    }
+
+    default:
+      BOOST_THROW_EXCEPTION(Error(getIndex(), "Digest algorithm is not supported"));
+  }
+}
+
+size_t
+VerifierFilter::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
+VerifierFilter::finalize()
+{
+  EVP_PKEY* key = reinterpret_cast<EVP_PKEY*>(m_impl->m_key.getEvpPkey());
+  auto buffer = make_unique<OBuffer>(1);
+
+  EVP_MD_CTX* ctx = nullptr;
+  BIO_get_md_ctx(m_impl->m_md, &ctx);
+  int res = EVP_VerifyFinal(ctx, m_impl->m_sig, m_impl->m_sigLen, key);
+
+  if (res < 0)
+    BOOST_THROW_EXCEPTION(Error(getIndex(), "Verification error"));
+
+  (*buffer)[0] = (res != 0) ? 1 : 0;
+  setOutputBuffer(std::move(buffer));
+
+  flushAllOutput();
+}
+
+unique_ptr<Transform>
+verifierFilter(DigestAlgorithm algo, const PublicKey& key,
+               const uint8_t* sig, size_t sigLen)
+{
+  return make_unique<VerifierFilter>(algo, key, sig, sigLen);
+}
+
+} // namespace transform
+} // namespace security
+} // namespace ndn
diff --git a/src/security/transform/verifier-filter.hpp b/src/security/transform/verifier-filter.hpp
new file mode 100644
index 0000000..ee69f03
--- /dev/null
+++ b/src/security/transform/verifier-filter.hpp
@@ -0,0 +1,73 @@
+/* -*- 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_VERIFIER_FILTER_HPP
+#define NDN_CXX_SECURITY_TRANSFORM_VERIFIER_FILTER_HPP
+
+#include "transform-base.hpp"
+#include "public-key.hpp"
+#include "../security-common.hpp"
+
+namespace ndn {
+namespace security {
+namespace transform {
+
+/**
+ * @brief The module to verify signature.
+ *
+ * The next module is usually SinkBool.
+ */
+class VerifierFilter : public Transform
+{
+public:
+  /**
+   * @brief Create a verifier module to verify signature @p sig using algorithm @p algo and @p key
+   */
+  VerifierFilter(DigestAlgorithm algo, const PublicKey& key, const uint8_t* sig, size_t sigLen);
+
+private:
+  /**
+   * @brief Write data @p buf into verifier
+   *
+   * @return The number of bytes that are actually written
+   */
+  virtual size_t
+  convert(const uint8_t* buf, size_t size) final;
+
+  /**
+   * @brief Finalize verification and write the result (single byte) into next module.
+   */
+  virtual void
+  finalize() final;
+
+private:
+  class Impl;
+  unique_ptr<Impl> m_impl;
+};
+
+unique_ptr<Transform>
+verifierFilter(DigestAlgorithm algo, const PublicKey& key, const uint8_t* sig, size_t sigLen);
+
+} // namespace transform
+} // namespace security
+} // namespace ndn
+
+#endif // NDN_CXX_SECURITY_TRANSFORM_VERIFIER_FILTER_HPP
