diff --git a/src/face.cpp b/src/face.cpp
index be2aaa1..7f3880a 100644
--- a/src/face.cpp
+++ b/src/face.cpp
@@ -194,83 +194,38 @@
 
 const RegisteredPrefixId*
 Face::setInterestFilter(const InterestFilter& interestFilter,
-                        const OnInterest& onInterest,
-                        const RegisterPrefixSuccessCallback& onSuccess,
-                        const RegisterPrefixFailureCallback& onFailure,
-                        const IdentityCertificate& certificate,
-                        uint64_t flags)
+                  const OnInterest& onInterest,
+                  const RegisterPrefixFailureCallback& onFailure,
+                  const security::SigningInfo& signingInfo,
+                  uint64_t flags)
 {
-  shared_ptr<InterestFilterRecord> filter =
-    make_shared<InterestFilterRecord>(interestFilter, onInterest);
-
-  nfd::CommandOptions options;
-  if (!certificate.getName().empty()) {
-    options.setSigningInfo(signingByCertificate(certificate.getName()));
-  }
-
-  return m_impl->registerPrefix(interestFilter.getPrefix(), filter,
-                                onSuccess, onFailure,
-                                flags, options);
+    return setInterestFilter(interestFilter,
+                             onInterest,
+                             RegisterPrefixSuccessCallback(),
+                             onFailure,
+                             signingInfo,
+                             flags);
 }
 
 const RegisteredPrefixId*
 Face::setInterestFilter(const InterestFilter& interestFilter,
-                        const OnInterest& onInterest,
-                        const RegisterPrefixFailureCallback& onFailure,
-                        const IdentityCertificate& certificate,
-                        uint64_t flags)
+                  const OnInterest& onInterest,
+                  const RegisterPrefixSuccessCallback& onSuccess,
+                  const RegisterPrefixFailureCallback& onFailure,
+                  const security::SigningInfo& signingInfo,
+                  uint64_t flags)
 {
-  shared_ptr<InterestFilterRecord> filter =
-    make_shared<InterestFilterRecord>(interestFilter, onInterest);
+    shared_ptr<InterestFilterRecord> filter =
+      make_shared<InterestFilterRecord>(interestFilter, onInterest);
 
-  nfd::CommandOptions options;
-  if (!certificate.getName().empty()) {
-    options.setSigningInfo(signingByCertificate(certificate.getName()));
-  }
+    nfd::CommandOptions options;
+    options.setSigningInfo(signingInfo);
 
-  return m_impl->registerPrefix(interestFilter.getPrefix(), filter,
-                                RegisterPrefixSuccessCallback(), onFailure,
-                                flags, options);
+    return m_impl->registerPrefix(interestFilter.getPrefix(), filter,
+                                  onSuccess, onFailure,
+                                  flags, options);
 }
 
-const RegisteredPrefixId*
-Face::setInterestFilter(const InterestFilter& interestFilter,
-                        const OnInterest& onInterest,
-                        const RegisterPrefixSuccessCallback& onSuccess,
-                        const RegisterPrefixFailureCallback& onFailure,
-                        const Name& identity,
-                        uint64_t flags)
-{
-  shared_ptr<InterestFilterRecord> filter =
-    make_shared<InterestFilterRecord>(interestFilter, onInterest);
-
-  nfd::CommandOptions options;
-  options.setSigningInfo(signingByIdentity(identity));
-
-  return m_impl->registerPrefix(interestFilter.getPrefix(), filter,
-                                onSuccess, onFailure,
-                                flags, options);
-}
-
-const RegisteredPrefixId*
-Face::setInterestFilter(const InterestFilter& interestFilter,
-                        const OnInterest& onInterest,
-                        const RegisterPrefixFailureCallback& onFailure,
-                        const Name& identity,
-                        uint64_t flags)
-{
-  shared_ptr<InterestFilterRecord> filter =
-    make_shared<InterestFilterRecord>(interestFilter, onInterest);
-
-  nfd::CommandOptions options;
-  options.setSigningInfo(signingByIdentity(identity));
-
-  return m_impl->registerPrefix(interestFilter.getPrefix(), filter,
-                                RegisterPrefixSuccessCallback(), onFailure,
-                                flags, options);
-}
-
-
 const InterestFilterId*
 Face::setInterestFilter(const InterestFilter& interestFilter,
                         const OnInterest& onInterest)
@@ -283,6 +238,87 @@
   return reinterpret_cast<const InterestFilterId*>(filter.get());
 }
 
+#ifdef NDN_FACE_KEEP_DEPRECATED_REGISTRATION_SIGNING
+
+const RegisteredPrefixId*
+Face::setInterestFilter(const InterestFilter& interestFilter,
+                        const OnInterest& onInterest,
+                        const RegisterPrefixSuccessCallback& onSuccess,
+                        const RegisterPrefixFailureCallback& onFailure,
+                        const IdentityCertificate& certificate,
+                        uint64_t flags)
+{
+  security::SigningInfo signingInfo;
+  if (!certificate.getName().empty()) {
+    signingInfo = signingByCertificate(certificate.getName());
+  }
+  return setInterestFilter(interestFilter, onInterest,
+                           onSuccess, onFailure,
+                           signingInfo, flags);
+}
+
+const RegisteredPrefixId*
+Face::setInterestFilter(const InterestFilter& interestFilter,
+                        const OnInterest& onInterest,
+                        const RegisterPrefixFailureCallback& onFailure,
+                        const IdentityCertificate& certificate,
+                        uint64_t flags)
+{
+  security::SigningInfo signingInfo;
+  if (!certificate.getName().empty()) {
+    signingInfo = signingByCertificate(certificate.getName());
+  }
+  return setInterestFilter(interestFilter, onInterest,
+                             onFailure, signingInfo, flags);
+}
+
+const RegisteredPrefixId*
+Face::setInterestFilter(const InterestFilter& interestFilter,
+                        const OnInterest& onInterest,
+                        const RegisterPrefixSuccessCallback& onSuccess,
+                        const RegisterPrefixFailureCallback& onFailure,
+                        const Name& identity,
+                        uint64_t flags)
+{
+  security::SigningInfo signingInfo = signingByIdentity(identity);
+
+  return setInterestFilter(interestFilter, onInterest,
+                           onSuccess, onFailure,
+                           signingInfo, flags);
+}
+
+const RegisteredPrefixId*
+Face::setInterestFilter(const InterestFilter& interestFilter,
+                        const OnInterest& onInterest,
+                        const RegisterPrefixFailureCallback& onFailure,
+                        const Name& identity,
+                        uint64_t flags)
+{
+  security::SigningInfo signingInfo = signingByIdentity(identity);
+
+  return setInterestFilter(interestFilter, onInterest,
+                           onFailure, signingInfo, flags);
+}
+
+#endif // NDN_FACE_KEEP_DEPRECATED_REGISTRATION_SIGNING
+
+const RegisteredPrefixId*
+Face::registerPrefix(const Name& prefix,
+               const RegisterPrefixSuccessCallback& onSuccess,
+               const RegisterPrefixFailureCallback& onFailure,
+               const security::SigningInfo& signingInfo,
+               uint64_t flags)
+{
+
+    nfd::CommandOptions options;
+    options.setSigningInfo(signingInfo);
+
+    return m_impl->registerPrefix(prefix, shared_ptr<InterestFilterRecord>(),
+                                  onSuccess, onFailure,
+                                  flags, options);
+}
+
+#ifdef NDN_FACE_KEEP_DEPRECATED_REGISTRATION_SIGNING
 const RegisteredPrefixId*
 Face::registerPrefix(const Name& prefix,
                      const RegisterPrefixSuccessCallback& onSuccess,
@@ -290,14 +326,12 @@
                      const IdentityCertificate& certificate,
                      uint64_t flags)
 {
-  nfd::CommandOptions options;
+  security::SigningInfo signingInfo;
   if (!certificate.getName().empty()) {
-    options.setSigningInfo(signingByCertificate(certificate.getName()));
+    signingInfo = signingByCertificate(certificate.getName());
   }
-
-  return m_impl->registerPrefix(prefix, shared_ptr<InterestFilterRecord>(),
-                                onSuccess, onFailure,
-                                flags, options);
+  return registerPrefix(prefix, onSuccess,
+                        onFailure, signingInfo, flags);
 }
 
 const RegisteredPrefixId*
@@ -307,13 +341,11 @@
                      const Name& identity,
                      uint64_t flags)
 {
-  nfd::CommandOptions options;
-  options.setSigningInfo(signingByIdentity(identity));
-
-  return m_impl->registerPrefix(prefix, shared_ptr<InterestFilterRecord>(),
-                                onSuccess, onFailure,
-                                flags, options);
+  security::SigningInfo signingInfo = signingByIdentity(identity);
+  return registerPrefix(prefix, onSuccess,
+                        onFailure, signingInfo, flags);
 }
+#endif // NDN_FACE_KEEP_DEPRECATED_REGISTRATION_SIGNING
 
 void
 Face::unsetInterestFilter(const RegisteredPrefixId* registeredPrefixId)
diff --git a/src/face.hpp b/src/face.hpp
index 2d76773..ab526c3 100644
--- a/src/face.hpp
+++ b/src/face.hpp
@@ -28,7 +28,13 @@
 #include "interest.hpp"
 #include "interest-filter.hpp"
 #include "data.hpp"
+#include "security/signing-info.hpp"
+
+#define NDN_FACE_KEEP_DEPRECATED_REGISTRATION_SIGNING
+
+#ifdef NDN_FACE_KEEP_DEPRECATED_REGISTRATION_SIGNING
 #include "security/identity-certificate.hpp"
+#endif // NDN_FACE_KEEP_DEPRECATED_REGISTRATION_SIGNING
 
 namespace boost {
 namespace asio {
@@ -247,58 +253,19 @@
    *
    * @param interestFilter Interest filter (prefix part will be registered with the forwarder)
    * @param onInterest     A callback to be called when a matching interest is received
-   * @param onSuccess      A callback to be called when prefixRegister command succeeds
    * @param onFailure      A callback to be called when prefixRegister command fails
    * @param flags          (optional) RIB flags
-   * @param certificate    (optional) A certificate under which the prefix registration
-   *                       command is signed.  When omitted, a default certificate of
-   *                       the default identity is used to sign the registration command
+   * @param signingInfo    (optional) Signing parameters.  When omitted, a default parameters
+   *                       used in the signature will be used.
    *
    * @return Opaque registered prefix ID which can be used with unsetInterestFilter or
    *         removeRegisteredPrefix
-   *
-   * @note IdentityCertificate() creates a certificate with an empty name, which is an invalid
-   *       certificate.  A valid IdentityCertificate has at least 4 name components, as it follows
-   *       `<...>/KEY/<...>/<key-id>/ID-CERT/<version>` naming model.
-   */
-  const RegisteredPrefixId*
-  setInterestFilter(const InterestFilter& interestFilter,
-                    const OnInterest& onInterest,
-                    const RegisterPrefixSuccessCallback& onSuccess,
-                    const RegisterPrefixFailureCallback& onFailure,
-                    const IdentityCertificate& certificate = IdentityCertificate(),
-                    uint64_t flags = nfd::ROUTE_FLAG_CHILD_INHERIT);
-
-  /**
-   * @brief Set InterestFilter to dispatch incoming matching interest to onInterest
-   * callback and register the filtered prefix with the connected NDN forwarder
-   *
-   * This version of setInterestFilter combines setInterestFilter and registerPrefix
-   * operations and is intended to be used when only one filter for the same prefix needed
-   * to be set.  When multiple names sharing the same prefix should be dispatched to
-   * different callbacks, use one registerPrefix call, followed (in onSuccess callback) by
-   * a series of setInterestFilter calls.
-   *
-   * @param interestFilter Interest filter (prefix part will be registered with the forwarder)
-   * @param onInterest     A callback to be called when a matching interest is received
-   * @param onFailure      A callback to be called when prefixRegister command fails
-   * @param flags          (optional) RIB flags
-   * @param certificate    (optional) A certificate under which the prefix registration
-   *                       command is signed.  When omitted, a default certificate of
-   *                       the default identity is used to sign the registration command
-   *
-   * @return Opaque registered prefix ID which can be used with unsetInterestFilter or
-   *         removeRegisteredPrefix
-   *
-   * @note IdentityCertificate() creates a certificate with an empty name, which is an invalid
-   *       certificate.  A valid IdentityCertificate has at least 4 name components, as it follows
-   *       `<...>/KEY/<...>/<key-id>/ID-CERT/<version>` naming model.
    */
   const RegisteredPrefixId*
   setInterestFilter(const InterestFilter& interestFilter,
                     const OnInterest& onInterest,
                     const RegisterPrefixFailureCallback& onFailure,
-                    const IdentityCertificate& certificate = IdentityCertificate(),
+                    const security::SigningInfo& signingInfo = security::SigningInfo(),
                     uint64_t flags = nfd::ROUTE_FLAG_CHILD_INHERIT);
 
   /**
@@ -315,44 +282,19 @@
    * @param onInterest     A callback to be called when a matching interest is received
    * @param onSuccess      A callback to be called when prefixRegister command succeeds
    * @param onFailure      A callback to be called when prefixRegister command fails
-   * @param identity       A signing identity. A prefix registration command is signed
-   *                       under the default certificate of this identity
    * @param flags          (optional) RIB flags
+   * @param signingInfo    (optional) Signing parameters.  When omitted, a default parameters
+   *                       used in the signature will be used.
    *
-   * @return Opaque registered prefix ID which can be used with removeRegisteredPrefix
+   * @return Opaque registered prefix ID which can be used with unsetInterestFilter or
+   *         removeRegisteredPrefix
    */
   const RegisteredPrefixId*
   setInterestFilter(const InterestFilter& interestFilter,
                     const OnInterest& onInterest,
                     const RegisterPrefixSuccessCallback& onSuccess,
                     const RegisterPrefixFailureCallback& onFailure,
-                    const Name& identity,
-                    uint64_t flags = nfd::ROUTE_FLAG_CHILD_INHERIT);
-
-  /**
-   * @brief Set InterestFilter to dispatch incoming matching interest to onInterest
-   * callback and register the filtered prefix with the connected NDN forwarder
-   *
-   * This version of setInterestFilter combines setInterestFilter and registerPrefix
-   * operations and is intended to be used when only one filter for the same prefix needed
-   * to be set.  When multiple names sharing the same prefix should be dispatched to
-   * different callbacks, use one registerPrefix call, followed (in onSuccess callback) by
-   * a series of setInterestFilter calls.
-   *
-   * @param interestFilter Interest filter (prefix part will be registered with the forwarder)
-   * @param onInterest     A callback to be called when a matching interest is received
-   * @param onFailure      A callback to be called when prefixRegister command fails
-   * @param identity       A signing identity. A prefix registration command is signed
-   *                       under the default certificate of this identity
-   * @param flags          (optional) RIB flags
-   *
-   * @return Opaque registered prefix ID which can be used with removeRegisteredPrefix
-   */
-  const RegisteredPrefixId*
-  setInterestFilter(const InterestFilter& interestFilter,
-                    const OnInterest& onInterest,
-                    const RegisterPrefixFailureCallback& onFailure,
-                    const Name& identity,
+                    const security::SigningInfo& signingInfo = security::SigningInfo(),
                     uint64_t flags = nfd::ROUTE_FLAG_CHILD_INHERIT);
 
   /**
@@ -371,8 +313,149 @@
   setInterestFilter(const InterestFilter& interestFilter,
                     const OnInterest& onInterest);
 
+#ifdef NDN_FACE_KEEP_DEPRECATED_REGISTRATION_SIGNING
+  /**
+   * @deprecated Use override with SigningInfo instead of this function
+   * @brief Set InterestFilter to dispatch incoming matching interest to onInterest
+   * callback and register the filtered prefix with the connected NDN forwarder
+   *
+   * This version of setInterestFilter combines setInterestFilter and registerPrefix
+   * operations and is intended to be used when only one filter for the same prefix needed
+   * to be set.  When multiple names sharing the same prefix should be dispatched to
+   * different callbacks, use one registerPrefix call, followed (in onSuccess callback) by
+   * a series of setInterestFilter calls.
+   *
+   * @param interestFilter Interest filter (prefix part will be registered with the forwarder)
+   * @param onInterest     A callback to be called when a matching interest is received
+   * @param onSuccess      A callback to be called when prefixRegister command succeeds
+   * @param onFailure      A callback to be called when prefixRegister command fails
+   * @param flags          (optional) RIB flags
+   * @param certificate    (optional) A certificate under which the prefix registration
+   *                       command is signed.  When omitted, a default certificate of
+   *                       the default identity is used to sign the registration command
+   *
+   * @return Opaque registered prefix ID which can be used with unsetInterestFilter or
+   *         removeRegisteredPrefix
+   */
+  const RegisteredPrefixId*
+  setInterestFilter(const InterestFilter& interestFilter,
+                    const OnInterest& onInterest,
+                    const RegisterPrefixSuccessCallback& onSuccess,
+                    const RegisterPrefixFailureCallback& onFailure,
+                    const IdentityCertificate& certificate,
+                    uint64_t flags = nfd::ROUTE_FLAG_CHILD_INHERIT);
 
   /**
+   * @deprecated Use override with SigningInfo instead of this function
+   * @brief Set InterestFilter to dispatch incoming matching interest to onInterest
+   * callback and register the filtered prefix with the connected NDN forwarder
+   *
+   * This version of setInterestFilter combines setInterestFilter and registerPrefix
+   * operations and is intended to be used when only one filter for the same prefix needed
+   * to be set.  When multiple names sharing the same prefix should be dispatched to
+   * different callbacks, use one registerPrefix call, followed (in onSuccess callback) by
+   * a series of setInterestFilter calls.
+   *
+   * @param interestFilter Interest filter (prefix part will be registered with the forwarder)
+   * @param onInterest     A callback to be called when a matching interest is received
+   * @param onFailure      A callback to be called when prefixRegister command fails
+   * @param flags          (optional) RIB flags
+   * @param certificate    (optional) A certificate under which the prefix registration
+   *                       command is signed.  When omitted, a default certificate of
+   *                       the default identity is used to sign the registration command
+   *
+   * @return Opaque registered prefix ID which can be used with unsetInterestFilter or
+   *         removeRegisteredPrefix
+   */
+  const RegisteredPrefixId*
+  setInterestFilter(const InterestFilter& interestFilter,
+                    const OnInterest& onInterest,
+                    const RegisterPrefixFailureCallback& onFailure,
+                    const IdentityCertificate& certificate,
+                    uint64_t flags = nfd::ROUTE_FLAG_CHILD_INHERIT);
+
+  /**
+   * @deprecated Use override with SigningInfo instead of this function
+   * @brief Set InterestFilter to dispatch incoming matching interest to onInterest
+   * callback and register the filtered prefix with the connected NDN forwarder
+   *
+   * This version of setInterestFilter combines setInterestFilter and registerPrefix
+   * operations and is intended to be used when only one filter for the same prefix needed
+   * to be set.  When multiple names sharing the same prefix should be dispatched to
+   * different callbacks, use one registerPrefix call, followed (in onSuccess callback) by
+   * a series of setInterestFilter calls.
+   *
+   * @param interestFilter Interest filter (prefix part will be registered with the forwarder)
+   * @param onInterest     A callback to be called when a matching interest is received
+   * @param onSuccess      A callback to be called when prefixRegister command succeeds
+   * @param onFailure      A callback to be called when prefixRegister command fails
+   * @param identity       A signing identity. A prefix registration command is signed
+   *                       under the default certificate of this identity
+   * @param flags          (optional) RIB flags
+   *
+   * @return Opaque registered prefix ID which can be used with removeRegisteredPrefix
+   */
+  const RegisteredPrefixId*
+  setInterestFilter(const InterestFilter& interestFilter,
+                    const OnInterest& onInterest,
+                    const RegisterPrefixSuccessCallback& onSuccess,
+                    const RegisterPrefixFailureCallback& onFailure,
+                    const Name& identity,
+                    uint64_t flags = nfd::ROUTE_FLAG_CHILD_INHERIT);
+
+  /**
+   * @deprecated Use override with SigningInfo instead of this function
+   * @brief Set InterestFilter to dispatch incoming matching interest to onInterest
+   * callback and register the filtered prefix with the connected NDN forwarder
+   *
+   * This version of setInterestFilter combines setInterestFilter and registerPrefix
+   * operations and is intended to be used when only one filter for the same prefix needed
+   * to be set.  When multiple names sharing the same prefix should be dispatched to
+   * different callbacks, use one registerPrefix call, followed (in onSuccess callback) by
+   * a series of setInterestFilter calls.
+   *
+   * @param interestFilter Interest filter (prefix part will be registered with the forwarder)
+   * @param onInterest     A callback to be called when a matching interest is received
+   * @param onFailure      A callback to be called when prefixRegister command fails
+   * @param identity       A signing identity. A prefix registration command is signed
+   *                       under the default certificate of this identity
+   * @param flags          (optional) RIB flags
+   *
+   * @return Opaque registered prefix ID which can be used with removeRegisteredPrefix
+   */
+  const RegisteredPrefixId*
+  setInterestFilter(const InterestFilter& interestFilter,
+                    const OnInterest& onInterest,
+                    const RegisterPrefixFailureCallback& onFailure,
+                    const Name& identity,
+                    uint64_t flags = nfd::ROUTE_FLAG_CHILD_INHERIT);
+#endif // NDN_FACE_KEEP_DEPRECATED_REGISTRATION_SIGNING
+
+  /**
+   * @brief Register prefix with the connected NDN forwarder
+   *
+   * This method only modifies forwarder's RIB and does not associate any
+   * onInterest callbacks.  Use setInterestFilter method to dispatch incoming Interests to
+   * the right callbacks.
+   *
+   * @param prefix      A prefix to register with the connected NDN forwarder
+   * @param onSuccess   A callback to be called when prefixRegister command succeeds
+   * @param onFailure   A callback to be called when prefixRegister command fails
+   * @param signingInfo (optional) Signing parameters.  When omitted, a default parameters
+   *                    used in the signature will be used.
+   *
+   * @return The registered prefix ID which can be used with unregisterPrefix
+   */
+  const RegisteredPrefixId*
+  registerPrefix(const Name& prefix,
+                 const RegisterPrefixSuccessCallback& onSuccess,
+                 const RegisterPrefixFailureCallback& onFailure,
+                 const security::SigningInfo& signingInfo = security::SigningInfo(),
+                 uint64_t flags = nfd::ROUTE_FLAG_CHILD_INHERIT);
+
+#ifdef NDN_FACE_KEEP_DEPRECATED_REGISTRATION_SIGNING
+  /**
+   * @deprecated Use override with SigningInfo instead of this function
    * @brief Register prefix with the connected NDN forwarder
    *
    * This method only modifies forwarder's RIB and does not associate any
@@ -388,19 +471,16 @@
    * @param flags       (optional) RIB flags
    *
    * @return The registered prefix ID which can be used with unregisterPrefix
-   *
-   * @note IdentityCertificate() creates a certificate with an empty name, which is an invalid
-   *       certificate.  A valid IdentityCertificate has at least 4 name components, as it follows
-   *       `<...>/KEY/<...>/<key-id>/ID-CERT/<version>` naming model.
    */
   const RegisteredPrefixId*
   registerPrefix(const Name& prefix,
                  const RegisterPrefixSuccessCallback& onSuccess,
                  const RegisterPrefixFailureCallback& onFailure,
-                 const IdentityCertificate& certificate = IdentityCertificate(),
+                 const IdentityCertificate& certificate,
                  uint64_t flags = nfd::ROUTE_FLAG_CHILD_INHERIT);
 
   /**
+   * @deprecated Use override with SigningInfo instead of this function
    * @brief Register prefix with the connected NDN forwarder and call onInterest when a matching
    *        interest is received.
    *
@@ -423,6 +503,7 @@
                  const RegisterPrefixFailureCallback& onFailure,
                  const Name& identity,
                  uint64_t flags = nfd::ROUTE_FLAG_CHILD_INHERIT);
+#endif // NDN_FACE_KEEP_DEPRECATED_REGISTRATION_SIGNING
 
   /**
    * @brief Remove the registered prefix entry with the registeredPrefixId
diff --git a/src/security/conf/checker.hpp b/src/security/conf/checker.hpp
index 3c4ceb2..1364229 100644
--- a/src/security/conf/checker.hpp
+++ b/src/security/conf/checker.hpp
@@ -29,6 +29,7 @@
 #include "key-locator-checker.hpp"
 #include "../../util/io.hpp"
 #include "../validator.hpp"
+#include "../identity-certificate.hpp"
 
 #include <boost/algorithm/string.hpp>
 #include <boost/filesystem.hpp>
diff --git a/src/security/validator.hpp b/src/security/validator.hpp
index 5311795..d0faf22 100644
--- a/src/security/validator.hpp
+++ b/src/security/validator.hpp
@@ -34,8 +34,10 @@
 #include "signature-sha256-with-ecdsa.hpp"
 #include "digest-sha256.hpp"
 #include "validation-request.hpp"
+#include "identity-certificate.hpp"
 
 namespace ndn {
+
 /**
  * @brief Validator is one of the main classes of the security library.
  *
diff --git a/tests/unit-tests/face.t.cpp b/tests/unit-tests/face.t.cpp
index 19e6739..94d0935 100644
--- a/tests/unit-tests/face.t.cpp
+++ b/tests/unit-tests/face.t.cpp
@@ -188,6 +188,45 @@
   advanceClocks(time::milliseconds(10), 10);
 }
 
+BOOST_AUTO_TEST_CASE(SetUnsetInterestFilterWithoutSucessCallback)
+{
+  size_t nInterests = 0;
+  const RegisteredPrefixId* regPrefixId =
+    face->setInterestFilter("/Hello/World",
+                            bind([&nInterests] { ++nInterests; }),
+                            bind([] {
+                                BOOST_FAIL("Unexpected setInterestFilter failure");
+                              }));
+  advanceClocks(time::milliseconds(10), 10);
+  BOOST_CHECK_EQUAL(nInterests, 0);
+
+  face->receive(Interest("/Hello/World/!"));
+  advanceClocks(time::milliseconds(10), 10);
+
+  BOOST_CHECK_EQUAL(nInterests, 1);
+
+  face->receive(Interest("/Bye/World/!"));
+  advanceClocks(time::milliseconds(10000), 10);
+  BOOST_CHECK_EQUAL(nInterests, 1);
+
+  face->receive(Interest("/Hello/World/!/2"));
+  advanceClocks(time::milliseconds(10), 10);
+  BOOST_CHECK_EQUAL(nInterests, 2);
+
+  // removing filter
+  face->unsetInterestFilter(regPrefixId);
+  advanceClocks(time::milliseconds(10), 10);
+
+  face->receive(Interest("/Hello/World/!/3"));
+  BOOST_CHECK_EQUAL(nInterests, 2);
+
+  face->unsetInterestFilter(static_cast<const RegisteredPrefixId*>(0));
+  advanceClocks(time::milliseconds(10), 10);
+
+  face->unsetInterestFilter(static_cast<const InterestFilterId*>(0));
+  advanceClocks(time::milliseconds(10), 10);
+}
+
 BOOST_FIXTURE_TEST_CASE(SetInterestFilterFail, FacesNoRegistrationReplyFixture)
 {
   // don't enable registration reply
@@ -210,6 +249,25 @@
   BOOST_CHECK_EQUAL(nRegFailed, 1);
 }
 
+BOOST_FIXTURE_TEST_CASE(SetInterestFilterFailWithoutSuccessCallback, FacesNoRegistrationReplyFixture)
+{
+  // don't enable registration reply
+  size_t nRegFailed = 0;
+  face->setInterestFilter("/Hello/World",
+                          bind([] {
+                              BOOST_FAIL("Unexpected Interest");
+                            }),
+                          bind([&nRegFailed] {
+                              ++nRegFailed;
+                            }));
+
+  advanceClocks(time::milliseconds(10), 10);
+  BOOST_CHECK_EQUAL(nRegFailed, 0);
+
+  advanceClocks(time::milliseconds(1000), 10);
+  BOOST_CHECK_EQUAL(nRegFailed, 1);
+}
+
 BOOST_AUTO_TEST_CASE(RegisterUnregisterPrefix)
 {
   size_t nRegSuccesses = 0;
