diff --git a/tests/unit-tests/security/v2/key-chain.t.cpp b/tests/unit-tests/security/v2/key-chain.t.cpp
index f438ea4..950b97e 100644
--- a/tests/unit-tests/security/v2/key-chain.t.cpp
+++ b/tests/unit-tests/security/v2/key-chain.t.cpp
@@ -21,11 +21,11 @@
 
 #include "security/v2/key-chain.hpp"
 #include "security/signing-helpers.hpp"
+#include "security/verification-helpers.hpp"
 
 #include "boost-test.hpp"
 #include "unit-tests/test-home-env-saver.hpp"
 #include "identity-management-fixture.hpp"
-#include "validator.hpp"
 
 namespace ndn {
 namespace security {
@@ -313,8 +313,8 @@
       BOOST_CHECK_EQUAL(data.getSignature().getType(), tlv::DigestSha256);
       BOOST_CHECK_EQUAL(interestSignature.getType(), tlv::DigestSha256);
 
-      BOOST_CHECK(Validator::verifySha256Digest(data));
-      BOOST_CHECK(Validator::verifySha256Digest(interest));
+      BOOST_CHECK(verifyDigest(data, DigestAlgorithm::SHA256));
+      BOOST_CHECK(verifyDigest(interest, DigestAlgorithm::SHA256));
     }
     else {
       BOOST_CHECK_EQUAL(data.getSignature().getType(), tlv::SignatureSha256WithEcdsa);
@@ -323,8 +323,8 @@
       BOOST_CHECK_EQUAL(data.getSignature().getKeyLocator().getName(), cert.getName().getPrefix(-2));
       BOOST_CHECK_EQUAL(interestSignature.getKeyLocator().getName(), cert.getName().getPrefix(-2));
 
-      BOOST_CHECK(Validator::verifySignature(data, key.getPublicKey()));
-      BOOST_CHECK(Validator::verifySignature(interest, key.getPublicKey()));
+      BOOST_CHECK(verifySignature(data, key));
+      BOOST_CHECK(verifySignature(interest, key));
     }
   }
 }
diff --git a/tests/unit-tests/security/v2/validator.hpp b/tests/unit-tests/security/v2/validator.hpp
deleted file mode 100644
index 960796c..0000000
--- a/tests/unit-tests/security/v2/validator.hpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2017 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.hpp"
-#include "encoding/buffer-stream.hpp"
-
-namespace ndn {
-namespace security {
-namespace v2 {
-
-// TODO: Remove after the new validator is merged
-class Validator
-{
-public:
-  static bool
-  verifySignature(const uint8_t* data, size_t dataLen,
-                  const uint8_t* sig, size_t sigLen,
-                  const Buffer& key)
-  {
-    using namespace transform;
-
-    PublicKey pKey;
-    bool result = false;
-    pKey.loadPkcs8(key.buf(), key.size());
-    bufferSource(data, dataLen) >> verifierFilter(DigestAlgorithm::SHA256, pKey, sig, sigLen) >> boolSink(result);
-
-    return result;
-  }
-
-  static bool
-  verifySignature(const Data& data, const Buffer& key)
-  {
-    return verifySignature(data.wireEncode().value(), data.wireEncode().value_size() - data.getSignature().getValue().size(),
-                           data.getSignature().getValue().value(), data.getSignature().getValue().value_size(),
-                           key);
-  }
-
-  static bool
-  verifySignature(const Interest& interest, const Buffer& key)
-  {
-    const Name& interestName = interest.getName();
-    const Block& nameBlock = interestName.wireEncode();
-    const Block& sigValue = interestName[-1].blockFromValue();
-
-    return verifySignature(nameBlock.value(), nameBlock.value_size() - interestName[-1].size(),
-                           sigValue.value(), sigValue.value_size(),
-                           key);
-  }
-
-  static bool
-  verifySha256Digest(const uint8_t* data, size_t dataLen,
-                     const uint8_t* sig, size_t sigLen)
-  {
-    using namespace transform;
-
-    OBufferStream os;
-    bufferSource(data, dataLen) >> digestFilter(DigestAlgorithm::SHA256) >> streamSink(os);
-    ConstBufferPtr digest = os.buf();
-
-    return std::equal(digest->begin(), digest->end(), sig);
-  }
-
-  static bool
-  verifySha256Digest(const Data& data)
-  {
-    return verifySha256Digest(data.wireEncode().value(), data.wireEncode().value_size() - data.getSignature().getValue().size(),
-                              data.getSignature().getValue().value(), data.getSignature().getValue().value_size());
-  }
-
-  static bool
-  verifySha256Digest(const Interest& interest)
-  {
-    const Name& interestName = interest.getName();
-    const Block& nameBlock = interestName.wireEncode();
-    const Block& sigValue = interestName[-1].blockFromValue();
-
-    return verifySha256Digest(nameBlock.value(), nameBlock.value_size() - interestName[-1].size(),
-                              sigValue.value(), sigValue.value_size());
-  }
-};
-
-} // namespace v2
-} // namespace security
-} // namespace ndn
